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

subprocess problem

2017-02-08 Thread Andreas Paeffgen
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', 'PanConvert') path_pandoc = settings.value

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

Subprocess Problem (Wait and while)

2010-08-09 Thread Alban Nona
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 copy some files into local directory, lik

Re: socket and subprocess problem

2008-12-18 Thread James Mills
On Thu, Dec 18, 2008 at 8:00 PM, Bryan Olson wrote: > I'd swear James copied my response, except his came first. Even the > formatting came out similar. I hadn't seen his response when I wrote mine, > and wouldn't have bothered posing the same thing again. Great minds think alike huh :) You shoul

Re: socket and subprocess problem

2008-12-18 Thread Bryan Olson
James Mills wrote: subprocess process: #1. When my subprocess process has successfully started notify the parent. #2. When my subprocess process has successfully created a listening socket, notify the parent. parent process: #1. When our subprocess process has successfully

Re: socket and subprocess problem

2008-12-15 Thread Bryan Olson
goat...@gmail.com wrote: Guys thanks to point it out. Yes, it's a race problem. I tried sleep long enough, then I can connect to the socket. I should add code to try to connect to the socket for a given time out. As Roy noted, that's "the cheesy way". Are the kind of programmers who accept che

Re: socket and subprocess problem

2008-12-15 Thread James Mills
On Tue, Dec 16, 2008 at 3:30 PM, wrote: > Guys thanks to point it out. > Yes, it's a race problem. I tried sleep long enough, then I can > connect to the socket. I should add code to try to connect to the > socket for a given time out. This is where event-driven approaches become really useful :

Re: socket and subprocess problem

2008-12-15 Thread goatold
Guys thanks to point it out. Yes, it's a race problem. I tried sleep long enough, then I can connect to the socket. I should add code to try to connect to the socket for a given time out. Roy Smith wrote: > In article > <6d3291c3-4e12-4bdd-884a-21f15f38d...@a12g2000pro.googlegroups.com>, > goat..

Re: socket and subprocess problem

2008-12-15 Thread Roy Smith
In article <6d3291c3-4e12-4bdd-884a-21f15f38d...@a12g2000pro.googlegroups.com>, goat...@gmail.com wrote: > In my python code I use subprocess.Popen to run and external program > who will listen to a TCP port. And I also create a socket to connect > to the TCP port that the external program is li

Re: socket and subprocess problem

2008-12-15 Thread Bryan Olson
goat...@gmail.com wrote: In my python code I use subprocess.Popen to run and external program who will listen to a TCP port. And I also create a socket to connect to the TCP port that the external program is listening. I will get 'Connection refused, errno=111' when I try to socket.connect ().

socket and subprocess problem

2008-12-15 Thread goatold
Hi all, Here is my problem, see if any one else met this before In my python code I use subprocess.Popen to run and external program who will listen to a TCP port. And I also create a socket to connect to the TCP port that the external program is listening. I will get 'Connection refused, errno=11

Subprocess problem on multiple OS's

2008-10-10 Thread Amanda Jamin
Subprocess issues with platform independence Postby ajamin on Wed Oct 08, 2008 10:46 am I am writing a python script that will act as a wrapper for another program. The python script will provide the inputs for this program and will verify that the output is correct. The application runs on multip

Re: python 2.5 scripting in vim on windows: subprocess problem

2007-10-24 Thread Dmitry Teslenko
On 22/10/2007, Andy Kittner <[EMAIL PROTECTED]> wrote: > >> Are you running this on vim or gvim? If you are running on gvim, my > >> guess is that the handles that you are passing are not valid. In > >> either case, try creating explicit handles that are valid (such as for > >> /dev/null) and creat

Re: python 2.5 scripting in vim on windows: subprocess problem

2007-10-22 Thread MVP
Hi! VIM can, also, to be OLE-COM-server. Try with: from win32com.client.dynamic import Dispatch vim = Dispatch('Vim.Application') (+google) @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

python 2.5 scripting in vim on windows: subprocess problem

2007-10-22 Thread Dmitry Teslenko
Hello! I'm using subprocess.Popen in python script in vim. It called this way: def some_func(): p = subprocess.Popen( command , stdout = subprocess.PIPE, stderr = subprocess.STDOUT) while True: s = p.stdout.readline()

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

subprocess problem on WinXP

2006-07-26 Thread Wolfgang
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 subprocess dir="g:\\messtech" for r

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

subprocess problem in cygwin with Tkinter

2006-01-04 Thread Stewart Midwinter
this has me puzzled; I've created a small test app to show the problem I'm having. I want to use subprocess to execute system commands from inside a Tkinter app running under Cygwin. When I open a python interpreter and run my subprocess command, all is well. But when I run the same command from

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) : >

subprocess problem

2005-09-27 Thread Do Re Mi chel La Si Do
Hi! This script (under Win-XP + P-2.4.1) : import subprocess p1=subprocess.Popen(r'cmd /cdir *.* /S /W /B', stdout=subprocess.PIPE) chaineretour=p1.stdout.read() run OK if called from DOS-console. But, from another Python's script (by COM + exec) give me an error. Here, the traceb

subprocess problem on Windows in IDLE and PythonWin

2005-02-15 Thread David S.
Python 2.4 on Windows XP In the python command-line the following works fine: >>> from subprocess import * >>> p = Popen('dir', stdout=PIPE) >From within IDLE or PythonWin I get the following exception: Traceback (most recent call last): File "", line 1, in -toplevel- p = Popen('dir', stdo