Re: Using Pyro over 2 networks

Richard <[email protected]> Sat, 04 Oct 2014 20:47:21 +0200
Newsgroups gmane.comp.python.pyro
Message-ID <[email protected]>
How do I look at the log files on the server?
I tried a very simple function, but with weird results if I create a 
class instance in that function.
in my main program:
modulesource = open("mystuff.py").read()
flame.sendmodule("flame.stuff", modulesource)
print(flame.module("flame.stuff").init())

and in mystuff.py:
class Test(object):
     def __init__( self ):
         self.data= "/data/rtng/software/hops/hops.sqlite"

def init():
     t = Test()
     return t

When I run my main, I get:
Traceback (most recent call last):
   File "/Users/richard/Desktop/MyPython/hops/hopper.py", line 118, in 
<module>
     print(flame.module("flame.stuff").init())
   File 
"/Library/Python/2.7/site-packages/Pyro4-4.22-py2.7.egg/Pyro4/core.py", 
line 160, in __call__
     return self.__send(self.__name, args, kwargs)
   File 
"/Library/Python/2.7/site-packages/Pyro4-4.22-py2.7.egg/Pyro4/utils/flame.py", 
line 81, in __invoke
     return self.flameserver._invokeModule(module, args, kwargs)
   File 
"/Library/Python/2.7/site-packages/Pyro4-4.22-py2.7.egg/Pyro4/core.py", 
line 160, in __call__
     return self.__send(self.__name, args, kwargs)
   File 
"/Library/Python/2.7/site-packages/Pyro4-4.22-py2.7.egg/Pyro4/core.py", 
line 314, in _pyroInvoke
     data = serializer.deserializeData(msg.data, compressed=msg.flags & 
Pyro4.message.FLAGS_COMPRESSED)
   File 
"/Library/Python/2.7/site-packages/Pyro4-4.22-py2.7.egg/Pyro4/util.py", 
line 154, in deserializeData
     return self.loads(data)
   File 
"/Library/Python/2.7/site-packages/Pyro4-4.22-py2.7.egg/Pyro4/util.py", 
line 348, in loads
     return pickle.loads(data)
ImportError: No module named flame.stuff

Normally I would expect something like:
<__main__.Test object at 0x1037f0c10>

But: it works if I do this:

def init():
     t = Test()
     return t.data

Richard
On 03/10/14 23:17, Irmen de Jong wrote:
> On 3-10-2014 15:54, Richard wrote:
>> In trying to do this, I' am sending 'myself' over, but I get an error:
>>
>> Traceback (most recent call last):
>>     File "/Users/richard/Desktop/MyPython/hops/hopper.py", line 110, in
>> <module>
>>       flame.sendmodule("flame.stuff", modulesource)
>>     File
>> "/Library/Python/2.7/site-packages/Pyro4-4.22-py2.7.egg/Pyro4/core.py",
>> line 160, in __call__
>>       return self.__send(self.__name, args, kwargs)
>>     File
>> "/Library/Python/2.7/site-packages/Pyro4-4.22-py2.7.egg/Pyro4/core.py",
>> line 318, in _pyroInvoke
>>       raise data
>> IndexError: list index out of range
>
> Please find out where that error is coming from. I *think* it is an error raised from
> your own code in the module that you are sending across via flame.
> You should be able to discover this easily by looking in the pyro log on the server.
>
>
>> When I send another .py module over, all works fine.
>> I am using a flame server on the other side, and a small SQLite database
>> telling hopper.py the IP address of the next hop.
>> Is there a limitation on what to send over? E.g. can it be a program or
>> should it be only functions or classes?
> You can send a python module across. They can contain all sorts of things... As long as
> it is pickleable.
>
>> I can imagine that when sending over a program the initial code will not
>> get called?
> I don't know what you are asking here, what is "the initial code"?
>
>
> Irmen
>
>
> ------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
> _______________________________________________
> Pyro-core mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pyro-core


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk