On Wed, Sep 19, 2012 at 12:50 PM, ashish <ashish.mak...@gmail.com> wrote:
<snip>
> 2. I have a python script, local.py, running on 'local' which needs to pass 
> arguments ( 3/4 string arguments, containing whitespaces like spaces, etc ) 
> to a python script, remote.py running on 'remote' (the remote machine).
<snip>
> 3. Has anybody been able to do this using os.system ?
>
> I tried this
>>>> import os
>>>> os.system ("ssh remoteuser@remote python remote.py arg1 arg2 arg3")
>
> This worked, but if the arguments i tried to pass, had spaces, i was not able 
> to 'escape' the spaces.

Use the `subprocess` module instead (with shell=False). You then won't
need to worry about escaping.
http://docs.python.org/library/subprocess.html

Cheers,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to