popen[2-4] does not work with parameters inside quotes
The group you are posting to is a
Usenet group . Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Newsgroups: comp.lang.python
From:
goo... @dalvander.com (Anders Dalvander)
Date: 30 Oct 2003 12:07:40 -0800
Local: Thurs, Oct 30 2003 3:07 pm
Subject: popen[2-4] does not work with parameters inside quotes
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
You must
Sign in before you can post messages.
You do not have the permission required to post.
Newsgroups: comp.lang.python
From:
"Emile van Sebille" <em... @fenx.com>
Date: Thu, 30 Oct 2003 12:50:22 -0800
Local: Thurs, Oct 30 2003 3:50 pm
Subject: Re: popen[2-4] does not work with parameters inside quotes
"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 em... @fenx.com
You must
Sign in before you can post messages.
You do not have the permission required to post.
Newsgroups: comp.lang.python
From:
Derrick 'dman' Hudson <d... @dman13.dyndns.org>
Date: Thu, 30 Oct 2003 22:30:01 GMT
Local: Thurs, Oct 30 2003 5:30 pm
Subject: Re: popen[2-4] does not work with parameters inside quotes
Anders Dalvander <goo
... @dalvander.com> 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: d... @dman13.dyndns.org
You must
Sign in before you can post messages.
You do not have the permission required to post.
Newsgroups: comp.lang.python
From:
goo... @dalvander.com (Anders Dalvander)
Date: 31 Oct 2003 05:27:01 -0800
Local: Fri, Oct 31 2003 8:27 am
Subject: Re: popen[2-4] does not work with parameters inside quotes
Derrick 'dman' Hudson <d... @dman13.dyndns.org> wrote in message <news:flf871-fbr.ln1@dman13.dyndns.org >...
> Not surprising. Pick command.COM or cmd.exe.
*siq* I should have written anycommand.exe instead of command.exe...
You must
Sign in before you can post messages.
You do not have the permission required to post.
Newsgroups: comp.lang.python
From:
goo... @dalvander.com (Anders Dalvander)
Date: 31 Oct 2003 05:29:28 -0800
Local: Fri, Oct 31 2003 8:29 am
Subject: Re: popen[2-4] does not work with parameters inside quotes
"Emile van Sebille" <em... @fenx.com> wrote in message <news:bnrte4$14vkmn$1@ID-11957.news.uni-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
You must
Sign in before you can post messages.
You do not have the permission required to post.
Newsgroups: comp.lang.python
From:
"Jimmy Retzlaff" <ji... @retzlaff.com>
Date: Fri, 31 Oct 2003 07:36:08 -0800
Local: Fri, Oct 31 2003 10:36 am
Subject: RE: popen[2-4] does not work with parameters inside quotes
Anders Dalvander wrote:
> 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.
Take a look at this (especially Tim Peters' very thorough explanation in the Followups section): http://sf.net/tracker/?func=detail&aid=512433&group_id=5470&atid=105470
Perhaps this is what you are seeing? One workaround (that isn't beautiful) might be to create a temporary batch file with your command line and execute that batch file.
Jimmy
You must
Sign in before you can post messages.
You do not have the permission required to post.
Newsgroups: comp.lang.python
From:
"Emile van Sebille" <em... @fenx.com>
Date: Fri, 31 Oct 2003 08:29:21 -0800
Local: Fri, Oct 31 2003 11:29 am
Subject: Re: popen[2-4] does not work with parameters inside quotes
"Anders Dalvander" <goo
... @dalvander.com> wrote in message
news:d04c84a9.0310310529.6b160e57@posting.google.com ... > "Emile van Sebille" <em
... @fenx.com> wrote in message
<news:bnrte4$14vkmn$1@ID-11957.news.uni-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
You must
Sign in before you can post messages.
You do not have the permission required to post.