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.
Solved!
I've restarted the rpyc classic service on the server and try again. Now it works fine.
BR,
Junix