I have the following post-build step in a VC++ 2005 project that calls a Python 2.5.1 script:
postbuild.py
postbuild.py does:
import os
os.system('cd') # cd is just a test, could be anything
The process never starts, and it's the same with any other process I try, even using subprocess.call or Popen instead of os.system.
Does anyone know about anything related to problems like this in Python 2.5.1 or in build events in Visual C++ 2005 SP1?
-
Be aware that the post build event will only run immediately after a completed build. If the project had already been built (and so does not need building again), then the post build step will not run at all.
If you're editing the python script and then trying to get it to run by building the project, then it's not going to do anything unless you edit a file within the project each time, to force the build to occur.
-
Solved. For some reason, using "postbuild.py" as postbuild step inhibits the python script from spawning other processes, where "python.exe postbuild.py" has no problems, and neither "pythonw.exe postbuild.py". I'm not sure why this happens, as all three methods are valid when used from cmd.exe.
But I would like to know if anyone has an explanation for this.
Paul Du Bois : Just Friday I ran into an extremely similar problem. To diagnose it, in my version of "postbuild.py", os.getenv("PATH") looked reasonable, but subprocess.Popen("cmd /c echo %PATH%") reported an almost-completely-empty %PATH%. All it contained was c:\python26\. I eventually tracked it down to a registry key, something like HKEY_LOCAL_MACHINE/Software/Microsoft/Windows/App Paths. The ActiveState installer had added c:\Python26\; it should have prepended that entry to the environment of postbuild.py itself, but instead it overwrote the PATH of anything _spawned by_ postbuild.pyPaul Du Bois : By "it should have prepended" I mean "as a result of that key, MS Windows should have prepended..."
0 comments:
Post a Comment