Python rpyc can not run a psutil command remotely

Go To StackoverFlow.com

3

I'm trying to run a psutil command remotely:

import os, sys, time
import rpyc
import psutil

command = """def rpcexecute():
       import psutil
       cpu = psutil.cpu_percent(interval=1)
       return cpu"""

conn = rpyc.classic.connect('192.168.0.100')
conn.execute(command)
remote_exec = conn.namespace['rpcexecute']
result = remote_exec()

I've got an error: "ImportError: No module named psutil", but I have installed psutil in the both (remote and localhost).

When I test using import os for example, it works fine.

Some tip?

Thank you.

2012-04-05 22:37
by Junix


2

Solved!

I've restarted the rpyc classic service on the server and try again. Now it works fine.

BR,

Junix

2012-04-09 18:30
by Junix
Ads