Can we use /MAKE inside the popen3 command?

Greg Krohn greg at invalid.invalid
Fri Sep 10 03:09:47 EDT 2004


Ruchika wrote:

> 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



More information about the Python-list mailing list