Can we use /MAKE inside the popen3 command?

R

Ruchika

Is it OK to use "/" or "-" characters in a string and then use that
string inside the popen3 command? I am doing the following -

os.popen3('r'"C:\Program Files\... \EVC.exe"'
r'"C:\Test\...\Test.vcp"' /MAKE "GFSDK - Win32 (WCE ARMV4) Release"
/REBUILD"')

When I run this command in the Python shell, it says - "Syntax Error"
and the marker is uderneath the "-" in "GFSDK - Win32 (WCE ARMV4)
Release". Not sure if the marker is actually pointing to specifically
"-" or the entire /MAKE "GFSDK - Win32 (WCE ARMV4) Release" string.
Anyone else came across similar problem?

Thanks for your help.

Ruchika
 
G

Greg Krohn

Ruchika said:
Is it OK to use "/" or "-" characters in a string and then use that
string inside the popen3 command? I am doing the following -

os.popen3('r'"C:\Program Files\... \EVC.exe"'
r'"C:\Test\...\Test.vcp"' /MAKE "GFSDK - Win32 (WCE ARMV4) Release"
/REBUILD"')

When I run this command in the Python shell, it says - "Syntax Error"
and the marker is uderneath the "-" in "GFSDK - Win32 (WCE ARMV4)
Release". Not sure if the marker is actually pointing to specifically
"-" or the entire /MAKE "GFSDK - Win32 (WCE ARMV4) Release" string.
Anyone else came across similar problem?

Thanks for your help.

Ruchika

You've got a whole mess of strings there. They need to be straightened
out. ;) If you are using r for raw string you only need it once at the
beginning, and it doesn't go inside the quotes. So, after all that's
fixed we get:

os.popen3(r'"C:\Program Files\... \EVC.exe" "C:\Test\...\Test.vcp" /MAKE "GFSDK - Win32 (WCE ARMV4) Release" /REBUILD')

Here's a few free suggestions at no extra charge. You don't really need
to use raw strings for Windows paths. Using forward slashed as always
worked fine for me. Also, it might be a good idea to split up the long
line, too. So this is how I would do it:

evc = '"C:/Program Files/... /EVC.exe"'
vcp = '"C:/Test/.../Test.vcp"'
switches = '/MAKE "GFSDK - Win32 (WCE ARMV4) Release" /REBUILD'
os.popen3(evc + ' ' + vcp + ' ' + switces)

Or better yet:

os.popen3('%s %s %s' % (evc, vcp, switches))


HTH,
greg
 
P

Peter Hansen

Greg said:
Here's a few free suggestions at no extra charge. You don't really need
to use raw strings for Windows paths. Using forward slashed as always
worked fine for me.

There is one exception, and that is when the paths are being passed
to the command interpreter/shell. As in this case.

-Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,470
Messages
2,571,809
Members
48,797
Latest member
PeterSimpson
Top