Python Forum
<SOLVED>os.system needs a string in quotes
Thread Rating:
  • 2 Vote(s) - 2.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
<SOLVED>os.system needs a string in quotes
#11
(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.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#12
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:
OS: Arch
Editor: Atom with Material Syntax UI and the Termination terminal plugin

Micah 6:8
Reply
#13
(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.
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need help on how to include single quotes on data of variable string hani_hms 5 2,207 Jan-10-2023, 11:26 AM
Last Post: codinglearner
  [SOLVED] [BeautifulSoup] Why does it turn inserted string's brackets into &lt;/&gt;? Winfried 0 1,587 Sep-03-2022, 11:21 PM
Last Post: Winfried
  [SOLVED] [BeautifulSoup] Turn select() into comma-separated string? Winfried 0 1,164 Aug-19-2022, 08:07 PM
Last Post: Winfried
  Adding string after every 3rd charater [SOLVED] AlphaInc 2 1,340 Jul-11-2022, 09:22 AM
Last Post: ibreeden
Question [SOLVED] Delete specific characters from string lines EnfantNicolas 4 2,320 Oct-21-2021, 11:28 AM
Last Post: EnfantNicolas
  Replace String in multiple text-files [SOLVED] AlphaInc 5 8,313 Aug-08-2021, 04:59 PM
Last Post: Axel_Erfurt
  Replace String with increasing numer [SOLVED] AlphaInc 13 5,242 Aug-07-2021, 08:16 AM
Last Post: perfringo
Thumbs Up Parsing a YAML file without changing the string content..?, Flask - solved. SpongeB0B 2 2,334 Aug-05-2021, 08:02 AM
Last Post: SpongeB0B
  reading lines from a string [Solved] ebolisa 14 6,546 Mar-28-2021, 08:16 PM
Last Post: perfringo
  Two types of single quotes Led_Zeppelin 2 1,974 Mar-15-2021, 07:55 PM
Last Post: BashBedlam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020