Python rpyc cannot run psutil command remotely
I am trying to run a command psutil
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 have error: "ImportError: No module named psutil"
but I installed psutil
in both (remote and local).
When I test with, for example, with import os
, it works great.
What advice?
Thank.
+3
source to share