开发者

Calling python script from batch file opens second console

I have a batch file that runs a python script. When the python script is invoked, it starts a second windows console and then disappears when it is completed. This is a problem because I am editing the PYTHONPATH environment variable in the batch file, but because the python script is running in a second window, it cannot see the edited PYTHONPATH environment variable. It used to work just fine (everything would run in the same windows console). I just installed V开发者_运维技巧ista SP2 and this problem showed up. Any thoughts on how to fix what might be broken?

Thanks.


Have you tried changing the extension of the python script to .pyw, or just invoke it with pythonw.exe?


It could be that the .py filetype is associated to pythonw.exe, therefore causing it to open in a new process. Find any .py file, right click it, select properties, and check to see under "Opens with:" what the default interpreter is.


Ok, so I decided to reinstall python. If I uninstall and reinstall (I was using the windows installer) in the default location, it seems to have no effect. I cleaned out the registry and reinstalled. Still no different. However, if I install python in a different location (other than the default) it seems to run fine. Something is obviously corrupt somewhere, but I don't know where. So I am going to just reinstall all of my other modules in a different location and go from there.

Thank you all for your responses.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