subprocess problem
Cameron Simpson
cs at zip.com.au
Fri Feb 10 21:23:12 EST 2017
On 10Feb2017 11:54, Andreas Paeffgen <oegeeks at gmail.com> wrote:
>Thanks for all the great advice.
>I tested all the possibilities. So far no luck. If i start the app
>from a terminal, the solutions work. But not, if i start the
>app-bundle (There is no connection to a terminal)
>
>1. Copied the path to p.subprocess
>2. Used the def wich: python function
>3. Used shutil
>
>When there is no Terminal, there is no error message / status code message.
Please show us you code containing the status code check.
I would do some debugging inside the function. Consider writing to a special
purpose log file, for example like this:
def your_function(.......):
with open('/path/to/your/logfile.txt', 'a') as logfp:
print("PATH=".os.environ['PATH'], file=logfp)
p=Popen(.......)
p.communicate(...)
print("p.returncode=%r" % (p.returncode))
and any other interesting values that occur to you. This is really simple, and
doesn't require a terminal or using the logging module.
You can 'tail -f /path/to/your/logfile.txt' in another terminal to watch stuff
happen as you exercise the program.
Cheers,
Cameron Simpson <cs at zip.com.au>
More information about the Python-list
mailing list