Last Site Update: 10 January 2006 | Latest Version: 0.9.8.6

 
 
 
Home
Features
Roadmap
Screenshots
Download
Credits
More info
FAQ / BUGS
Users List (code)
Users Forum
Fabio Zadrozny Blog
Aleks Totic Blog
Hosted at
PyDev at Sourceforge
Donate
Sponsored by
 
Want a better PyDev? Why not give a small donation? (paypal)

How do I Report a BUG?

How do I get started with Pydev?

How do I configure my PYTHONPATH?

How do I configure Pydev to use JYTHON?

How do I reference Java projects with Jython?

When I do a code-completion, Pydev hangs, what can I do?

I have a library installed and Pydev does not find it

What is that 'Forced builtin libs' in the Python Interpreters preferences?

How do I configure a python shell for experimenting with Python?

The PyDev builder is taking too much of my time, what can I do about it?

Why the PyDev properties do not show?

I can see no new Python project, how am I supposed to use PyDev?

How do I run a module from within eclipse using PyDev (either Python or Jython)?

How do I know which is the command-line and PYTHONPATH used to make a python or jython run?

Code completion is not working correctly for some library

PyLint is not working, what should I do?

I have a CORBA program and I cannot debug its methods, what can I do?

OK, I know that many features are available, but I just don't know how can I access them through my keyboard!!



How do I Report a BUG?


Well, if you don't find anything that helps you, please check if it is a known BUG, if it is not, please, report it.
The place to search and report BUGS is here
When reporting a bug, don't forget to give the following information:

- System (e.g windows XP)
- Eclipse version (e.g. 3.1)
- PyDev version (e.g. 0.9.7)
- PyDev error log (if any): go to window->show view->other->PDE Runtime->Error log.
- Eclipse install location (e.g. D:\eclipse_3\302\eclipse)
- Project location where the bug appears (e.g. D:\eclipse\workspace\org.python.pydev)

NOTE: the Users Forum may be used for some doubts, but if you have a bug, that's not the place to go (even though, it might be useful searching it to see if what you have is not really a bug or if someone has already asked about it).

Return to top  


How do I get started with Pydev?


The following text was contributed by Jack Trainor as a "Hello World" to get started with pydev.


NOTE:
Specific details that may not apply to others are included, but as a developer I find it easier to modify specific working instructions, than to guess what I need from vague recommendations.

Requirements not covered in the faq:
  • Python 2.3.x or 2.4.x must be installed
  • Java 1.4 or higher must be installed
Step-by-step:
  • Unzip eclipse-SDK-3.1-win32.zip to c:\
  • Unzip org.python.pydev.feature_xxxxxx.zip to c:\
    NOTE:The download page contains instructions on how to get and install pydev using the Eclipse update manager instead of the .zip file.
  • Double-click c:\eclipse\eclipse.exe
  • Set default workspace where you want it.
  • Close Welcome splash pane.
  • Select Resource perspective: Window\Open Perspective\Other...\Select Perspective\Resource.
  • Click OK.
  • Select Window\Preferences\PyDev\Interpreter - Python.
  • Click top New... button and enter Python path, e.g., c:\Python24\python.exe
  • Click OK.
  • Click File\New\Project...
  • Select Simple\Project Wizard
  • Click Next.
  • Enter Project Name, e.g. SimpleProj1.
  • Click Finish.
  • Click File\New...\File.
  • Enter File Name, e.g. Py1.py.
  • Click Finish.
  • Right-click SimpleProj1 in Navigator pane and select Properties.
  • Click PyDev-PYTHONPATH.
  • Click top pane "Add source folder" button.
  • /SimpleProj1 should already be selected. Click OK.
  • Click top pane "Add source folder" button.
  • Add path to source folder on disk, e.g., C:\Dev\eclipse\SimpleProj1.
  • Click OK.
  • Add some Python code to Py1.py: print 'Hello world!'
  • Save.
  • Right-click on Py1.py in Navigator pane.
  • Select Run as\Python run.
  • A console window should appear showing output from the Python program.
NOTE 2:
If some specific detail does not work in the way it is described, please report it in the pydev bug-tracker.

Return to top  


How do I configure my PYTHONPATH?


There are 3 places where you have to go to configure the PYTHONPATH, and by doing so, PyLint, code completion, running and others should use this configuration.

1.Go to window->preferences->pydev->Python Interpreters and set the python interpreter location.



2.In the navigator, right click on the project root and choose 'properties'.

In PyDev PYTHONPATH, you have to set your source folders (where your sources are within the project) and the external source folders (folders that are not within your eclipse environment).



