Python Development in NetBeans IDE
The bits are available (milestone releases) for download now as NetBeans modules (nbms).
Let us get started:
- Download/lnstall the M3 NBMs from here.
- Fire up NetBeans IDE.
- Go to Tools -> Plugins -> Downloaded Tab.
- Click on "Add Plugins" and select all the NBM files in the unzipped directory.
- Now, you will see all the chosen modules along with their descriptions. You should see something like this:
- Press the "Install" button.
- Using NetBeans IDE 6.1, I get a dependency error:
- Then, I downloaded a latest build NetBeans IDE Build 200806220002 from here and repeated the above steps. This time there was no dependency problem.
- You will get a "Validation Warning". Press "Continue":
- The installation will continue and will be over without any further user interaction required.



Creating a New Python Project
- Go to File-> New Project-> Python-> Python Project. Choose a Project Name- say "HelloNbPython". Click on Finish.

- A new project gets created and is visible in the Project Explorer window. No default file is created.
- Right Click on the project name, and select New-> Empty Python File. Enter a name, say- HelloWorld.

- A Python script will be generated for you which will simply print "Hello World".
The project tree is now as follows:
HelloNbPython/pyproject/project.properties
src/HelloWorld.py
Runing a Python Script
- Right Click on HelloWorld.py in the project explorer and click "Run Python Script".
- First time I did this, I got the following exception message:
java.io.IOException: Cannot run program "/home/amit/netbeans-dev-200806220002/nbpython/jython-2.5/bin/jython" (in directory "/home/amit/NetBeansProjects/HelloNbPython"): java.io.IOException: error=13, Permission denied - So I checked the file permission of the 'jython' executable:
- $ ls -l jython
-rw-r--r-- 1 amit amit 5101 2008-06-22 15:05 jython - As you can see there is no executable permission for 'jython' as indicated by the absence of the 'x' flag
- So, I made the 'jython' executable by: chmod +x jython
- $ ls -l jython
- Run the script again and you should get "Hello World" in the output window.
Article Type:
How-to
(1 vote)
- Login or register to post comments
- 1310 reads
- Email this Article
- Printer-friendly version
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)







