The problem I am facing is that Eclipse / PyCharm interprets the results of the Popen () subprocess differently than the standard terminal. Everyone uses python2.6.1 on OSX.
Here is a simple script example:
import subprocess args = ["/usr/bin/which", "git"] print "Will execute %s" % " ".join(args) try: p = subprocess.Popen(["/usr/bin/which", "git"], shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
With a standard terminal string:
ret = p.communicate()
gives me:
(Pdb) print ret ('/usr/local/bin/git\n', '')
Eclipse and PyCharm give me an empty tuple:
ret = {tuple} ('','')
Changing the value of shell = value also does not solve the problem. On the terminal, set shell = True and completely pass the command (ie Args = ["/ usr / bin / which git"]) gives me the same result: ret = ('/ usr / local / bin / git \ n' , ''). And Eclipse / PyCharm give me an empty tuple.
Any ideas on what I might be doing wrong?
python eclipse subprocess popen pycharm
cybertoast
source share