Reputation: 5157
I am developing a GUI application using Kivy that in turn it will call an external console program from Python script using subprocess.Popen
and capture its stderr
output live. Finally, it works (thanks to SO for this!). I package the application using Pyinstaller, in which it produce an *.app that contains the executable resided in Contents\MacOS
. If I run this executable directly from within Terminal, it runs well. The stderr output can be capture live. But, if I try to run the *.app directly either using open
command from Terminal or double click its *.app icon from Finder, the call to subprocess.Popen
simply halt.
I am not sure about this, but is there any restriction on an OSX app about how it can execute external program?
Upvotes: 0
Views: 860
Reputation: 5157
The cause of the application halt turns out to be not the subprocess.Popen
call, but the call of mktemp
that creates a temporary file inside of *.app folder
, where a Mac app is definitely not permitted to write by default. After commenting this out, the code runs just fine. I'll make note of this and remind myself not to create temp file inside *.app
folder again!
Upvotes: 1