tigeraniya / papy

Automatically exported from code.google.com/p/papy
0 stars 0 forks source link

NameError: name 'imports' is not defined during the execution with RPyC #2

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Install all packages from the bundle using easy_install
2. Run a bit modified code from the documentation:
import rpyc 
from papy import Worker 
s = Worker(sum) 
conn = rpyc.classic.connect(“localhost”) 
s._inject(conn) 
s([2,3]) 

What is the expected output? What do you see instead?
Expected output is 5. However I get the following error on two different 
operational systems:
======= Remote traceback =======
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/rpyc-3.0.7-py2.6.egg/rpyc/core/protocol.py", line 223, in _dispatch_request
    res = self._HANDLERS[handler](self, *args)
  File "/usr/local/lib/python2.6/dist-packages/rpyc-3.0.7-py2.6.egg/rpyc/core/protocol.py", line 426, in _handle_call
    return self._local_objects[oid](*args, **dict(kwargs))
  File "/usr/local/lib/python2.6/dist-packages/rpyc-3.0.7-py2.6.egg/rpyc/core/service.py", line 113, in exposed_execute
    exec text in self.exposed_namespace
  File "<string>", line 1, in <module>
NameError: name 'imports' is not defined

======= Local exception ========
Traceback (most recent call last):
  File "pypa_test.py", line 12, in <module>
    su._inject(conn)
  File "/usr/local/lib/python2.6/dist-packages/papy-1.0-py2.6.egg/papy/core.py", line 1354, in _inject
    _inject_func(get_defaults, conn)
  File "/usr/local/lib/python2.6/dist-packages/numap-1.0-py2.6.egg/numap/NuMap.py", line 1002, in _inject_func
    conn.execute(inject_code)
  File "/usr/local/lib/python2.6/dist-packages/rpyc-3.0.7-py2.6.egg/rpyc/core/netref.py", line 123, in __call__
    return syncreq(_self, consts.HANDLE_CALL, args, kwargs)
  File "/usr/local/lib/python2.6/dist-packages/rpyc-3.0.7-py2.6.egg/rpyc/core/netref.py", line 45, in syncreq
    return conn().sync_request(handler, oid, *args)
  File "/usr/local/lib/python2.6/dist-packages/rpyc-3.0.7-py2.6.egg/rpyc/core/protocol.py", line 342, in sync_request
    raise obj
NameError: name 'imports' is not defined

What version of the product are you using? On what operating system?
The same error was observed on SunOS 5.11 and Ubuntu 10.04 with kernel 2.6.32-27

Original issue reported on code.google.com by v.khakhu...@gmail.com on 28 Dec 2010 at 4:12

GoogleCodeExporter commented 8 years ago
I don't know if it's the correct way or just a workarround, but I could get the 
example to work if I place "conn.execute("from numap.NuMap import imports")" 
before injecting.

Original comment by v.khakhu...@gmail.com on 28 Dec 2010 at 11:06