Newbie question (I'm just getting started with Python and Pydev):
I've created a project "Playground" with (standard?) src/root sub-folder. In there I've created example.py.
How do I import my "example" module into Pydev's interactive console? ">>> import example" gives: "ImportError: No module named example"
pydev* from eclipse/plugins and eclipse/features or you can go to help > software updates > manage configuration, choose the PyDev plugin and disable it (after that, to completely remove it, you must restart Eclipse and only then select it for uninstall).
You need to set your PYTHONPATH accordingly (Google search is your friend) or use *.pth in your installation site-packages directory pointing to your project path. Don't forget to set your interpreter details with Pydev (Window->Preferences->Pydev->interpreter).
I found the answer on the Plone website: Setting up PYTHONPATH in Eclipse project. This provides a convenient way to set PYTHONPATH on a per project basis. In my case I added "/Playground/src/root" to the Source Folders list. ">>> import example" then worked. (I'm still surprised project files aren't imported by default, though.)
Thank you jldupont for pointing me in the right direction (re. PYTHONPATH)!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With