Greetings rpycers,

I'm trying to get my head around using rpc, as I'm sure most of you are.

I've gone through the tutorials and I've connected to a remote machine over 
vpn.
I can write to sys.stdout and see the modules that are loaded, so the 
connection is working.

Normally, when I'm physically in front of the machine I'm not connected to 
remotely,
when I want to run a script I simply type python -i myscript.py

When the script finishes, I can examine variables (results, status, etc) in 
the interactive interpreter.

Now that I've found out about rpyc, I want to run that script remotely.

I've done conn.execute("os.chdir(mypath)" to get to the directory where the 
script is, to eliminate paths and \\ problems,
and I've verified that I'm in the correct directory via 
conn.modules.os.getcwd()
(I've omitted the import os step for brevity)

Now when I try to run my script using conn.execute("python -i myscript.py"), 
this  is returned

conn.execute("python -i myscript.py")
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/RPyC-3.1.0-py2.7.egg/rpyc/core/netref.py",
 
line 125, in __call__
    return syncreq(_self, consts.HANDLE_CALL, args, kwargs)
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/RPyC-3.1.0-py2.7.egg/rpyc/core/netref.py",
 
line 42, in syncreq
    return conn().sync_request(handler, oid, *args)
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/RPyC-3.1.0-py2.7.egg/rpyc/core/protocol.py",
 
line 347, in sync_request
    raise obj
  File "<string>", line 1
    python -i myscript.py
                 ^
SyntaxError: invalid syntax

I've even tried running the script using conn.execute("myscript.py"), this 
results in 
NameError: name 'myscript' is not defined

I can see the script by doing a remote glob.glob, so I know I'm in the right 
place.
  

Reply via email to