popen[2-4] does not work with parameters inside quotes

Discussion in 'Python' started by Anders Dalvander, Oct 30, 2003.

  1. os.popen[2-4] does not work with parameters inside quotes, nor do
    os.popen. At least on Windows.

    import os
    cmd = '"c:\\command.exe" "parameter inside quotes"'
    os.popen4(cmd)

    Results in the following error message:

    'c:\\command.exe" "parameter inside quotes' is not recognized as an
    internal or external command,
    operable program or batch file.

    // Dalle
     
    Anders Dalvander, Oct 30, 2003
    #1
    1. Advertising

  2. "Anders Dalvander"
    > os.popen[2-4] does not work with parameters inside quotes, nor do
    > os.popen. At least on Windows.
    >
    > import os
    > cmd = '"c:\\command.exe" "parameter inside quotes"'
    > os.popen4(cmd)
    >
    > Results in the following error message:
    >


    Hmm... not for me... I get:

    >>> import os
    >>> cmd = '"c:\\command.exe" "parameter inside quotes"'
    >>> os.popen4(cmd)

    (<open file '"c:\command.exe" "parameter inside quotes"', mode 'w' at
    0x008E6620>, <open file '"c:\command.exe" "parameter insid
    e quotes"', mode 'r' at 0x008EC060>)


    Emile van Sebille
     
    Emile van Sebille, Oct 30, 2003
    #2
    1. Advertising

  3. Anders Dalvander <> wrote:

    > cmd = '"c:\\command.exe" "parameter inside quotes"'
    > os.popen4(cmd)


    > 'c:\\command.exe" "parameter inside quotes' is not recognized as an
    > internal or external command, operable program or batch file.


    Not surprising. Pick command.COM or cmd.exe.

    -D

    --
    If your life is a hard drive,
    Christ can be your backup.

    www: http://dman13.dyndns.org/~dman/ jabber:
     
    Derrick 'dman' Hudson, Oct 30, 2003
    #3
  4. Derrick 'dman' Hudson <> wrote in message news:<>...
    > Not surprising. Pick command.COM or cmd.exe.


    *siq* I should have written anycommand.exe instead of command.exe...
     
    Anders Dalvander, Oct 31, 2003
    #4
  5. "Emile van Sebille" <> wrote in message news:<bnrte4$14vkmn$-berlin.de>...
    > Hmm... not for me... I get:
    >
    > >>> import os
    > >>> cmd = '"c:\\command.exe" "parameter inside quotes"'
    > >>> os.popen4(cmd)

    > (<open file '"c:\command.exe" "parameter inside quotes"', mode 'w' at
    > 0x008E6620>, <open file '"c:\command.exe" "parameter insid
    > e quotes"', mode 'r' at 0x008EC060>)
    >


    Did you try with having the exe-file in another directory with spaces:
    "c:\path with spaces\command.exe"?

    What Windows version are you running?

    // Dalle
     
    Anders Dalvander, Oct 31, 2003
    #5
  6. "Anders Dalvander" <> wrote in message
    news:...
    > "Emile van Sebille" <> wrote in message

    news:<bnrte4$14vkmn$-berlin.de>...
    > > Hmm... not for me... I get:
    > >
    > > >>> import os
    > > >>> cmd = '"c:\\command.exe" "parameter inside quotes"'
    > > >>> os.popen4(cmd)

    > > (<open file '"c:\command.exe" "parameter inside quotes"', mode 'w' at
    > > 0x008E6620>, <open file '"c:\command.exe" "parameter insid
    > > e quotes"', mode 'r' at 0x008EC060>)
    > >

    >
    > Did you try with having the exe-file in another directory with spaces:
    > "c:\path with spaces\command.exe"?


    This wraps, but here's the result:

    Python 2.4a0 (#46, Oct 25 2003, 09:39:59) [MSC v.1200 32 bit (Intel)] on
    win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import os
    >>> cmd = '"C:\\Program Files\\Microsoft Visual

    Studio\\Common\\Tools\\dfview.ex
    e" "parameter inside quotes"'
    >>> os.popen4(cmd)

    (<open file '"C:\Program Files\Microsoft Visual
    Studio\Common\Tools\dfview.exe"
    "parameter inside quotes"', mode 'w' at 0x008E4EE0>, <open file '"C:\Program
    Fil
    es\Microsoft Visual Studio\Common\Tools\dfview.exe" "parameter inside
    quotes"',
    mode 'r' at 0x008EC660>)
    >>>


    >
    > What Windows version are you running?
    >

    This was on winxppro.

    Emile
     
    Emile van Sebille, Oct 31, 2003
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris White

    Quotes/Double Quotes in Image Control

    Chris White, Sep 22, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    4,898
    Hermit Dave
    Sep 22, 2004
  2. Chris
    Replies:
    1
    Views:
    13,721
    Oisin
    Mar 24, 2006
  3. Lawrence Tierney

    Multiline quotes - escaping quotes - et al

    Lawrence Tierney, Dec 24, 2003, in forum: Java
    Replies:
    3
    Views:
    4,532
    Andrew Thompson
    Dec 24, 2003
  4. Bret
    Replies:
    3
    Views:
    2,632
    Terry Reedy
    Jun 9, 2009
  5. jOhn
    Replies:
    1
    Views:
    252
    Phlip
    Jan 29, 2008
Loading...

Share This Page