Python subprocess/Popen with a modified environment

前端 未结 8 795
再見小時候
再見小時候 2020-11-22 14:06

I believe that running an external command with a slightly modified environment is a very common case. That\'s how I tend to do it:

import subprocess, os
my_         


        
8条回答
  •  猫巷女王i
    2020-11-22 14:47

    I know this has been answered for some time, but there are some points that some may want to know about using PYTHONPATH instead of PATH in their environment variable. I have outlined an explanation of running python scripts with cronjobs that deals with the modified environment in a different way (found here). Thought it would be of some good for those who, like me, needed just a bit more than this answer provided.

提交回复
热议问题