Re: os.system vs subrocess.call

2019-11-28 Thread Stephan Lukits
> On 28. Nov 2019, at 12:05, Ulrich Goebel wrote: > > Hi, > > I have to call commands from inside a python skript. These commands are in > fact other python scripts. So I made > >os.system('\.Test.py') > > That works. > > Now I tried

Re: os.system vs subrocess.call

2019-11-28 Thread Pieter van Oostrum
Ulrich Goebel writes: > Hi, > > I have to call commands from inside a python skript. These commands are > in fact other python scripts. So I made > > os.system('\.Test.py') > > That works. In a string \. is the same as . So this should execute the comman

Re: os.system vs subrocess.call

2019-11-28 Thread Ulrich Goebel
m inside a python skript. These commands are in fact other python scripts. So I made     os.system('\.Test.py') That works. Now I tried to use     supprocess.call(['.\', 'test.py']) That doesn't work but ends in an error: Traceback (most recent call last):

Re: os.system vs subrocess.call

2019-11-28 Thread Peter Otten
Ulrich Goebel wrote: > Hi, > > I have to call commands from inside a python skript. These commands are > in fact other python scripts. So I made > > os.system('\.Test.py') > > That works. > > Now I tried to use > > supprocess.call([&#

os.system vs subrocess.call

2019-11-28 Thread Ulrich Goebel
Hi, I have to call commands from inside a python skript. These commands are in fact other python scripts. So I made os.system('\.Test.py') That works. Now I tried to use supprocess.call(['.\', 'test.py']) That doesn't work but ends in an error

Re: os.system error returns

2015-06-12 Thread random832
For completeness I will note that Windows is completely different. The plain exit status (1 for typical command failures) appears in the os.system result rather than a wait-encoded value. And, incidentally, an MSVC program which calls abort() will return an exit status of 3. A process that

Re: os.system error returns

2015-06-12 Thread random832
On Fri, Jun 12, 2015, at 09:54, Ian Kelly wrote: > Exit code 0 traditionally means success. The exit status is two bytes, > with > the low-order byte normally containing the exit code and the high-order > byte containing the signal that caused the program to exit. That's backwards. The signal (or

Re: os.system error returns

2015-06-12 Thread Ian Kelly
On Jun 12, 2015 7:54 AM, "Ian Kelly" wrote: > > On Jun 12, 2015 7:21 AM, "Grawburg" wrote: > > > > I have a piece of code written for a Raspberry Pi with no explanation for two of the lines -- and I can't find an explanation I understand. > > &

Re: os.system error returns

2015-06-12 Thread Grant Edwards
e the documentation for ‘modprobe(1)’ to find out what > its different exit status values mean. It's modprobe(8), and all the man page says is that it returns non-zero if you try to remove or insert a module it can't find. Explicitly checking for an os.system() return value of 1<<8

Re: os.system error returns

2015-06-12 Thread Ian Kelly
On Jun 12, 2015 7:21 AM, "Grawburg" wrote: > > I have a piece of code written for a Raspberry Pi with no explanation for two of the lines -- and I can't find an explanation I understand. > > Here are the lines: > if os.system('modprobe --first-time -q w1_gpio&

Re: os.system error returns

2015-06-12 Thread Peter Otten
Grawburg wrote: > I have a piece of code written for a Raspberry Pi with no explanation for > two of the lines -- and I can't find an explanation I understand. > > Here are the lines: > if os.system('modprobe --first-time -q w1_gpio') ==0 > > if os.

Re: os.system error returns

2015-06-12 Thread Grant Edwards
On 2015-06-12, Grawburg wrote: > I have a piece of code written for a Raspberry Pi with no explanation for two > of the lines -- and I can't find an explanation I understand. > > Here are the lines: > if os.system('modprobe --first-time -q w1_gpio') ==0 > &g

Re: os.system error returns

2015-06-12 Thread Ben Finney
Grawburg writes: > if os.system('modprobe --first-time -q w1_gpio') ==0 > > if os.system('modprobe -q w1_gpio') == 256: > > I know what the 'modprobe...' is, it's the 0 and the 256 I don't get. > Where do these numbers come from? They

os.system error returns

2015-06-12 Thread Grawburg
I have a piece of code written for a Raspberry Pi with no explanation for two of the lines -- and I can't find an explanation I understand. Here are the lines: if os.system('modprobe --first-time -q w1_gpio') ==0 if os.system('modprobe -q w1_gpio') == 256: I know

Re: os.system() with imbeded quotes on centos

2013-04-05 Thread Cameron Simpson
On 05Apr2013 16:36, Chris Rebert wrote: | No need for third-party code, just use the std lib: | http://docs.python.org/2/library/pipes.html#pipes.quote | http://docs.python.org/3/library/shlex.html#shlex.quote Ah, handy. I must say its quote quoting is kind of verbose, though. | (But yeah, best

Re: os.system() with imbeded quotes on centos

2013-04-05 Thread Chris Rebert
' + someip + > '/cgi-bin/.log&.submit=+++Go%21+++ > junk' > | > | '&' is a special character in shell commands. You'll need to quote or > | escape it. > > Or better still, use the subprocess module and avoid going via the > os.system()

Re: os.system() with imbeded quotes on centos

2013-04-05 Thread Cameron Simpson
| | '&' is a special character in shell commands. You'll need to quote or | escape it. Or better still, use the subprocess module and avoid going via the os.system() altogether: http://docs.python.org/2/library/subprocess.html#popen-constructor If you must go via the os.s

Re: os.system() with imbeded quotes on centos

2013-04-01 Thread John Gordon
In <0c9717ca-52dd-49ce-8102-e14328838...@googlegroups.com> cev...@gmail.com writes: > someip = '192.168.01.01' > var1 = 'lynx -dump http://' + someip + '/cgi-bin/.log&.submit=+++Go%21+++ > > junk' '&' is a special character in shell commands. You'll need to quote or escape it. Try this:

Re: os.system() with imbeded quotes on centos

2013-04-01 Thread Chris Angelico
On Tue, Apr 2, 2013 at 6:22 AM, wrote: > var1 = 'lynx -dump http://' + someip + '/cgi-bin/.log&.submit=+++Go%21+++ > > junk' > lynx -dump 'http://192.168.01.01/cgi-bin/.log&.submit=+++Go%21+++ > junk' The problem is the &, which splits the command. Note how your manual execution puts

os.system() with imbeded quotes on centos

2013-04-01 Thread cevyne
I get the example os.system('ls -al') no problem. i'm trying to create a variable with my command built in it but needs to include quotes. Portion of code is as follows: someip = '192.168.01.01' var1 = 'lynx -dump http://' + someip + '/cgi-bin/.l

Re: os.system() not responding on django... any reason?

2013-03-01 Thread Mark Lawrence
On 01/03/2013 16:23, Jaiky wrote: it is running in view.. When replying can you please ensure we have the complete context, otherwise we have to spend time looking, thanks. -- Cheers. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list

Re: os.system() not responding on django... any reason?

2013-03-01 Thread Jaiky
in django inviroment.. -- http://mail.python.org/mailman/listinfo/python-list

Re: os.system() not responding on django... any reason?

2013-03-01 Thread Jaiky
it is running in view.. -- http://mail.python.org/mailman/listinfo/python-list

Re: os.system() not responding on django... any reason?

2013-03-01 Thread mar...@python.net
On Fri, Mar 1, 2013, at 09:24 AM, Roy Smith wrote: > In article <4fcc93b7-3be9-416f-a2d4-bdc6cba21...@googlegroups.com>, > Jaiky wrote: > > [a lot of code involving ssh and paramiko] > > Here's a few general suggestions: > > 1) Try to reduce this to the smallest possible amount of code which

Re: os.system() not responding on django... any reason?

2013-03-01 Thread Roy Smith
In article <4fcc93b7-3be9-416f-a2d4-bdc6cba21...@googlegroups.com>, Jaiky wrote: [a lot of code involving ssh and paramiko] Here's a few general suggestions: 1) Try to reduce this to the smallest possible amount of code which demonstrates the problem. You gave us a page full of complicated s

os.system() not responding on django... any reason?

2013-03-01 Thread Jaiky
import sys,os sys.stderr = open('/dev/null') import paramiko sys.stderr = sys.__stderr__ os.system("echo \'s3\' >> myfile.txt ") #debug first in ssh2 def ssh2_connect(host, user, pswd, port=22): try: ssh = paramiko.SSHClient

Re: os.system and subprocess odd behavior

2012-12-18 Thread Cameron Simpson
On 18Dec2012 05:39, Dave Angel wrote: | On 12/18/2012 05:27 AM, Hans Mulder wrote: | > On 18/12/12 06:10:43, photonym...@gmail.com wrote: | >> I hope I understand the question... but shouldn't you wait for the process to complete before exiting? | >> | >> Something like: | >> | >> pid = subproces

Re: os.system and subprocess odd behavior

2012-12-18 Thread Hans Mulder
On 17/12/12 21:56:50, py_genetic wrote: > /usr/local/Calpont/mysql/bin/mysql > --defaults-file=/usr/local/Calpont/mysql/my.cnf -u root myDB < > /home/myusr/jobs/APP_JOBS/JOB_XXX.SQL > /home/myusr/jobs/APP_JOBS/JOB_XXX.TXT If you're trying to interact with a MySQL database, then you should really

Re: os.system and subprocess odd behavior

2012-12-18 Thread py_genetic
Solved the issue, by injecting the query into the cmd line. Shell script worked fine as if I was cutting and pasting to the prompt. Seems to still be something with the subprocess receiving and exit code before or when the query finishes, just when I ask to to read from the .SQL file. example

Re: os.system and subprocess odd behavior

2012-12-18 Thread Oscar Benjamin
Can you trim content and interleave your response (instead of top-posting) please? On 18 December 2012 18:26, py_genetic wrote: > HOWEVER... > > when using this command from before no dice > > /usr/local/Calpont/mysql/bin/mysql > --defaults-file=/usr/local/Calpont/mysql/my.cnf -u root myDB <

Re: os.system and subprocess odd behavior

2012-12-18 Thread py_genetic
Oscar I can confirm this behavior from terminal. AND this works as well, simulating exactly what I'm doing permissions wise, and calling sudo python test.py below f1 = open('TESTDIR/file1.txt', 'w') f1.write('some test here\n') f1.close() cmd1 = 'cat < TESTDIR/file1.txt > TESTDIR/file2.txt' P

Re: os.system and subprocess odd behavior

2012-12-18 Thread Hans Mulder
On 18/12/12 11:39:56, Dave Angel wrote: > On 12/18/2012 05:27 AM, Hans Mulder wrote: >> On 18/12/12 06:10:43, photonym...@gmail.com wrote: >>> I hope I understand the question... but shouldn't you wait for the process >>> to complete before exiting? >>> >>> Something like: >>> >>> pid = subprocess

Re: os.system and subprocess odd behavior

2012-12-18 Thread Dave Angel
On 12/18/2012 05:27 AM, Hans Mulder wrote: > On 18/12/12 06:10:43, photonym...@gmail.com wrote: >> I hope I understand the question... but shouldn't you wait for the process >> to complete before exiting? >> >> Something like: >> >> pid = subprocess.Popen(...) >> pid.wait() >> >> Otherwise, it'll

Re: os.system and subprocess odd behavior

2012-12-18 Thread Hans Mulder
On 18/12/12 06:10:43, photonym...@gmail.com wrote: > I hope I understand the question... but shouldn't you wait for the process to > complete before exiting? > > Something like: > > pid = subprocess.Popen(...) > pid.wait() > > Otherwise, it'll exit before the background process is done. Why w

Re: os.system and subprocess odd behavior

2012-12-17 Thread photonymous
I hope I understand the question... but shouldn't you wait for the process to complete before exiting? Something like: pid = subprocess.Popen(...) pid.wait() Otherwise, it'll exit before the background process is done. -- http://mail.python.org/mailman/listinfo/python-list

Re: os.system and subprocess odd behavior

2012-12-17 Thread Oscar Benjamin
On 17 December 2012 20:56, py_genetic wrote: > Oscar, seems you may be correct. I need to run this program as a superuser. > However, after some more tests with simple commands... I seem to be working > correctly from any permission level in python Except for the output write > command f

Re: os.system and subprocess odd behavior

2012-12-17 Thread py_genetic
Oscar, seems you may be correct. I need to run this program as a superuser. However, after some more tests with simple commands... I seem to be working correctly from any permission level in python Except for the output write command from the database to a file. Which runs fine if I past

Re: os.system and subprocess odd behavior

2012-12-17 Thread Oscar Benjamin
On 17 December 2012 16:39, py_genetic wrote: > Thanks for verifying this for me Steven. I'm glad you are seeing it work. > It's really the strangest thing. > > The issue seems to be with the " > outfile.txt" portion of the command. > > The actual command is running a query on a verticalDB and d

Re: os.system and subprocess odd behavior

2012-12-17 Thread py_genetic
Thanks for verifying this for me Steven. I'm glad you are seeing it work. It's really the strangest thing. The issue seems to be with the " > outfile.txt" portion of the command. The actual command is running a query on a verticalDB and dumping the result. The EXACT command run from the comm

Re: os.system and subprocess odd behavior

2012-12-17 Thread py_genetic
Thanks! I am using .txt extensions. Sorry for being a little vague. -- http://mail.python.org/mailman/listinfo/python-list

Re: os.system and subprocess odd behavior

2012-12-14 Thread Dieter Maurer
rocess.Popen("cat < file1 > file2", shell = True) > subprocess.call("cat < file1 > file2", shell = True) > os.system("cat < file1 > file2") But in your code, you use "file1" (without extension). If your code really references a non-existing file, you may well get what you are observing. -- http://mail.python.org/mailman/listinfo/python-list

Re: os.system and subprocess odd behavior

2012-12-14 Thread Steven D'Aprano
> subprocess.call("cat < file1 > file2", shell = True) > os.system("cat < file1 > file2") > > > I'm finding that file2 IS created, but with 0bytes in it, this happens > when I try any sort of cmd to the system of the nature where I'm put

os.system and subprocess odd behavior

2012-12-14 Thread py_genetic
Example of the issue for arguments sake: Platform Ubuntu server 12.04LTS, python 2.7 Say file1.txt has "hello world" in it. subprocess.Popen("cat < file1 > file2", shell = True) subprocess.call("cat < file1 > file2", shell = True) os.system("ca

Re: os.system()

2012-04-20 Thread Adam Skutt
On Apr 20, 6:51 am, Yigit Turgut wrote: > On Apr 19, 11:02 pm, "Steve" wrote: > > > > "Yigit Turgut" wrote in message > > >news:b9a8bb28-3003-4a36-86fb-339ef697b...@i2g2000vbd.googlegroups.com... > > > When I use os.system() function, scri

Re: os.system()

2012-04-20 Thread Chris Angelico
On Fri, Apr 20, 2012 at 8:51 PM, Yigit Turgut wrote: > On Apr 19, 11:02 pm, "Steve" wrote: >> > "Yigit Turgut"  wrote in message >> >news:b9a8bb28-3003-4a36-86fb-339ef697b...@i2g2000vbd.googlegroups.com... >> > When I use os.system() function,

Re: os.system()

2012-04-20 Thread Yigit Turgut
On Apr 19, 11:02 pm, "Steve" wrote: > > "Yigit Turgut"  wrote in message > >news:b9a8bb28-3003-4a36-86fb-339ef697b...@i2g2000vbd.googlegroups.com... > > When I use os.system() function, script waits for termination of the > > windows that is opened by

Re: os.system()

2012-04-19 Thread Steve
"Yigit Turgut" wrote in message news:b9a8bb28-3003-4a36-86fb-339ef697b...@i2g2000vbd.googlegroups.com... When I use os.system() function, script waits for termination of the windows that is opened by os.system() to continue thus throwing errors and etc. How can i tell Python to let

Re: os.system()

2012-04-19 Thread Jacob MacDonald
On Thursday, April 19, 2012 11:09:22 AM UTC-7, Yigit Turgut wrote: > When I use os.system() function, script waits for termination of the > windows that is opened by os.system() to continue thus throwing errors > and etc. How can i tell Python to let it go and keep on with the next &g

Re: os.system()

2012-04-19 Thread MRAB
On 19/04/2012 19:09, Yigit Turgut wrote: When I use os.system() function, script waits for termination of the windows that is opened by os.system() to continue thus throwing errors and etc. How can i tell Python to let it go and keep on with the next execution after os.system() ? Try using the

os.system()

2012-04-19 Thread Yigit Turgut
When I use os.system() function, script waits for termination of the windows that is opened by os.system() to continue thus throwing errors and etc. How can i tell Python to let it go and keep on with the next execution after os.system() ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Inconsistency between os.getgroups and os.system('groups') after os.setgroups()

2012-03-26 Thread jeff
s_. See the discussion of > > > how to implement privilege separation at > > > > > > http://www.citi.umich.edu/u/provos/ssh/privsep.html > > > > os.system("su -m -c ''") > > > > seems to do the trick. > > Yes, because ‘os.sys

Re: Inconsistency between os.getgroups and os.system('groups') after os.setgroups()

2012-03-25 Thread Ben Finney
gt; Simply not possible (i.e., you can't drop root privileges, be it by > > setuid()/setgid() or removing yourself from groups with setgroups()), > > and later reacquire them _in the same process_. See the discussion of > > how to implement privilege separation at > > &

Re: Inconsistency between os.getgroups and os.system('groups') after os.setgroups()

2012-03-25 Thread jeff
y doing os.setgid and os.setuid > > before the os.system call (in which case I wind up in the group of > > the > > new user instead of root), but I have to be able to get back to root > > privilege so I can't use setgid and setuid. > > Simply not possible (i.e., you

Re: Inconsistency between os.getgroups and os.system('groups') after os.setgroups()

2012-03-25 Thread Heiko Wundram
Am 25.03.2012 23:32, schrieb jeff: After the os.setgroups, os.getgroups says that the process is not in any groups, just as you would expect... I can suppress membership in the root group only by doing os.setgid and os.setuid before the os.system call (in which case I wind up in the group of

Inconsistency between os.getgroups and os.system('groups') after os.setgroups()

2012-03-25 Thread jeff
Run this test program as root: import os print "before:", os.getgroups() os.system("groups") os.setgroups([]) print "after:", os.getgroups() os.system("groups") After the os.setgroups, os.getgroups says that the process is not in any groups, just

SSL and os.system/Popen

2012-03-01 Thread Marek Lipert
Hi! I have a problem with SSL and threaded os.system (rewritten to Popen but still not working). First - the set-up: I am using windows 2003 server with current python 2.6. When new connection comes to my server-side application, i do accept, and then: self.client = ssl.wrap_socket

Re: Killing threads, and os.system()

2012-02-03 Thread Paul Rubin
John Nagle writes: > QNX's message passing looks more like a subroutine call than an > I/O operation, How do they enforce process isolation, or do they decide they don't need to? -- http://mail.python.org/mailman/listinfo/python-list

Re: Killing threads, and os.system()

2012-02-03 Thread Steven D'Aprano
On Fri, 03 Feb 2012 00:14:33 -0800, John Nagle wrote: > I won't even get into the appalling mess around the Global Interpreter > Lock. You know full well that IronPython and Jython don't have a GIL. If the GIL was as harmful as you repeatedly tell us, why haven't you, and everyone else, migrate

Re: Killing threads, and os.system()

2012-02-03 Thread John Nagle
On 1/31/2012 8:04 AM, Dennis Lee Bieber wrote: ({muse: who do we have to kill to persuade OS designers to incorporate something like the Amiga ARexx "rexxport" system}). QNX, which is a real-time microkernel which looks like POSIX to applications. actually got interprocess communication rig

Re: Killing threads, and os.system()

2012-01-31 Thread Laurent Claessens
Le 31/01/2012 17:04, Dennis Lee Bieber a écrit : Of course, if that thread is stuck waiting for a call to os.system() to complete, then it can not do anything... os.system() is a rather limited, restrictive, call -- best used for quick one-of operations. If running Python

Killing threads, and os.system()

2012-01-30 Thread Laurent Claessens
Hello all I've a program that launches a lot of threads and each of them launches a os.system("my_command"). My program also keeps a list of the launched threads, so I can make "for" loops on the threads. My aim is to kill everything with ctrl-C (Keyboar

Re: os.system() on Windows in Tkinter app spawns console window

2011-08-14 Thread Kevin Walzer
On 8/13/11 1:15 AM, Nobody wrote: On Fri, 12 Aug 2011 22:49:32 -0400, Kevin Walzer wrote: I'm developing a Tkinter app for a Windows customer, and the app bundles several command-line tools (ported from Unix). I call out to these console tools from the Tkinter app via os.system(). Howeve

Re: os.system() on Windows in Tkinter app spawns console window

2011-08-12 Thread Nobody
On Fri, 12 Aug 2011 22:49:32 -0400, Kevin Walzer wrote: > I'm developing a Tkinter app for a Windows customer, and the app bundles > several command-line tools (ported from Unix). I call out to these > console tools from the Tkinter app via os.system(). However, in the > fro

os.system() on Windows in Tkinter app spawns console window

2011-08-12 Thread Kevin Walzer
I'm developing a Tkinter app for a Windows customer, and the app bundles several command-line tools (ported from Unix). I call out to these console tools from the Tkinter app via os.system(). However, in the frozen version of my app, when I call out to these tools, I get multiple co

Re: os.system and loggers

2011-01-11 Thread Tim
On Jan 10, 1:01 pm, Carl Banks wrote: > On Jan 10, 8:29 am, Tim wrote: > > > > > > > > > > > On Jan 7, 11:24 am, Tim wrote: > > > > hi, I'm using a 3rd-party python program that uses the python logging > > > facility and also makes c

Re: os.system and loggers

2011-01-10 Thread Carl Banks
On Jan 10, 8:29 am, Tim wrote: > I think I may have included too much fluff in my original question. > The main thing I wonder is whether I can attach a log handler to > stdout in such a way that os.system calls will write to that handler > instead of the console. -- http://mai

Re: os.system and loggers

2011-01-10 Thread Carl Banks
On Jan 10, 8:29 am, Tim wrote: > On Jan 7, 11:24 am, Tim wrote: > > > > > > > hi, I'm using a 3rd-party python program that uses the python logging > > facility and also makes calls to os.system. I'm trying to capture its > > output to a file. &

Re: os.system and loggers

2011-01-10 Thread Tim
On Jan 7, 11:24 am, Tim wrote: > hi, I'm using a 3rd-party python program that uses the python logging > facility and also makes calls to os.system. I'm trying to capture its > output to a file. > > In my own code, I've taken control of the loggers that are s

os.system and loggers

2011-01-07 Thread Tim
hi, I'm using a 3rd-party python program that uses the python logging facility and also makes calls to os.system. I'm trying to capture its output to a file. In my own code, I've taken control of the loggers that are setup in the other program by removing its StreamHandler and

Re: multicpu bzip2 using os.system or queue using python script

2010-07-27 Thread harijay
; > > I am a newbie in queue and threaded processes . But I am wondering how > > I can implement this such that I can have four bzip2 running threads > > (actually I guess os.system threads ), each using probably their own > > cpu , that deplete files from a queue as they bz

Re: multicpu bzip2 using os.system or queue using python script

2010-07-27 Thread MRAB
single cpu while the other cpus remain relatively idle. I am a newbie in queue and threaded processes . But I am wondering how I can implement this such that I can have four bzip2 running threads (actually I guess os.system threads ), each using probably their own cpu , that deplete files from a

multicpu bzip2 using os.system or queue using python script

2010-07-27 Thread harijay
the other cpus remain relatively idle. I am a newbie in queue and threaded processes . But I am wondering how I can implement this such that I can have four bzip2 running threads (actually I guess os.system threads ), each using probably their own cpu , that deplete files from a queue as they bzip

Re: Print file via file association using os.system or subprocess? (Windows)

2010-07-18 Thread python
the user's default printer) http://timgolden.me.uk/python/win32_how_do_i/print.html#shellexecute Example: win32api.ShellExecute( 0, 'print', fileName, None, '.', 0 ) Under Windows: Is there a way to print a file using the file's file extension association using eithe

Re: Print file via file association using os.system or subprocess? (Windows)

2010-07-18 Thread Mark Hammond
On 19/07/2010 3:46 AM, pyt...@bdurham.com wrote: Under Windows: Is there a way to print a file using the file's file extension association using either the os.system or subprocess modules (vs. win32 extensions)? Use case: print PDF or Office documents to default printer without havi

Print file via file association using os.system or subprocess? (Windows)

2010-07-18 Thread python
Under Windows: Is there a way to print a file using the file's file extension association using either the os.system or subprocess modules (vs. win32 extensions)? Use case: print PDF or Office documents to default printer without having to distribute win32 extensions. Thanks, Malcolm --

Re: os.system: string encoding

2010-06-29 Thread Lawrence D'Oliveiro
In message , Peter Kleiweg wrote: > How do I set the string encoding for os.system to anything other then > UTF-8? Works for me (on Debian Unstable): l...@theon:~> echo $LC_ALL en_NZ.utf8 l...@theon:~> python3.1 Python 3.1.2 (r312:79147, May 8 2010, 13:27:06)

Re: problems getting os.system and wxmenu to read options from a file and then execute

2010-06-27 Thread eric dexter
function which can be > >> called when the menu item is clicked, something like this: > > >>              wx.EVT_MENU(self, idtool, lambda idtool=idtool, e=e: > >> self.OnExecute(idtool, e)) > > >>>             idtool += 1 > >>>    

Re: problems getting os.system and wxmenu to read options from a file and then execute

2010-06-27 Thread MRAB
ool,e): print tool os.system(e) #print tool # Get rid of the dialog to keep things tidy [snip] wx.EVT_MENU(self, idtool, self.OnExecute(idtool, e)) I changed it to this and it seems to be calling self.OnExecute befour the editor comes up and then after the editor

Re: problems getting os.system and wxmenu to read options from a file and then execute

2010-06-27 Thread eric dexter
: > self.OnExecute(idtool, e)) > > >             idtool += 1 > >             ##print e > > [snip] > >     def OnExecute(self,tool,e): > >         print tool > >         os.system(e) > >         #print tool > >         # Get rid of the dialog to keep

Re: problems getting os.system and wxmenu to read options from a file and then execute

2010-06-27 Thread MRAB
which can be called when the menu item is clicked, something like this: wx.EVT_MENU(self, idtool, lambda idtool=idtool, e=e: self.OnExecute(idtool, e)) idtool += 1 ##print e [snip] def OnExecute(self,tool,e): print tool os.sys

problems getting os.system and wxmenu to read options from a file and then execute

2010-06-27 Thread eric_dex...@msn.com
verwrite! dlg = wx.FileDialog(self, "Choose a file", self.dirname, "", "*.*", \ wx.SAVE | wx.OVERWRITE_PROMPT) if dlg.ShowModal() == wx.ID_OK: # Grab the content to be saved itcontains = self.control.GetValue() # Open th

Re: os.system: string encoding

2010-06-27 Thread Martin v. Loewis
>> For the moment, you can encode the string explicitly, and pass a byte >> string. > > That doesn't work I only have 3.1.2 to test at the moment. I suggest trying to use the subprocess module instead. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: os.system: string encoding

2010-06-27 Thread Peter Kleiweg
Martin v. Loewis schreef op de 27e dag van de zomermaand van het jaar 2010: > Am 25.06.2010 17:13, schrieb Peter Kleiweg: > > How do I set the string encoding for os.system to anything other then UTF-8? > > You shouldn't have to set it, as it should use your locale's

Re: os.system: string encoding

2010-06-27 Thread Martin v. Loewis
Am 25.06.2010 17:13, schrieb Peter Kleiweg: > How do I set the string encoding for os.system to anything other then UTF-8? You shouldn't have to set it, as it should use your locale's encoding. In 3.1.2, it will. For the moment, you can encode the string explicitly, and pass

os.system: string encoding

2010-06-25 Thread Peter Kleiweg
How do I set the string encoding for os.system to anything other then UTF-8? (peter) ~ echo $LANG nl...@euro (peter) ~ python3 Python 3.1.1 (r311:74480, Oct 2 2009, 11:50:52) >>> '\N{EURO SIGN}' '€' >>> import os >>> os.system('echo \N{

Re: Trouble with os.system

2010-02-03 Thread Charles-Pierre Astolfi
That was it ! What a stupid error... Thank you ! -- Cp On Wed, Feb 3, 2010 at 20:13, Jerry Hill wrote: > On Wed, Feb 3, 2010 at 12:58 PM, Cpa wrote: >> Sure. >> >> import sys,re,os >> files2create = sys.argv[1:] >> os.system('mkdir tmp') >>

Re: Trouble with os.system

2010-02-03 Thread Jerry Hill
On Wed, Feb 3, 2010 at 12:58 PM, Cpa wrote: > Sure. > > import sys,re,os > files2create = sys.argv[1:] > os.system('mkdir tmp') > > # Some code to create the .tex > > # Compile tex files > os.system('for file in tmp/*; do pdflatex "$file";

Re: Trouble with os.system

2010-02-03 Thread Cpa
No, the tmp folder only contains files, and your modification still won't work for me. By the way I have the same error if I do: files2compile = os.listdir('./tmp/') for f in files2compile: os.system('pdflatex '+f) -- Cp On 3 fév, 19:08, Gerald Britton wrote: >

Re: Trouble with os.system

2010-02-03 Thread Gerald Britton
It kinda worked for me but I had to change it a little: os.system('for file in /tmp/*.tex; do pdflatex "$file"; done') Maybe you're picking up other files in /tmp that are not .tex files? On Wed, Feb 3, 2010 at 12:58 PM, Cpa wrote: > Sure. > > import sys

Re: Trouble with os.system

2010-02-03 Thread Cpa
Sure. import sys,re,os files2create = sys.argv[1:] os.system('mkdir tmp') # Some code to create the .tex # Compile tex files os.system('for file in tmp/*; do pdflatex "$file"; done') Pretty simple, alas. -- Cpa On 3 fév, 18:54, Gerald Britton wrote: > Can y

Re: Trouble with os.system

2010-02-03 Thread Gerald Britton
Can you post your code? On Wed, Feb 3, 2010 at 12:47 PM, Cpa wrote: > Hi there, > > I'm having some trouble with os.system on Fedora 12. > I have a bunch of .tex files in tmp/ and I want to compile them. > In my shell, the following commands work perfectly : 'for

Trouble with os.system

2010-02-03 Thread Cpa
Hi there, I'm having some trouble with os.system on Fedora 12. I have a bunch of .tex files in tmp/ and I want to compile them. In my shell, the following commands work perfectly : 'for file in tmp/ *.tex; do pdflatex "$file"; done'. But if I use the same command u

Re: os.system function

2010-01-13 Thread r0g
Lie Ryan wrote: > On 01/13/10 04:59, r0g wrote: >> so you may want to look into pythons core GUI library, TKL. > > I know Tk and Tcl has been close since their childhood; did they get > married too? Whoops... yes Tk/Tcl, it seems they had become one in my head only! :) Roger. -- http://mail.py

Re: os.system function

2010-01-13 Thread Lie Ryan
On 01/13/10 04:59, r0g wrote: > so you may want to look into pythons core GUI library, TKL. I know Tk and Tcl has been close since their childhood; did they get married too? -- http://mail.python.org/mailman/listinfo/python-list

Re: os.system function

2010-01-12 Thread r0g
Zabin wrote: > Hey everyone! > > I am a new python programmer. I am trying to get the general file > functionality with options of save and save as working. These save > functions save a folder with multiple files. Upon using the os.system > copy function- if my destination d

Re: os.system function

2010-01-12 Thread Jeremy Sanders
Zabin wrote: > Thanks for the pointersi had a look around and found the site: > http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en- us/xcopy.mspx?mfr=true > > to disable the prompt- i needed to include /y as below: > os.system ('xcopy /s

Re: os.system function

2010-01-11 Thread Zabin
- i needed to include /y as below: > >  os.system ('xcopy /s %s %s /y ' % (dirExe, dirname_new)) > > > and just wondering- whats the drawback of using os.system() command > > - It won't work across different platforms (unix, mac, windows) > - Spaces or special ch

Re: os.system function

2010-01-11 Thread Chris Rebert
On Mon, Jan 11, 2010 at 2:00 PM, Zabin wrote: > and just wondering- whats the drawback of using os.system() command Forgetting to properly escape your input. Simple example: filename = "foo bar.txt" os.system("rm "+filename) # uh-oh, we deleted 'foo' and &

Re: os.system function

2010-01-11 Thread Zabin
ns save a folder with multiple files. Upon using the os.system > > copy function- if my destination directory has files with similar > > names- i am asked whether i want to replace the files on the command > > prompt. > > > Is there some way of getting this question into

Re: os.system function

2010-01-11 Thread Chris Rebert
On Mon, Jan 11, 2010 at 12:43 PM, Zabin wrote: > Hey everyone! > > I am a new python programmer. I am trying to get the general file > functionality with options of save and save as working. These save > functions save a folder with multiple files. Upon using the os.system > co

  1   2   3   4   5   >