3.Also in the project properties, you have to choose the project references, so that your current projects gets those projects configurations in the PYTHONPATH.





Return to top  


How do I configure Pydev to use JYTHON?


Well, Jython configuration is pretty much the same configuration used for Python. The main difference is that ALL additional jars you configure in a project must also be on your global PYTHONPATH. This is because of a bug that makes Jython unable to get class definitions just defined in the sys.path and not in the classpath (you may have problems with code-completion if you don't do that).

This has already been reported as a Jython bug, and if you want more information on it, you can check at the following mailing thread: mail thread

Return to top  


How do I reference Java projects with Jython?


Actually, Java projects cannot be directly referenced. You have to add the pydev nature to the java project and add your java output class folders to the project source folders, and only then add it as a project reference.

(to add the nature to a project, you have to open a python file within it with pydev).

Check the question: "How do I configure my PYTHONPATH?" for information on how to add source folders to the project pythonpath.

Return to top  


When I do a code-completion, Pydev hangs, what can I do?


Pydev does most of its things in the java side, but some information can only be gotten from the python side (mainly builtins), so, in order to get that info, pydev creates a shell and communicates with it through sockets. It depends upon the "Timeout to connect to shell" in the code-completion preferences (window > preferences > Pydev > Code completion) The first thing to try is to raise that timeout if it does not connect in the first attempt. If that does not help, the problem might be a firewall that is blocking the communication between pydev and the shell. If that is still not the problem, please report a bug (also, check if there is anything on the error log (window > show view > PDE Runtime > Error log) and on the eclipse '.log', which is located at the .metadata folder of the workspace location. Note: versions before 0.9.8.6 did have a lock condition problem that happened in a few installations

Return to top  


I have a library installed and Pydev does not find it


Well, problems have been reported on Mac and Linux, and the main reason seems to be symlinks. Pydev will only find extensions that are 'really' below the python install directory. This happens because the 'less common denominator', which in this case is windows, does not have symlinks. A workaround to this problem includes manually adding the given folder installation to the pythonpath or changing the installation of the package to be under the site-packages folder.

Return to top  


What is that 'Forced builtin libs' in the Python Interpreters preferences?


Well, some libraries once installed do not really show in code completion because they do not have a corresponding module (such as __builtin__ and datetime) or they do have a corresponding module but it cannot be really used in code completion because most of its information is only gotten at runtime (such as sys and os), so, in order for code completion to get its information, you have to manually add it to those libs (and by doing so, its information is gotten with a python shell).

Return to top  


How do I configure a python shell for experimenting with Python?


Well, for that, you have to configure an external tool. Go to the menu->Run->External Tools and configure the location, working dir and don't forget to put the -i argument so that you enter in interactive mode!

The picture below shows what I mean...



Now, the only thing missing is running it! And don't forget to add a keybinding to rerun the last executed external tool, so that you don't have to go through the menu every time!

Return to top  


The PyDev builder is taking too much of my time, what can I do about it?


Well, if you have PyLint active, you can disable it, as it is the process that takes most time when building.
Another alternative is disabling the builder altoghether. To do it you can go to window->preferences->pydev->builder and disable it.
NOTE: Disabling the builders may have many side-effects, such as code completion not working, pylint, tasks, etc. So, if you really want it, you can disable it, but do it with care.

Return to top  


Why the PyDev properties do not show?


Probably you are in the JAVA package explorer or something similar. You have to use the default navigator so that it shows its properties.
Also note that you have to open a python file with PyDev in the project before it appears in the properties too (the project python nature appears only after you do that).

Return to top  


I can see no new Python project, how am I supposed to use PyDev?


Well, you basically have to do a simple project and use create simple file / folder to create python modules.

You may also have to associate the *.py with the PyDev editor (even though that is probably automatic).
Anyway, if you need it, go to window->preferences->workbench->file associations and associate *.py with PyDev.

p.s. Don't forget to put it into both of your PYTHONPATHs (enviroment and in the project properties).

Return to top  


How do I run a module from within eclipse using PyDev (either Python or Jython)?


To do that, the easiest way is going to the Run menu (Run->Run As->Python or Jython). If it is not available in your current eclipse perspective, you can enable it by going to window->customize perspective->commands and checking the "Lauch" item (in this way, you can go only with the keyboard).

Another way to run a module is right clicking the module in the navigator and choosing python->run (when a .py file is selected).

Return to top  


How do I know which is the command-line and PYTHONPATH used to make a python or jython run?


If you are in doubt what is actually being passed to the run, you can go to the run menu (Run > Run...) and on the given run (python or jython), click on 'See resulting command-line for the given parameters' and check the command-line, as well as the PYTHONPATH that will be used for the run.

Return to top  


Code completion is not working correctly for some library


Well, code completion works by default by analyzing the source code, but, sometimes, most information is only really available at runtime (the os module and wxPython are good examples here). So, you can specify that you want to treat those as builtin libraries. For that, go to the python interpreters and add it as a 'forced builtin lib'. More information may be found at the faq:

'What is that 'Forced builtin libs' in the Python Interpreters preferences?'

Return to top  


PyLint is not working, what should I do?


1. make sure that PyLint is correctly installed in your site-packages (try running it at least once on a command-line to make sure your installation is correct).

2. Check if your project and your pythonpath are correctly configured -- pylint is only passed in files in the pythonpath for a project, so if any of those are not well configured, pylint won't work correctly.

3. If your installation is all ok, try reading the Pylint provided page to see if it is corretly configured in the eclipse side.

4. If everything fails, you can ask in the forum or submit a bug report for it (don't forget to add the following information: pylint installation path, pylint version and the other information requested on the 'How do I Report a BUG?' faq.

Return to top  


I have a CORBA program and I cannot debug its methods, what can I do?


Thanks for Petru Lauric for the following explanation: The ORB I use (omniORB) creates its own worker threads inside the python world, whenever a python function is called via CORBA. These threads are not created by using the 'threading' module so the pydev debugger's trace function is not automatically set for the ORB worker threads. The solution is to explicitly set the trace function for the ORB threads. 1) Open folder [eclipse sdk path]\plugins\org.python.pydev.debug_0.9.8.4\pysrc(or similar) 2) Remove file pydevd.pyc, make a backup copy of file pydevd.py and make this change to the PyDB::run() method from file pydevd.py: ... if globals is None: ... globals = m.__dict__ # # Hack: keep a reference to the pydev debugger's # trace function in a global variable. This can # be used by the debugged script to set up the # trace function for the ORB worker threads. # globals['pydev_hook'] = self.trace_dispatch # ... 3) Make changes similar to those below to your python app. Note 1: the "pydev_hook" global variable will *only* exist in the global namespace of the "main" module of your app (the script launched by pydev when you debug your app). Feel free to pass it as an argument to functions from other modules, if that's where you need to use it. Note 2: the trace function for the ORB worker threads MUST be set before the ORB creates the first worker thread. a) import this undocumented ORB function from omniORB import addWThreadHook b)add this function def dbg_trace(flag=0, wt=None): """This function is called whenever the ORB creates a worker thread (i.e. when a client calls a CORBA interface of the engine). The ORB worker threads are not created with the functions from the 'threading' module so, if we want to debug them with pydev, we need to "manually" set the trace function for them.""" if flag == 0: # WTHREAD_CREATED sys.settrace(pydev_trace_func) c) finally, make these changes try: # check if pydev_hook is defined hook = pydev_hook except: hook = None if hook is not None: # keep a copy of the pydev_hook in a global # variable, so that dbg_trace() can find it later # on global pydev_trace_func pydev_trace_func = pydev_hook # NOTE: the ORB will call dbg_trace each time it # creates a worker thread. The function below # MUST be used *before* the ORB creates the first # worker thread. addWThreadHook(dbg_trace) I hope this helps. Regards, Petru Lauric

Return to top  


OK, I know that many features are available, but I just don't know how can I access them through my keyboard!!


Keybindings from Pydev
Code Completion Ctrl+Space
Template Completion Ctrl+Space
Content Assistant Ctrl+1
Navigate Up Ctrl+Shift+Up
Navigate Down Ctrl+Shift+Down
Comment Ctrl+3
UnComment Ctrl+Shift+3
Make block comment Ctrl+4
Go To Definition F3
Collapse All Ctrl+9
UnCollapse All Ctrl+0
Format Code Ctrl+Shift+F
Sort imports alphabetically (or selection) Ctrl+Shift+O
Refactor: Rename Shift+Alt+R
Refactor:Extract Local Variable Shift+Alt+L
Refactor:Extract Method Shift+Alt+M
Refactor:Inline Local Variable Shift+Alt+I
Some useful Eclipse provided keybindings
Run last lauch Ctrl+F11 (see how to customize perspective)
Debug last lauch F11 (see how to customize perspective)
Simple text completion Alt+/


Many of them can be customized in the Keybindings menu (window->preferences->workbench->keys).

Return to top