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 5 3723
"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
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
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...
"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
"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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Sami Viitanen |
last post by:
Hello,
I was using os.popen function to get CVS command output to string from
script..
Same commands worked well with Windows, but Linux seems to have problem with
those. Whole CVS commands...
|
by: Grumble |
last post by:
Hello all,
Is there an iostream equivalent to cstdio's popen()?
Is there a way to change a FILE * into an iostream?
|
by: bastiaannaber |
last post by:
I am trying to write a program which uses popen but I have a problem. I
want to detect if the program I call with popen has ended. For example:
#include <stdio.h>
#include <sys/types.h>...
|
by: rveloso |
last post by:
Hi all, i'm having a really nasty problem with popen.
I have the following code :
---------------------
....
FILE *PD;
....
sprintf(fname,"/usr/bin/gzip -dc %s/%s",dirname,dp->d_name);
.......
|
by: Clodoaldo Pinto Neto |
last post by:
Output from the shell:
$ set | grep IFS
IFS=$' \t\n'
Output from subprocess.Popen():
"IFS=' \t\n"
Both outputs for comparison:
|
by: CFAN |
last post by:
Why the disk space keep on decreasing,is that due to use popen()?
I have wrote a monitor program to ensure my program on working by
using popen to
use 'ps' command, but the disk space keep on...
|
by: bayer.justin |
last post by:
Hi,
I am trying to communicate with a subprocess via the subprocess
module. Consider the following example:
<subprocess.Popen object at 0x729f0>
Here hey is immediately print to stdout of...
|
by: Greg Ercolano |
last post by:
When I use os.popen(cmd,'w'), I find that under windows, the stdout
of the child process disappears, instead of appearing in the DOS window
the script is invoked from. eg:
C:\type foo.py
import...
|
by: Jean-Paul Calderone |
last post by:
On Mon, 12 May 2008 17:35:44 -0700 (PDT), schickb <schickb@gmail.comwrote:
Alas, you haven't actually closed src's standard input. Though you did
close src.stdin, you didn't close the copy of it...
|
by: Jeremy Banks |
last post by:
Hi. I wondered if anyone knew the rationale behind the naming of the
Popen class in the subprocess module. Popen sounds like the a suitable
name for a function that created a subprocess, but the...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |