1

I try to using the Pyro4 on autotesting, but now I confused for some ability for Pyro4. Does there existed some method to get the system information by the Pyro4 object.

In my ideas, I expose a pyro object that can get the system information, and the remote machine can using this object to show the system information. But on my code, the remote machine always show the server information. I guess that I misunderstand or misuse the Pyro4

Sorry for this stupid question, i'm the newbie for Pyro4. The follow is my sample code. The server exposes the pyro object

# Server.py
#! /usr/bin/env python

import Pyro4
import os

class Ex(object):
    def run(self):
        print os.uname()


if __name__ == "__main__":
    daemon = Pyro4.Daemon()
    ns     = Pyro4.locateNS()
    uri = daemon.register(Ex())
    ns.register("ex", uri)
    print uri
    daemon.requestLoop()

and the client using the Pyro object

# Remote
#! /usr/bin/env python

import Pyro4
if __name__ == "__main__":
    uri = raw_input("input the uri> ")
    fn = Pyro4.Proxy(uri)
    fn.run()

p.s I know i can get the os information on the client side, but I want to use the Pyro object to get the information instead client does this itself.

arshajii
  • 127,459
  • 24
  • 238
  • 287
cmj
  • 106
  • 1
  • 9

1 Answers1

1

I got the answer!

Just using the Pyro4.utils.flame. This module can provides the ability to using the module or function on remote machine.

Following is the sample code:

The remote machine

python -Wignore -m Pyro4.utils.flameserver --host <yourIP> --port 9999

The host

#! /usr/bin/env python

import Pyro4.utils.flame

if __name__ == "__main__":
    flame = Pyro4.utils.flame.connect("192.168.16.29:64024")
    os = flame.module("os")
    print os.listdir('.')
cmj
  • 106
  • 1
  • 9