Re: Process in not get killed using subprocess.call() in python thread

2017-07-13 Thread Rhodri James
On 13/07/17 16:42, sanky8...@gmail.com wrote: I have created one thread in python, and that thread is running in infinite loop, but when I was trying to kill a process by making use of subprocess.call("my ps command") Its not actually working Here is the code, import thread

Process in not get killed using subprocess.call() in python thread

2017-07-13 Thread sanky8793
I have created one thread in python, and that thread is running in infinite loop, but when I was trying to kill a process by making use of subprocess.call("my ps command") Its not actually working Here is the code, import threading import subprocess def B(): while True:

Re: subprocess.call with non-ASCII arguments?

2015-12-16 Thread Ulli Horlacher
Dennis Lee Bieber wrote: > >I want to create a zip file within a Python 2.7 program on windows. > > > >My code: > > > > cmd = ['7za.exe','a','-tzip',archive] + files > > status = subprocess.call(cmd) > > > My

Re: subprocess.call with non-ASCII arguments?

2015-12-15 Thread Ulli Horlacher
Dennis Lee Bieber wrote: > Python has a zipfile library that is portable between OS. Along with > libraries for gzip, bzip2, and tarfiles... Ohh.. this is new to me! https://docs.python.org/2/library/tarfile.html https://docs.python.org/2/library/zipfile.html What is missing in the doc

Re: subprocess.call with non-ASCII arguments?

2015-12-15 Thread Laura Creighton
In a message of Tue, 15 Dec 2015 14:25:50 +, Ulli Horlacher writes: >(My first posting seems to got lost) > >I want to create a zip file within a Python 2.7 program on windows. > >My code: > > cmd = ['7za.exe','a','-tzip',archive] +

Re: subprocess.call with non-ASCII arguments?

2015-12-15 Thread Ulli Horlacher
fileslist = archive + '.list' > flo = open(fileslist,'w') > for file in files: print(file,file=flo) > flo.close() > cmd = ['7za.exe','a','-tzip',archive,'@'+fileslist] > status = subprocess.call(cmd) > > >

subprocess.call with non-ASCII arguments?

2015-12-15 Thread Ulli Horlacher
(My first posting seems to got lost) I want to create a zip file within a Python 2.7 program on windows. My code: cmd = ['7za.exe','a','-tzip',archive] + files status = subprocess.call(cmd) leads to: File "fexit.py", line 971, in sendfile_retry

subprocess.call with non-ASCII arguments?

2015-12-15 Thread Ulli Horlacher
I want to create a zip file within a Python 2.7 program on windows. My code: cmd = ['7za.exe','a','-tzip',archive] + files status = subprocess.call(cmd) leads to: File "fexit.py", line 971, in sendfile_retry status = subprocess.call(cmd) Fi

Re: subprocess.call

