parsing issue?

You think you found a bug, but you're not sure... or maybe you know you found a bug!

parsing issue?

Postby BartmanEH » Sat Jun 13, 2015 5:32 pm

I've imported a Python file from here: https://gist.github.com/pchng/88e3f4e724b7c6b8763c into a PHP project. It seems to work as expected when I execute the Python script from PHP, however, NBPython is highlighting two lines red with errors. I'm a noob and can't figure out what NBPython is unhappy about with the following two lines:
Code: Select all
    attributes = {k:v.encode('utf-8') for (k, v) in attributes.iteritems() if k in fields}
and
Code: Select all
  date = date + datetime.timedelta(1)
The first reports 8 errors the first being "no viable alternative at input 'for'" and then various others related to 'mismatched input 'for' expecting RCURLY" etc.

I randomly discovered that f I put ' EOF' at the end of the file, the errors are no longer reported. I don't think this is a good solution for many reasons not the least of which is I would like to import changes to the Python code in the future without having to modify it just to make NBPython happy.

Any idea why NBPython is unhappy with this code?
BartmanEH
 
Posts: 4
Joined: Sat Jun 13, 2015 3:03 pm

Re: parsing issue?

Postby Jenselme » Sun Jun 14, 2015 7:50 am

My guess is that you are using the current release version of nbpython from: http://plugins.netbeans.org/plugin/56795?show=true. The problem is that to report bugs, the plugins rely on jython. The version of jython that comes from this release of nbpython is quite old and doesn't support some syntax (including dict comprehension). This is solved in the dev version of the plugin. See: viewtopic.php?f=9&t=57

I hope we will be able to release a new version with this fix soon.
Jenselme
 
Posts: 116
Joined: Thu Apr 16, 2015 9:05 pm
Location: Paris, France

Re: parsing issue?

Postby BartmanEH » Mon Jun 15, 2015 12:47 pm

Is it possible to install dev versions of the plugin or is that inadvisable?
BartmanEH
 
Posts: 4
Joined: Sat Jun 13, 2015 3:03 pm

Re: parsing issue?

Postby Jenselme » Mon Jun 15, 2015 12:52 pm

You can install the dev version following the instructions provided here: viewtopic.php?f=13&t=68 Please note that it requires to use the development version of netbeans. I used it today because I was tired of using the old release version, no big bugs to report. However, you should use it at your own risk (everything is in development).
Jenselme
 
Posts: 116
Joined: Thu Apr 16, 2015 9:05 pm
Location: Paris, France

Re: parsing issue?

Postby mr_lou_d » Mon Jun 15, 2015 5:23 pm

Just to emphasize, do NOT attempt to install the plugin from the Development UC into 8.0.2. Doing so WILL trash your NetBeans installation.
That being said, the Development release of NetBeans generally works fine with the Python plugin from the Development UC, with the caveat that it is still in development.

Lou Dasaro
User avatar
mr_lou_d
Site Admin
 
Posts: 237
Joined: Thu May 22, 2014 11:36 am
Location: Chicago, IL, USA

Re: parsing issue?

Postby BartmanEH » Mon Jun 15, 2015 6:48 pm

Thanks for all the helpful information. I'm pretty new to programming PHP, Python and using NetBeans - I think I'm better off waiting for official updates for both NetBeans and NBPython.
BartmanEH
 
Posts: 4
Joined: Sat Jun 13, 2015 3:03 pm

Re: parsing issue?

Postby mr_lou_d » Mon Jun 15, 2015 9:54 pm

No worries. FYI, I really like the PHP/HTML development dist with the development Python plugin.
"Official" release will be in September...
User avatar
mr_lou_d
Site Admin
 
Posts: 237
Joined: Thu May 22, 2014 11:36 am
Location: Chicago, IL, USA

Re: parsing issue?

Postby BartmanEH » Tue Jun 16, 2015 4:19 pm

Fantastic support, thanks for that. September is an awfully long time away so I went ahead and installed last night's dev build of the IDE and the dev NBPython plugin following your instructions. All seems to be well right now.

NB shows that Python Version: 0.107 is installed. Will dev build updates show as available plugin update in NB now?
BartmanEH
 
Posts: 4
Joined: Sat Jun 13, 2015 3:03 pm

Re: parsing issue?

Postby mr_lou_d » Tue Jun 16, 2015 5:13 pm

I don't think we are doing updates, per se. Ignore the Plugin version number for now, its not being incremented currently.
Python commits are shown at http://hg.netbeans.org/main/contrib.
What is shown at deadlock is our latest (assuming the build succeeded).
I periodically announce new builds, when something good has been added...
User avatar
mr_lou_d
Site Admin
 
Posts: 237
Joined: Thu May 22, 2014 11:36 am
Location: Chicago, IL, USA

Re: parsing issue?

Postby mr_lou_d » Sun Nov 29, 2015 8:33 am

The rev numbers are now incremented correctly, and Python for NetBeans 8.1 has arrived!
See http://forums.nbpython.org/viewtopic.php?f=6&t=117
User avatar
mr_lou_d
Site Admin
 
Posts: 237
Joined: Thu May 22, 2014 11:36 am
Location: Chicago, IL, USA


Return to Anomalies (Bugs)



Who is online

Users browsing this forum: No registered users and 1 guest

cron