Sublime Forum

Mac, subprocess.Popen and "Command not found"

#1

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

0 Likes

#2

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:

Hopefully this will get you pointed in the right direction.

Phillip

0 Likes

#3

Hi Philip!

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

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

0 Likes