I import a customized module in the Startup Python Script?when I run it under the workbench ?it‘s all right. But when run it under the command line, it failed with python importerror ?No module named ...
Can any one tell me why?
Thanks
I import a customized module in the Startup Python Script?when I run it under the workbench ?it‘s all right. But when run it under the command line, it failed with python importerror ?No module named ...
Can any one tell me why?
Thanks
are you sure that the fme.exe called by the command line is the same as the one used inside the Workbench? Might you have more than one version of FME installed?
Try the following from the command line:
fme.exe python
>>> import your_module_here
What does it say?
David
Thanks for your advice, I installed FME server and desktop. The default EnvironmentVariable set server path variable before desktop's. I changed it and everything is ok!
Thanks a lot !
LarryDai
Tip: when using batch files, never rely on the PATH settings to find the executable, use a complete path reference to the executable, e.g.
c:\\apps\\fme\\fme.exe <parameters>
David
Another tip: module path searching can be also resolved in source code level. Add these lines before importing your module in the startup script.
-----
import sys
sys.path.append('your_module_directory_path')
import your_module_here
-----
FYI.
Takashi
David
Version management could be troublesome if adopting the approach.