Python Forum

Full Version: unable to find module in su mode?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello ,
stange issue
I wrote a code with module "can"
when I run it using this command :

 python3 Documents/ReadData.py
Setup can0 for reading Data
setup finish , waiting for message
it working

when I run it using this command :
 sudo python3 Documents/ReadData.py
Traceback (most recent call last):
  File "Documents/ReadData.py", line 1, in <module>
    import can
ModuleNotFoundError: No module named 'can'
how could it be ?

it's a problem becuse it need to be run as sudo on boot

Thanks,
sudo can change your path. The specific python those commands are running may be different. You might want to give the full path to python.
Perhaps you installed the 'can' module for a single user? (with pip install --user)