2013-04-19 Thread Jens Thoms Toerring
Ombongi Moraa Fe wrote: > [-- text/plain, encoding 7bit, charset: ISO-8859-1, 19 lines --] > In my python script, I have this: > command="lynx -dump > 'phpscript?param1=%s¶m2=%s¶m3=%s¶m4=%s¶m5=%s'"%(value1,value2,value3,value4) > result=subprocess.call(comma

Re: subprocess.call

2013-04-19 Thread Mau C
Il 19/04/2013 11:56, Ombongi Moraa Fe ha scritto: > Hi Team, > > In my python script, I have this: > > command="lynx -dump > 'phpscript?param1=%s¶m2=%s¶m3=%s¶m4=%s¶m5=%s'"%(value1,value2,value3,value4) http://docs.python.org/2/library/subprocess.html#module-subprocess You should set the properl

RE: subprocess.call

2013-04-19 Thread Ombongi Moraa Fe
Hi Team, In my python script, I have this: command="lynx -dump 'phpscript?param1=%s¶m2=%s¶m3=%s¶m4=%s¶m5=%s'"%(value1,value2,value3,value4) result=subprocess.call(command,shell=True) print 'xml message' However, the response from running the php script is also pri

Re: Windows subprocess.call problem

2013-01-21 Thread Chris Angelico
On Tue, Jan 22, 2013 at 12:04 AM, Dave Angel wrote: > Why not just pass all the filenames as parameters in one invocation of > notepad? Assuming Notepad is written reasonably, that'll give it all to you > in one window, instead of opening many separate ones. The OP is talking about Windows Notep

Re: Windows subprocess.call problem

2013-01-21 Thread Terry Reedy
t;> wrote: On 01/21/2013 06:25 AM, Tom Borkin wrote: Hi; I have this code: for song in my_songs: subprocess.call(['notepad.exe'__, '%s.txt' % song]) print song It opens the first song and hangs on subsequen

Re: Windows subprocess.call problem

2013-01-21 Thread Tom Borkin
t;> >> for song in my_songs: >>subprocess.call(['notepad.exe'**, '%s.txt' % song]) >>print song >> >> It opens the first song and hangs on subsequent songs. It doesn't open the >> next song or execute the print until I have closed the

Re: Windows subprocess.call problem

2013-01-21 Thread Dave Angel
On 01/21/2013 06:25 AM, Tom Borkin wrote: Hi; I have this code: for song in my_songs: subprocess.call(['notepad.exe', '%s.txt' % song]) print song It opens the first song and hangs on subsequent songs. It doesn't open the next song or execute the print until I

Re: Windows subprocess.call problem

2013-01-21 Thread Nobody
gs > available. Please advise. If you want to be able to keep track of the child process (e.g. to determine when it has finished), use subprocess.Popen(). If you just want to "fire and forget", use the "start" shell command, e.g.: subprocess.call(['start', 'n

Re: Windows subprocess.call problem

2013-01-21 Thread Tim Golden
On 21/01/2013 11:25, Tom Borkin wrote: > Hi; > I have this code: > > #!/Python27/python > import os, subprocess, sys > lyrics_path = "/Users/Tom/Documents/lyrics" > os.chdir(lyrics_path) > > songs = ['livin-la-vida-loca', 'whos-that-lady'

Windows subprocess.call problem

2013-01-21 Thread Tom Borkin
Hi; I have this code: #!/Python27/python import os, subprocess, sys lyrics_path = "/Users/Tom/Documents/lyrics" os.chdir(lyrics_path) songs = ['livin-la-vida-loca', 'whos-that-lady'] for song in songs: subprocess.call(['notepad.exe', '%s.txt

RE: Problem with subprocess.call and windows schtasks

2012-11-23 Thread Prasad, Ramit
t;Program Files", "Apache Group", "Apache2", > > "htdocs", "ccc", "run_alert.py") > > #subprocess.call(['SchTasks', '/Create', '/SC', 'ONCE', '/TN', '"test"', > &

Re: Problem with subprocess.call and windows schtasks

2012-11-21 Thread Tom Borkin
On Wed, Nov 21, 2012 at 6:01 AM, Tim Golden wrote: > subprocess.call([ > 'SchTasks', '/Create', > '/SC', 'ONCE', > '/TN', 'test', > '/TR', path, > '/ST', '23:50' > ]) > Th

Re: Problem with subprocess.call and windows schtasks

2012-11-21 Thread Tim Golden
On 20/11/2012 23:41, Tom Borkin wrote: > Using shlex, I now have this: > #!\Python27\python > import os, subprocess > path = os.path.join("C:\\", "Program Files", "Apache Group", "Apache2", > "htdocs", "ccc", "run_al

Re: Problem with subprocess.call and windows schtasks

2012-11-20 Thread Dave Angel
t;, "Apache2", > "htdocs", "ccc", "run_alert.py") > #subprocess.call(['SchTasks', '/Create', '/SC', 'ONCE', '/TN', '"test"', > '/TR', path, '/ST', '23:50']) > subpro

Re: Problem with subprocess.call and windows schtasks

2012-11-20 Thread Tom Borkin
Using shlex, I now have this: #!\Python27\python import os, subprocess path = os.path.join("C:\\", "Program Files", "Apache Group", "Apache2", "htdocs", "ccc", "run_alert.py") #subprocess.call(['SchTasks', '/C

Re: Problem with subprocess.call and windows schtasks

2012-11-18 Thread Chris Rebert
On Sun, Nov 18, 2012 at 5:48 AM, Tom Borkin wrote: > Hi, > I have this code: > > #!\Python27\python > > import subprocess > #subprocess.call(['SchTasks /Create /SC ONCE /TN "My Tasks" /TR "C:/Program > Files/Apache Group/Apache2/htdocs/ccc/run_alert.py

Re: Problem with subprocess.call and windows schtasks

2012-11-18 Thread Tim Golden
On 18/11/2012 13:48, Tom Borkin wrote: import subprocess #subprocess.call(['SchTasks /Create /SC ONCE /TN "My Tasks" /TR "C:/Program Files/Apache Group/Apache2/htdocs/ccc/run_alert.py" /ST 07:50'], shell=True) subprocess.call(['SchTasks /Create /SC ONCE /TN

Problem with subprocess.call and windows schtasks

2012-11-18 Thread Tom Borkin
Hi, I have this code: #!\Python27\python import subprocess #subprocess.call(['SchTasks /Create /SC ONCE /TN "My Tasks" /TR "C:/Program Files/Apache Group/Apache2/htdocs/ccc/run_alert.py" /ST 07:50'], shell=True) subprocess.call(['SchTasks /Create /SC ONCE /TN

Re: Newbie Alert: subprocess.call

2010-05-19 Thread Patrick Maupin
On May 19, 10:28 pm, Ben Finney wrote: > Better is to use ‘shlex.split’ to split the string as a shell parser > would do http://docs.python.org/library/shlex#shlex.split>. Good point. I always forget about shlex.split because I'm usually passing (relatively) constant strings with no funny quoti

Re: Newbie Alert: subprocess.call

2010-05-19 Thread Chris Rebert
tpasswordbox function, which made popping a dialog box and storing > the usernames very painless. > > However, subprocess.call as implemented below doesn't work. For some > reason the "-s ts.mycompany.org:80" parameter is being interpreted > differently by the applicatio

Re: Newbie Alert: subprocess.call

2010-05-19 Thread Ben Finney
Patrick Maupin writes: > On May 19, 9:27 pm, Carbon wrote: > > subprocess.call(["/opt/2X/Client/bin/appserverclient", "-u > > fieldValues [0]", "-p fieldValues[1]", "-s ts.mycompany.org:80", "-d > > corp", "-S local&qu

Re: Newbie Alert: subprocess.call

2010-05-19 Thread Patrick Maupin
ction, which made popping a dialog box and storing > the usernames very painless. > > However, subprocess.call as implemented below doesn't work. For some > reason the "-s ts.mycompany.org:80" parameter is being interpreted > differently by the application when sent

Newbie Alert: subprocess.call

2010-05-19 Thread Carbon
the usernames very painless. However, subprocess.call as implemented below doesn't work. For some reason the "-s ts.mycompany.org:80" parameter is being interpreted differently by the application when sent from the python script than it does when sent from the BASH script below.

Re: How to call application in the background with subprocess.call

2010-04-09 Thread John Bokma
parameter I need to use with call so that the python calling >> program doesn't wait for the termination of the subprocess? >> > > Use subprocess.Popen instead of directly using subprocess.call. Or (maybe) better, use the webbrowser module. http://docs.python.org/rel

Re: How to call application in the background with subprocess.call

2010-04-08 Thread Kushal Kumaran
t; program doesn't wait for the termination of the subprocess? > Use subprocess.Popen instead of directly using subprocess.call. -- regards, kushal -- http://mail.python.org/mailman/listinfo/python-list

How to call application in the background with subprocess.call

2010-04-08 Thread jorma kala
Hi, I'd like to call an external application (firefox) from a python program (a PyQT GUI), but I want the external application to run in the background, I mean I do not want my python calling program to wait till the external subprocess terminates. I've tried this: call(["firefox", "http://www.py

Re: uniicode and executing a process with subprocess.call, or os.system

2009-07-25 Thread Martin v. Löwis
> I am very confused about unicode. Can someone point me in the right > direction? Try Python 3.1. This should accept Unicode strings directly for sp.call, so you wouldn't need to encode first. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: uniicode and executing a process with subprocess.call, or os.system

2009-07-19 Thread Rick King
Thanks. I looked around for alternatives but didn't find this one. Rick Chris Rebert wrote: On Sat, Jul 18, 2009 at 3:30 PM, Rick King wrote: Hello, I want to copy files using subprocess.call or os.system where the file names are non-ascii, e.g. Serbian(latin), c's and s's w

Re: uniicode and executing a process with subprocess.call, or os.system

2009-07-18 Thread MRAB
Rick King wrote: Hello, I want to copy files using subprocess.call or os.system where the file names are non-ascii, e.g. Serbian(latin), c's and s's with hacheks,etc. Windows stores all the file names in unicode so they are displayed ok in explorer, and I can read them into my pr

Re: uniicode and executing a process with subprocess.call, or os.system

2009-07-18 Thread Chris Rebert
On Sat, Jul 18, 2009 at 3:30 PM, Rick King wrote: > Hello, > I want to copy files using subprocess.call or os.system where the file names > are non-ascii, e.g. Serbian(latin), c's and s's with hacheks,etc. Windows > stores all the file names in unicode so they are displayed o

uniicode and executing a process with subprocess.call, or os.system

2009-07-18 Thread Rick King
Hello, I want to copy files using subprocess.call or os.system where the file names are non-ascii, e.g. Serbian(latin), c's and s's with hacheks,etc. Windows stores all the file names in unicode so they are displayed ok in explorer, and I can read them into my program with listdir(

Re: Getting subprocess.call() output into a string?

2008-04-18 Thread Nick Stinemates
On Tue, Apr 15, 2008 at 11:16:01PM +0200, David wrote: > > > > Still, about StringIO... > > > > The module description says you can use it to read and write strings > as files, not that you can use strings *everywhere* you can use files. > > In your specific case, StringIO doesn't work, because

Re: Getting subprocess.call() output into a string?

2008-04-15 Thread David
> > Still, about StringIO... > The module description says you can use it to read and write strings as files, not that you can use strings *everywhere* you can use files. In your specific case, StringIO doesn't work, because the stdout redirection takes place at the operating system level (which

Re: Getting subprocess.call() output into a string?

2008-04-15 Thread Tobiah
put. Still, about StringIO... > trying this: > > import StringIO > import subprocess > > file = StringIO.StringIO() > > subprocess.call("ls", stdout = file) > > Traceback (most recent call last): > File "", line 6, in ? > File "

Re: Getting subprocess.call() output into a string?

2008-04-15 Thread David
On Tue, Apr 15, 2008 at 10:36 PM, Tobiah <[EMAIL PROTECTED]> wrote: > I am not sure how to capture the output of a command > using subprocess without creating a temp file. I was > trying this: > > import StringIO > import subprocess > > file = StringIO.Strin

Getting subprocess.call() output into a string?

2008-04-15 Thread Tobiah
I am not sure how to capture the output of a command using subprocess without creating a temp file. I was trying this: import StringIO import subprocess file = StringIO.StringIO() subprocess.call("ls", stdout = file) Traceback (most recent call last): File "", line

Re: Trouble with subprocess.call(...) and zsh script (OSError: [Errno 8] Exec format error)

2007-11-13 Thread Michael George Lerner
On Nov 11, 3:25 pm, Rob Wolfe <[EMAIL PROTECTED]> wrote: Hi Rob, > Michael GeorgeLerner<[EMAIL PROTECTED]> writes: > > > Hi, > > > (Python 2.5, OS X 10.4.10) > > I have a program called pdb2pqr on my system. It is installed so that > > "pdb2pqr" is in my path and looks like: > > > #\!/bin/zsh -f

Re: Trouble with subprocess.call(...) and zsh script (OSError: [Errno 8] Exec format error)

2007-11-11 Thread Rob Wolfe
Michael George Lerner <[EMAIL PROTECTED]> writes: > Hi, > > (Python 2.5, OS X 10.4.10) > I have a program called pdb2pqr on my system. It is installed so that > "pdb2pqr" is in my path and looks like: > > #\!/bin/zsh -f Are you sure that this shebang is correct? I've tested that on bash and hav

Trouble with subprocess.call(...) and zsh script (OSError: [Errno 8] Exec format error)

2007-11-11 Thread Michael George Lerner
ile args = ('/sw/bin/pdb2pqr','--help') output_file = tempfile.TemporaryFile(mode="w+") print "Running",args retcode = subprocess.call(args,stdout=output_file.fileno(),stderr=subprocess.STDOUT) output_file.close() I get this error: localhost~/tmp$ ./x.py

Re: supplying password to subprocess.call('rsync ...'), os.system('rsync ...')

2007-10-09 Thread timw.google
On Oct 7, 1:01 pm, Michael Torrie <[EMAIL PROTECTED]> wrote: > timw.google wrote: > > Hi > > > I want to write a python script that runs rsync on a given directory > > and host. I build the command line string, but when I try to run > > subprocess.call(cmd), o

Re: supplying password to subprocess.call('rsync ...'), os.system('rsync ...')

2007-10-07 Thread Nicholas Bastin
On 05 Oct 2007 16:23:50 GMT, Stargaming <[EMAIL PROTECTED]> wrote: > On Fri, 05 Oct 2007 08:37:05 -0700, timw.google wrote: > >> I can't ssh w/o supplying a password. That's the way the security is > >> set up here. > >> > >> How do I use python to do this, or do I just have to write a zsh > >> scr

Re: supplying password to subprocess.call('rsync ...'), os.system('rsync ...')

2007-10-07 Thread Michael Torrie
timw.google wrote: > Hi > > I want to write a python script that runs rsync on a given directory > and host. I build the command line string, but when I try to run > subprocess.call(cmd), or p=subprocess.Popen(cmd, shell=True),or > os.system(cmd), I get prompted for my login pa

Re: supplying password to subprocess.call('rsync ...'), os.system('rsync ...')

2007-10-07 Thread David
Typo. > Another method is to setup an ssh service on the server (perhaps in Should be: > Another method is to setup an rsync service on the server (perhaps in -- http://mail.python.org/mailman/listinfo/python-list

Re: supplying password to subprocess.call('rsync ...'), os.system('rsync ...')

2007-10-07 Thread David
On 10/5/07, timw.google <[EMAIL PROTECTED]> wrote: > Hi > > I want to write a python script that runs rsync on a given directory > and host. I build the command line string, but when I try to run > subprocess.call(cmd), or p=subprocess.Popen(cmd, shell=True),or > os.system(

Re: supplying password to subprocess.call('rsync ...'), os.system('rsync ...')

2007-10-06 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, timw.google wrote: > I want to write a python script that runs rsync on a given directory > and host. I build the command line string, but when I try to run > subprocess.call(cmd), or p=subprocess.Popen(cmd, shell=True),or > os.system(cmd), I g

Re: supplying password to subprocess.call('rsync ...'), os.system('rsync ...')

2007-10-05 Thread Stargaming
On Fri, 05 Oct 2007 08:37:05 -0700, timw.google wrote: > On Oct 5, 10:33 am, "timw.google" <[EMAIL PROTECTED]> wrote: >> Hi >> >> I want to write a python script that runs rsync on a given directory >> and host. I build the command line string, but when

Re: supplying password to subprocess.call('rsync ...'), os.system('rsync ...')

2007-10-05 Thread timw.google
On Oct 5, 10:33 am, "timw.google" <[EMAIL PROTECTED]> wrote: > Hi > > I want to write a python script that runs rsync on a given directory > and host. I build the command line string, but when I try to run > subprocess.call(cmd), or p=subprocess.Popen(cmd, shell=T

supplying password to subprocess.call('rsync ...'), os.system('rsync ...')

2007-10-05 Thread timw.google
Hi I want to write a python script that runs rsync on a given directory and host. I build the command line string, but when I try to run subprocess.call(cmd), or p=subprocess.Popen(cmd, shell=True),or os.system(cmd), I get prompted for my login password. I expected this, but when I try to give my

Re: problem using subprocess.call

2006-10-26 Thread Fredrik Lundh
Alex Kachanov wrote: >>subprocess.call(["find", dir, "-name", "*.zip", "-execdir", "unzip", >> "{}", ";"]) > > Ok, thanks, it works. > But what's the difference? Why I can't pass all para

Re: problem using subprocess.call

2006-10-26 Thread Alex Kachanov
>> >> dir=os.path.join(os.path.expanduser("~/domains/domain.com/html"),'test') >>subprocess.call(['find',dir+" -name '*.zip' -execdir unzip {} \;"]) > >subprocess.call(["find", dir, "-name", &quo

Re: problem using subprocess.call

2006-10-26 Thread Fredrik Lundh
Alex Kachanov wrote: > running py module with the following code from shell: > __ >dir=os.path.join(os.path.expanduser("~/domains/domain.com/html"),'test') >subprocess.call(['find',dir+" -name '*.zip' -execdir unzip {} \;"])

problem using subprocess.call

2006-10-26 Thread Alex Kachanov
Hi! running py module with the following code from shell: __ dir=os.path.join(os.path.expanduser("~/domains/domain.com/html"),'test') subprocess.call(['find',dir+" -name '*.zip' -execdir unzip {} \;"]) __ returns: __ find: /home/clien

Re: Problem with subprocess.call and cp

2005-10-23 Thread Fredrik Lundh
Torsten Bronger wrote: > The following code > > from subprocess import call > call(['cp', 'subdir/*.jpg', 'othersubdir/']) > > yields > > cp: call of stat for "subdir/*.jpg" not possible: File or directory not found > > (This may not be the real error message since it's back-translated > from Germ

Problem with subprocess.call and cp

2005-10-23 Thread Torsten Bronger
Hallöchen! The following code from subprocess import call call(['cp', 'subdir/*.jpg', 'othersubdir/']) yields cp: call of stat for "subdir/*.jpg" not possible: File or directory not found (This may not be the real error message since it's back-translated from German.) I could use shell=True,

Re: subprocess.call(*args **kwargs) on Linux

2005-06-21 Thread McBooCzech
Thanks a lot :) Petr -- http://mail.python.org/mailman/listinfo/python-list

Re: subprocess.call(*args **kwargs) on Linux

2005-06-20 Thread Leif K-Brooks
McBooCzech wrote: > This is easy. Subprocess function "call" looks: > returncode = subprocess.call(["/root/dex/dex","/dev/ttyS0", > "blabla.txt"]) > and it runs smoothly. > > The problem starts when I am trying to add 1>/dev/nu

subprocess.call(*args **kwargs) on Linux

2005-06-20 Thread McBooCzech
ction "call" looks: returncode = subprocess.call(["/root/dex/dex","/dev/ttyS0", "blabla.txt"]) and it runs smoothly. The problem starts when I am trying to add 1>/dev/null 2>/dev/null parameters to suppres output sendings. In the Shell it looks like