Home Download Buy Blog Forum Support

Mac, subprocess.Popen and "Command not found"

Mac, subprocess.Popen and "Command not found"

Postby emartel on Sat Feb 25, 2012 10:40 pm

Hi,

I'm trying to help out a user of one of my plugin by finding out what I'm doing wrong on Mac to launch a 3rd party application.

First, I'm totally new to Mac, never seriously used one before the week end.

Basically I'm trying to call "p4 info". I've copied my exe to Applications/Utilities (not sure if that's a right place but seems to work). Edited my .bash_profile to have a PATH that points to it. which p4 returns me the right path to the executable. I chmod +x the executable... everything works fine from the Terminal.

Now, from Sublime Text 2, whenever I try to launch it using:

command = 'p4 info'
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=None, shell=True)
result, err = p.communicate()

My err will contain "/bin/sh: p4: command not found".

I'm not sure what I'm doing wrong here since it works well on Win32. Anyone has any pointer that could help me?

Thanks a lot!

Eric
emartel
 
Posts: 23
Joined: Thu Feb 23, 2012 8:59 pm
Location: Montreal, Canada

Re: Mac, subprocess.Popen and "Command not found"

Postby phillip.koebbe on Sun Feb 26, 2012 1:55 am

Hi Eric

I'm typing on a mobile keyboard, so my answer will be brief. Short answer is you probably need to source your .bash_profile so your path is configured properly. See this thread for a similar situation I recently encountered:

viewtopic.php?f=6&t=5345

Hopefully this will get you pointed in the right direction.

Phillip
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm

Re: Mac, subprocess.Popen and "Command not found"

Postby emartel on Sun Feb 26, 2012 3:19 am

Hi Philip!

Thank you for this reply, I don't know how I missed your initial thread :)

It works, thank you!

I don't like having to build different commands depending on the OS, but it will do for now!

Cheers

Eric
emartel
 
Posts: 23
Joined: Thu Feb 23, 2012 8:59 pm
Location: Montreal, Canada


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 21 guests