473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Subprocess.Popen - passing args help

I'm trying to use Popen to do some command line work Windows XP style.
I have devcon.exe which I would use on a Windows command line like so:

devcon disable "@USB\VID_05E3&PID_0605\5&2CE74B9E&1&6"

Using subprocess.Popen, I have something like this:

subprocess.Popen([r"devcon.exe","disable",'"USB\VID_05E3&PID_0605\5& 2CE74B9E&1&6"']).wait();

For some reason, the parameters are not getting passed to devcon
correctly. Devcon executes, but doesn't behave the same way it does if
I type in the command above at a Win Prompt. Any clues as to how to
pass these parameters? Thanks,

Nov 2 '05 #1
2 3444
A nice person from another thread helped me...

a = 'disable "@USB\VID_0403&PID_6010&MI_00\7&15E4F68&1&0000 '
print a
disable "@USB\VID_0403&PID_6010&MI_00&15E4F68&1&0000

\7 is the ASCII bell so your args may be different from what you think.
I thought the quote method I have fixes this problem, but I guess I was
wrong. Anyone have suggestions on how I can get that parameter in
there without the '\7' part getting lost?

Nov 2 '05 #2
"Ernesto" wrote:
A nice person from another thread helped me...

a = 'disable "@USB\VID_0403&PID_6010&MI_00\7&15E4F68&1&0000 '
print a
disable "@USB\VID_0403&PID_6010&MI_00&15E4F68&1&0000

\7 is the ASCII bell so your args may be different from what you think.
I thought the quote method I have fixes this problem, but I guess I was
wrong. Anyone have suggestions on how I can get that parameter in
there without the '\7' part getting lost?


try

a = r'disable "@USB\VID_0403&PID_6010&MI_00\7&15E4F68&1&0000 '

or

a = 'disable "@USB\\VID_0403&PID_6010&MI_00\\7&15E4F68&1&00 00'

also see section 3.1.2 in the Python Tutorial, and this page:

http://docs.python.org/ref/strings.html

</F>

Nov 2 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: placid | last post by:
Hi all, ive been trying to create a thumbnail using the ffmpeg converter running the ffmpeg.exe using the subprocess module with the following code but the ffmpeg complains about the input...
1
by: yichun.wei | last post by:
Perl has the ability to do the following: print <<EOF; ...reams of text goes here... EOF Is there a Python equivalent of the above Perl code? This thread has previous discussion on the...
3
by: Radek | last post by:
Hi, I am trying to create GUI launcher of several applications using Python and Tkinter. Currently when using subprocess.Popen("mycommand") all output goes to the stdout of my launcher. ...
1
by: Jim | last post by:
Hello, I'm trying to use subprocess to drive a Perl script. I'm having some trouble getting it to spot the command line arguments. Basically, if I call subprocess(args).wait() where args has a...
1
by: WolfgangZ | last post by:
Hello, I'm starting some subprocesses inside a loop. The processes run independent and dont need any communication between each other. Due to memory issues I need to limit the number of running...
2
by: Michael George Lerner | last post by:
Hi, (Python 2.5, OS X 10.4.10) I have a program called pdb2pqr on my system. It is installed so that "pdb2pqr" is in my path and looks like: #\!/bin/zsh -f /sw/share/pdb2pqr/pdb2pqr.py "$@"...
12
by: bhunter | last post by:
Hi, I've used subprocess with 2.4 several times to execute a process, wait for it to finish, and then look at its output. Now I want to spawn the process separately, later check to see if it's...
7
by: Samuel A. Falvo II | last post by:
I have a shell script script.sh that launches a Java process in the background using the &-operator, like so: #!/bin/bash java ... arguments here ... & In my Python code, I want to invoke...
2
by: Chuckk Hubbard | last post by:
If I run 'python -i subprocessclient.py' I expect to see the nice level of it go up 2, and the nice level of the subprocess go up 1. But all I see is the nice level of the client change. What am I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.