By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,318 Members | 2,107 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,318 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Jul 18 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"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
Jul 18 '05 #2

P: n/a
Anders Dalvander <go****@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: dm**@dman13.dyndns.org
Jul 18 '05 #3

P: n/a
Derrick 'dman' Hudson <dm**@dman13.dyndns.org> wrote in message news:<fl************@dman13.dyndns.org>...
Not surprising. Pick command.COM or cmd.exe.


*siq* I should have written anycommand.exe instead of command.exe...
Jul 18 '05 #4

P: n/a
"Emile van Sebille" <em***@fenx.com> wrote in message news:<bn*************@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
Jul 18 '05 #5

P: n/a

"Anders Dalvander" <go****@dalvander.com> wrote in message
news:d0**************************@posting.google.c om...
"Emile van Sebille" <em***@fenx.com> wrote in message news:<bn*************@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
Jul 18 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.