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

Subprocess.Popen - passing args help

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
"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 discussion thread is closed

Replies have been disabled for this discussion.