Re: subprocess problem

2017-02-15 Thread Andreas Paeffgen
On 2017-02-11 02:23:12 +, Cameron Simpson said: 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

Re: subprocess problem

2017-02-10 Thread Cameron Simpson
On 10Feb2017 11:54, Andreas Paeffgen 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.

Re: subprocess problem

2017-02-10 Thread Andreas Paeffgen
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 sh

Re: subprocess problem

2017-02-09 Thread Cameron Simpson
On 10Feb2017 00:03, eryk sun wrote: On Thu, Feb 9, 2017 at 10:50 PM, Cameron Simpson wrote: This is why I suggested the check_returncode() method, which examines the error code. You must be thinking of the returncode attribute, which isn't a method. check_returncode() is a method of the Comp

Re: subprocess problem

2017-02-09 Thread eryk sun
On Fri, Feb 10, 2017 at 12:05 AM, Wildman via Python-list wrote: > > Corrected code: > > def which(target) > for p in pathlist: > fullpath = p + "/" + target > if os.path.isfile(fullpath) and os.access(fullpath, os.X_OK): > return fullpath, True > return None, F

Re: subprocess problem

2017-02-09 Thread MRAB
On 2017-02-10 00:05, Wildman via Python-list wrote: On Fri, 10 Feb 2017 09:53:32 +1100, Cameron Simpson wrote: On 09Feb2017 11:59, Wildman wrote: Here is a method I frequently use to replace the which command. (air code) import os pathlist = os.environ["PATH"].split(":") def which(target)

Re: subprocess problem

2017-02-09 Thread Wildman via Python-list
On Fri, 10 Feb 2017 09:53:32 +1100, Cameron Simpson wrote: > On 09Feb2017 11:59, Wildman wrote: >>Here is a method I frequently use to replace the which >>command. (air code) >> >>import os >>pathlist = os.environ["PATH"].split(":") >> >>def which(target) >>for p in pathlist: >>fullpa

Re: subprocess problem

2017-02-09 Thread eryk sun
On Thu, Feb 9, 2017 at 10:50 PM, Cameron Simpson wrote: > This is why I suggested the check_returncode() method, which examines the > error code. You must be thinking of the returncode attribute, which isn't a method. check_returncode() is a method of the CompletedProcess object that's returned b

Re: subprocess problem

2017-02-09 Thread Cameron Simpson
On 09Feb2017 11:59, Wildman wrote: Here is a method I frequently use to replace the which command. (air code) import os pathlist = os.environ["PATH"].split(":") def which(target) for p in pathlist: fullpath = p + "/" + target if os.path.isfile(fullpath): return full

Re: subprocess problem

2017-02-09 Thread Cameron Simpson
On 09Feb2017 11:16, Andreas Paeffgen wrote: I guess which does not return an error code. If it does not find anything, the return is just blank. If it finds something, the path is returned. So the change of code did not help, because there is just no error message. Could there be a $path prob

Re: subprocess problem

2017-02-09 Thread Günther Dietrich
Am 09.02.17 um 18:16 schrieb Andreas Paeffgen: > I guess which does not return an error code. In fact, id does return a return code. Here an example: | honk:~ gdie$ which bash; echo $? | /bin/bash | 0 | honk:~ gdie$ which wzlbrmpf; echo $? | 1 It is 0 on success, 1 for a failure. Exactly the res

Re: subprocess problem

2017-02-09 Thread Wildman via Python-list
On Thu, 09 Feb 2017 11:16:18 -0600, Andreas Paeffgen wrote: > I guess which does not return an error code. If it does not find > anything, the return is just blank. If it finds something, the path is > returned. > > So the change of code did not help, because there is just no error message. > C

Re: subprocess problem

2017-02-09 Thread Andreas Paeffgen
I guess which does not return an error code. If it does not find anything, the return is just blank. If it finds something, the path is returned. So the change of code did not help, because there is just no error message. Could there be a $path problem in the subprocess started inside the binar

Re: subprocess problem

2017-02-09 Thread Andreas Paeffgen
Maybe i could use another trick to circumvent the problems in the frozen app? The frozen apps can be downloaded here: https://sourceforge.net/projects/panconvert/files/Newest/ @Cameron: 1. I use PyQT5 for a creating a gui app. To run the app on other systems, where no QT5 and PyQT5 is install

