Select to view content in your preferred language

outdated path for imported module ???

1188
3
08-24-2012 02:10 AM
JohannaTorppa
Deactivated User
I have a python script, running in ArcGIS, that evidently tries to import a module from an outdated location. I get an error message and Traceback info:

File "x://outdated_path/SDMmodule.py", line 25, in appendSDMValues ....etc

However, the module script SDMmodule.py is no more in that location, and I did not find a reason why it tries to find it from there. The module script SDM module.py is in the same directory as the main script, in a totally different location.
Tags (2)
0 Kudos
3 Replies
JakeSkinner
Esri Esteemed Contributor
Hi Johanna,

Python looks in the directories that are part of the module search path. These directories
are listed in the sys.path variable from the sys module.  To list where the Python looks for modules, print out the value of the sys.path variable. For example:

import sys
print sys.path


If the previous path of this module is located there, this could be the reason you are receiving this error.  You can remove the path by using sys.path.remove.
0 Kudos
JohannaTorppa
Deactivated User
Thanks Jake, sounds reasonable. I'll try that on monday.....



Hi Johanna,

Python looks in the directories that are part of the module search path. These directories
are listed in the sys.path variable from the sys module.  To list where the Python looks for modules, print out the value of the sys.path variable. For example:

import sys
print sys.path


If the previous path of this module is located there, this could be the reason you are receiving this error.  You can remove the path by using sys.path.remove.
0 Kudos
JohannaTorppa
Deactivated User
The system variable sys.path does not contain the outdated directory where the module is being searched from. And I have manually appended there the correct module directory. But still the same error occurs.

Johanna

Hi Johanna,

Python looks in the directories that are part of the module search path. These directories
are listed in the sys.path variable from the sys module.  To list where the Python looks for modules, print out the value of the sys.path variable. For example:

import sys
print sys.path


If the previous path of this module is located there, this could be the reason you are receiving this error.  You can remove the path by using sys.path.remove.
0 Kudos