Launching python subprocess has different behavior depending on launcher

▼魔方 西西 提交于 2019-12-01 19:10:46

Regardless of whether PATH is correct, a simple test would be to change to a different arbitrary directory and do python.exe C:\full\path\to\main.py. If that reproduces the problem then you know it's some sort of path problem.

Check sys.path, I'll bet that's where the difference is. If that's the case, you probably need to alter the way you make your Python code and libraries are accessible from python.exe, either using the site module or using something else like zc.buildout/zc.recipe.egg's support for generating console_scripts with the correct sys.path baked in.

It appears from comments posted elsewhere that

"The working one is C:\Windows and the broken one is C:\Program Files\ArcGIS...\Bin."

Do a os.chdir to make it work.

[No idea what this really means, the comment was hard to parse.]

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!