Python Forum
<SOLVED>os.system needs a string in quotes - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: <SOLVED>os.system needs a string in quotes (/thread-292.html)

Pages: 1 2


RE: os.system needs a string in quotes - Skaperen - Oct-06-2016

(Oct-06-2016, 03:10 AM)snippsat Wrote: You shall call it without [] when argument are in a list.
 
subprocess.call(cmd)

sorry about not checking that he was making a list in the call.  my habit is to make lists and do as you say and not have [] in the call.  i ended up jumping to conclude that he did,  my bad.


RE: os.system needs a string in quotes - Fred Barclay - Oct-06-2016

This works perfectly!
cmd = [ "srm", "-rv", path ]
subprocess.call(cmd)
I can even delete folders and files with really weird names like
Quote:/home/fred/Git/this "is" a test of (srm)
or
Quote:/home/fred/Git/who (am) "I" 'going' to be?



Yahoo!
Thanks guys! :dance:


RE: <SOLVED>os.system needs a string in quotes - Ofnuts - Oct-06-2016

(Oct-06-2016, 05:03 PM)Fred Barclay Wrote: I can even delete folders and files with really weird names
Expected since they are passed directly to the command without being tinkered with by a shell.