os.system()- cannot add parameter

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Aug 20 05:01:19 EDT 2008


En Wed, 20 Aug 2008 04:20:15 -0300, aditya shukla  
<adityashukla1983 at gmail.com> escribi�:

> I have a program which is in the form of a client-server. i wanna send  
> the
> parameters from my python script such that the client passes it to the
> server.this is what i have done
> Server is running in vmplayer.This is what i have done
>  b="c:\progs"
> os.system('start c:\\pnew\\xyz\\win32\\xyz' + " " + b) -- now this runs  
> the
> xyz.exe but does not accept the parameter, where as if i directly give
>
> xyz c:\progs through the client(from cmd.exe) then this works.

I'd use the most basic debugging tools - print and repr:

b="c:\progs"  # ensure it is correctly escaped
cmdline = 'start c:\\pnew\\xyz\\win32\\xyz' + " " + b
print repr(cmdline)
os.system(cmdline)

-- 
Gabriel Genellina




More information about the Python-list mailing list