Re: Problem with subprocess module on Windows with open file in append mode

2009-10-06 Thread Gabriel Genellina
En Tue, 06 Oct 2009 11:24:23 -0300, MRAB escribió: Gabriel Genellina wrote: En Sat, 03 Oct 2009 21:53:12 -0300, Andrew Savige escribió: When I run this little test program on Linux: import subprocess subprocess.call(["python","-V"], stderr=open("log.tmp","a")) the file log.tmp is appe

Re: Problem with subprocess module on Windows with open file in append mode

2009-10-06 Thread MRAB
Gabriel Genellina wrote: En Sat, 03 Oct 2009 21:53:12 -0300, Andrew Savige escribió: When I run this little test program on Linux: import subprocess subprocess.call(["python","-V"], stderr=open("log.tmp","a")) the file log.tmp is appended to each time I run it. When I run it on Windows, how

Re: Problem with subprocess module on Windows with open file in append mode

2009-10-05 Thread Gabriel Genellina
En Sat, 03 Oct 2009 21:53:12 -0300, Andrew Savige escribió: When I run this little test program on Linux: import subprocess subprocess.call(["python","-V"], stderr=open("log.tmp","a")) the file log.tmp is appended to each time I run it. When I run it on Windows, however, the file log.tmp ge

Problem with subprocess module on Windows with open file in append mode

2009-10-03 Thread Andrew Savige
When I run this little test program on Linux: import subprocess subprocess.call(["python","-V"], stderr=open("log.tmp","a")) the file log.tmp is appended to each time I run it. When I run it on Windows, however, the file log.tmp gets overwritten each time I run it. Though I can make it append on

Re: problem with subprocess

2009-07-10 Thread Christian Heimes
gabrielmonnerat wrote: >> I am using subprocess because I need store the pid. Any suggestions? > Sorry, I was forgot the parameter shell=True. > i.e > In [20]: subprocess.call('DISPLAY=:99 > /opt/ooo-dev3/program/soffice.bin',shell=True) You should avoid using the shell=True parameter. It may resu

Re: problem with subprocess

2009-07-10 Thread gabrielmonnerat
gabrielmonnerat wrote: Hi all, I need start a openoffice in Xvfb, but when I call with the DISPLAY occurs this error: [r...@localhost oood]# Xvfb :99 -screen 0 1024x768x24 & In [9]: subprocess.call('/opt/ooo-dev3/program/soffice.bin') Out[9]: 0 In [10]: subprocess.call('DISPLAY=:99 /opt/ooo

problem with subprocess

2009-07-10 Thread gabrielmonnerat
Hi all, I need start a openoffice in Xvfb, but when I call with the DISPLAY occurs this error: [r...@localhost oood]# Xvfb :99 -screen 0 1024x768x24 & In [9]: subprocess.call('/opt/ooo-dev3/program/soffice.bin') Out[9]: 0 In [10]: subprocess.call('DISPLAY=:99 /opt/ooo-dev3/program/soffice.bi

Re: A problem with subprocess

2009-03-20 Thread Tim Golden
Colin J. Williams wrote: Below is a test script: # tSubProcess.py import subprocess import sys try: v= subprocess.Popen('ftype py=C:\Python25\Python.exe') except WindowsError: print(sys.exc_info()) I'm assuming that you've previously done something like this: assoc .py=py and are now t

Re: A problem with subprocess

2009-03-20 Thread Albert Hopkins
On Fri, 2009-03-20 at 22:14 -0400, Colin J. Williams wrote: > Below is a test script: > > # tSubProcess.py > > import subprocess > import sys > try: >v= subprocess.Popen('ftype > py=C:\Python25\Python.exe') > except WindowsError: >print(sys.exc_info()) > > Here is the output: > > *** P

A problem with subprocess

2009-03-20 Thread Colin J. Williams
Below is a test script: # tSubProcess.py import subprocess import sys try: v= subprocess.Popen('ftype py=C:\Python25\Python.exe') except WindowsError: print(sys.exc_info()) Here is the output: *** Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32. **

Problem with subprocess and mkstemp

2008-05-28 Thread Hans Larsen
Hello, I'm having this script here: import sys, tempfile, subprocess if len(sys.argv) > 1: i = 0 while i < 1000: print "Hello World" * 500 i = i + 1 exit( 1 ) h,fp = tempfile.mkstemp() print "out: " + fp out = open(fp, "r") proc = subp

Re: Problem with subprocess in threaded enviroment

2008-03-13 Thread dripton
On Mar 12, 12:58 pm, Ningyu Shi <[EMAIL PROTECTED]> wrote: > I'm trying to write a multi-task downloader to download files from a > website using multi-threading. I have one thread to analyze the > webpage, get the addresses of the files to be downloaded and put these > in a Queue. Then the main th

Problem with subprocess in threaded enviroment

2008-03-12 Thread Ningyu Shi
I'm trying to write a multi-task downloader to download files from a website using multi-threading. I have one thread to analyze the webpage, get the addresses of the files to be downloaded and put these in a Queue. Then the main thread will start some threads to get the address from the queue and

Re: Python wrapper, problem with subprocess read/write

2007-09-10 Thread A.T.Hofkamp
On 2007-09-07, NeoGregorian <[EMAIL PROTECTED]> wrote: > I tried instead to use: > > lines = [] > line = proc.stdout.readline() > while line : > lines.append(line) > line = proc.stdout.readline() > > This prints out everything except the ">" line, which is good. But > then freezes while wai

Python wrapper, problem with subprocess read/write

2007-09-07 Thread NeoGregorian
Hello, I am writing a wrapper to a basic Input/Output programs (where you type a one line command at a time and then get 0 or more lines of output before you can input the next command). I'm sorry if this problem description is a bit long, but I wanted to make the problem clear. Example run of th

Re: SOLUTION Help needed: file writing problem with subprocess

2005-12-05 Thread Pekka Niiranen
Fredrik Lundh wrote: > Pekka Niiranen wrote: > > >>I am running Python script in W2K or in WinXP. >>The script is started from DOS prompt and writes text file to disk >>with codecs.open() in UTF8. >> >>The problem is: When script writes the file and tries to read it >>with by calling itself thru

Re: SOLVED: Help needed: file writing problem with subprocess

2005-12-05 Thread pekka niiranen
Fredrik Lundh wrote: > Pekka Niiranen wrote: > > >>I am running Python script in W2K or in WinXP. >>The script is started from DOS prompt and writes text file to disk >>with codecs.open() in UTF8. >> >>The problem is: When script writes the file and tries to read it >>with by calling itself thru

Re: Help needed: file writing problem with subprocess

2005-12-05 Thread Fredrik Lundh
Pekka Niiranen wrote: > I am running Python script in W2K or in WinXP. > The script is started from DOS prompt and writes text file to disk > with codecs.open() in UTF8. > > The problem is: When script writes the file and tries to read it > with by calling itself thru subprocess() the created file

Help needed: file writing problem with subprocess

2005-12-04 Thread Pekka Niiranen
Hi, I am running Python script in W2K or in WinXP. The script is started from DOS prompt and writes text file to disk with codecs.open() in UTF8. The problem is: When script writes the file and tries to read it with by calling itself thru subprocess() the created files are NOT accessible because