Import and PYTHONPATH Problems with PyDev and Linux

Today is began to configure my PyDev Eclipse environment since I want to learn Python and need it for a programming aspect of my forthcoming diploma thesis. I ran into several difficulties getting the plugins run dialog to work. It seems that configuring the python interpreter under linux and adding all the correct include paths is not enough, even when following the PyDev FAQ.

Nearly giving up I came up with sort of a hack to get it running. Eclipse can execute arbitrary “External Tools” (Find it at: “Run -> External Tools -> Open External Tools Dioalog”). I used this facility to integrate an external tool “Python” with path “/usr/bin/python”. Now to automatically execute the currently active python script, you can specify the line: “${resource_loc}” in the arguments field of the dialog and you’re good to go.

You now circumvented the PyDev internal execution scheme and work with the pure command line interpreter. This way all the problems of PyDev with the PythonPath, Symlinks and whatever are gone.

Update: Another note maybe, you can also add the action “running the last used external tool again” as keyboard shortcut in the Eclipse preferences. This simplifies the execution even more.

More about: Python

Sign up for my newsletter to get notified when I post new content on this blog and with the occasional exclusive content only for subscribers.

By clicking on the Subscribe button I am giving my consent for Benjamin Eberlei to hold my name and email address for the purposes of contacting me with a newsletter on the topics of this blog. You can unsubscribe with one click at any time and withdraw your consent. No spam. I will never share your e-mail address. Privacy Policy