I have a pydev project going in aptana studio 3.
In the image below, you can see my project structure and the fact that my nosetests are all passing.
If I click on a file scheduled.py
that has a breakpoint in it, and hit debug as
> python run
it fails to be able to import my modules.
pydev debugger: starting
Traceback (most recent call last):
File "C:\Users\mapserv\AppData\Local\Aptana Studio 3\plugins\org.python.pydev_2.7.0.2012110722\pysrc\pydevd.py", line 1397, in <module>
debugger.run(setup['file'], None, None)
File "C:\Users\mapserv\AppData\Local\Aptana Studio 3\plugins\org.python.pydev_2.7.0.2012110722\pysrc\pydevd.py", line 1090, in run
pydev_imports.execfile(file, globals, locals) #execute the script
File "C:\Users\mapserv\Desktop\Projects\Aptana\AutomatedCaching\agrc\caching\scheduled.py", line 1, in <module>
from agrc.caching.commands import cache
ImportError: No module named agrc.caching.commands
I've noticed that aptana has the notion of packages/modules. Is there something wrong with my project structure that is causing this? Should my folders be packages? Do I need to setup more things with my interpreter which looks like?
Edited
If I try to run scheduled.py from the command line it has the same problem. How is nose running my tests and making everything happy yet it doesn't work outside of that?
Well the answer was to update your PYTHONPATH. On windows, put the path to the AutomatedCaching folder inside the automated_caching.pth file.
eg: C:\Projects\AutomatedCaching
Then move the file into your site packages folder. For arcgis users it will be something like
C:\Python27\ArcGISx6410.1\Lib\site-packages
or
C:\Python27\ArcGIS10.1\Lib\site-packages
depending if you installed server and desktop. I'm thinking the last install wins the PATH
war? I installed server then desktop and it uses the second in the path without the x64.
running
import sys
for i in sys.path:
print i
should verify that your location has been added.
Now the fact that arcgis for server and desktop install two different pythons into c:\python27
is a whole different story.
Now aptana shows my package explorer like it is a package