Wednesday, July 9, 2008

Netbeans for Python !!

Just what I was waiting for !! I was looking or a way to brush up my Java skills while continuing my year-long affair with Python when news arrived that Jython was being reincarnated with Sun's hiring of Ted Leung and Frank Wierzbicki . Seeing what Sun did for JRuby, i was all excited when came this other piece of great news that Netbeans was going to support Python/Jython with an upcoming release.

Go Sun ! Go Netbeans !After reading some excellent blogs (see References), I decided to download the Milestone 4.1 standalone nbpython installer (Build 200807071204) and kick some tires.

Platform : Windows XP SP3, pre-installed with Python 2.5

First impressions (based on 10 minutes of tinkering) :

1. I created a New Project and wanted to import some existing Python files into it. Somehow this does not seem possible yet - totally sucks since the first thing that a Python developer is likely to do is to suck in a bunch of existing code and see how Netbeans works with it.

2. nbpython seems to use jython as the default python engine to run python code. On my machine, this failed to run my code throwing the following stack trace.

"java.io.IOException: CreateProcess error=193, %1 is not a valid Win32 applicationat java.lang.ProcessImpl.create(Native Method)at java.lang.ProcessImpl.(ProcessImpl.java:81)at java.lang.ProcessImpl.start(ProcessImpl.java:30)at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)Caused: java.io.IOException: Cannot run program "c:\netbeans\NetBeans\nbpython\jython-2.5\bin\jython"

3. I then decided to try and point nbpython to my existing windows python install (Tools-> Options ->Python).

4. This seemed to do the trick and i could run my first Python program.

Summary :

1. Despite being an early access build, the module does work and can be used for fairly simple testing of python code.

2. Lack of "import" support make this a non-starter if one wants to create projects with existing python code/libraries.

3. If the tool developers want to see this replace IDLE at some point, there has gotta be a way of running a Python interpreter/shell. This is critical to folks like myself who constantly Alt-tab into IDLE to quickly try out a list-comprehension/regex code snippet before integrating it into the main Python file.

4. This stuff needs Netbeans 6.5 and does NOT work on Netbeans 6.1. That probably means repeated downloads of nightly builds instead of simply updating the NBM module each time a change happens. Hope this can be fixed.

References :

3 comments:

Alley said...

Thanks for the review. The more eyes we have looking at it the better it will be.
1. Console is coming. This is something we have always believed needed to be in there.

2. I will have someone look at the import existing code.

Thanks for your support,
Allan Davis,
Lead Developer nbPython

Raghavan said...
This comment has been removed by the author.
fortysevenminutes said...

Ok. I realize it's been a while since you've written this, but I originally had some problems importing libraries as well.

I was confused because NBPython always runs in Jython, even if your project is configured to run under Python. So make sure the python path of your jython installation is correct (mine was not pointing to the correct site-packages directory).