Re: subprocess problem

2017-02-09 Thread Wolfgang Maier
On 09.02.2017 01:56, Andreas Paeffgen wrote: The Problem with the subprocess code is: Using the sourcecode functioning as normal. The frozen app with cx_freeze on every platform just returns an empty result Here is the code in short: def get_path_pandoc(): settings = QSettings('Pandoc', '

Re: subprocess problem

2017-02-09 Thread Wolfgang Maier
On 09.02.2017 01:56, Andreas Paeffgen wrote: The Problem with the subprocess code is: Using the sourcecode functioning as normal. The frozen app with cx_freeze on every platform just returns an empty result Here is the code in short: def get_path_pandoc(): settings = QSettings('Pandoc', '

Re: subprocess problem

2017-02-08 Thread Cameron Simpson
On 08Feb2017 18:56, Andreas Paeffgen wrote: The Problem with the subprocess code is: Using the sourcecode functioning as normal. The frozen app with cx_freeze on every platform just returns an empty result I don't know what the sentence above above cx_freeze means. Here is the code in short

Re: Subprocess Problem (Wait and while)

2010-08-10 Thread Tim Golden
On 09/08/2010 17:08, Alban Nona wrote: Hi, I have some problem with my actual code. In fact, the script is done to work within nuke from the foundry which is a compositing software. Homever, I have some code difficulties as I quite new in the area. Here the deal: Im using subprocess command to

Re: subprocess problem on WinXP

2006-07-26 Thread Wolfgang
Simon Forman schrieb: > Wolfgang wrote: >> Hi Simon, >> >> I did not know that library! I'm still new to python and I still have >> problems to find the right commands. > > Welcome. : ) Python comes with "batteries included". I'm always > finding cool new modules myself, and I've been using it f

Re: subprocess problem on WinXP

2006-07-26 Thread Simon Forman
Wolfgang wrote: > Hi Simon, > > I did not know that library! I'm still new to python and I still have > problems to find the right commands. Welcome. : ) Python comes with "batteries included". I'm always finding cool new modules myself, and I've been using it for years. In fact, I didn't notice

Re: subprocess problem on WinXP

2006-07-26 Thread Wolfgang
Hi Simon, I did not know that library! I'm still new to python and I still have problems to find the right commands. But I suppose this library is mainly for partially compressing/decompressing of files. How can I use that library to compress/decompress full files without reading them into mem

Re: subprocess problem on WinXP

2006-07-26 Thread Simon Forman
Wolfgang wrote: > Hi, > > I want to compress all files (also in subfolder). The code is working > more or less, but I get a black popup window (command line window) for > every file to compress. How do I cave to change my system call that > nothing pops up? > > Wolfgang > > import os > import subpr

Re: subprocess problem in cygwin with Tkinter

2006-01-05 Thread [EMAIL PROTECTED]
that's it! Thanks, that sorted me out. The readme at the following location was very helpful: http://www.tishler.net/jason/software/rebase/rebase-2.2.README I couldn't get rebaseall to work until I installed all of the packages mentioned in the readme. Now I have a different problem, regarding

Re: subprocess problem in cygwin with Tkinter

2006-01-05 Thread AdSR
Stewart Midwinter wrote: > [...] > I'm using this version of Cygwin: > $ uname -a > CYGWIN_NT-5.1 Mulata 1.5.18(0.132/4/2) 2005-07-02 20:30 i686 unknown unknown > Cyg > win > [...] > When I run the same command in a Tkinter app, I get an exception: > > [EMAIL PROTECTED] /cygdrive/c/programs/pipewo

Re: subprocess problem

2005-09-29 Thread Do Re Mi chel La Si Do
Hi ! Thank you very much. With your tip, this script : import os p = os.popen4(r'cmd /k') p[0].write('dir *.bat /B\r\n') p[0].flush() p[0].write('dir *.cfg \r\n') p[0].flush() p[0].write('exit\r\n') p[0].flush() print ''.joi

Re: subprocess problem

2005-09-27 Thread Uri Nix
Hi, I had a similar problem recently, and found that using pipes with os.popen* helped in my case. You can check the thread at: http://mail.python.org/pipermail/python-list/2005-September/300744.html. Cheers, Uri Do Re Mi chel La Si Do wrote: > Hi! > > This script (under Win-XP + P-2.4.1) : >