Permissions issue when running a python script

I did two things,

I changed the owner of the Adafruit files to root. I actually only had the MCP3008 file as ‘staff’ and the GPIO was already ‘root’ unlike in your post before.

Next I copied the script to /usr/local/ because I thought if thats where the packages are, and thats where the script runs from, surely thats a good thing right?

Added the thing and item and its reading fine now. Checked with both String and Number channels on the thing but only the string output is working.
Im not sure if the number output needs to work but if I can use that value as a number in the rules then it wont be a problem.

I believe it was moving the file to the location /usr/local and created a new directory there to store further scripts. I attempted to set up a thing with the path back to the original location but it gave me another error even thought the owner of the packages was changed.

Glad to finally have this sorted. Next onto the rules to see if that works.

Thanks

I already had files in the location you mention so instead Ive moved my scripts to the same location and I think that is the resolution.

@Josar
I am not sure that this is the right channel for my issue. Please advice if wrong.
Many years ago I did an openhab2 application but now I want to write a personal tutorial so I started from the beginning choosing a simple project.
But i have a problem with the Exec binding that should runs a python script. it put the script in /etc/openha2/scripts/…
[07:08:17] root@openhab:/home/openhabian# chmod -R +x /etc/openhab2/scripts
but anything in the script importing anything produce an error
I guess is a matter of permission (also “cd” produce the same error)
ile “/etc/openhab2/scripts/prova.py”, line 10, in

from rpi_rf import RFDevice

ImportError: No module named rpi_rf

please help me I do not know what to do
thanks
bruno

Sounds like a Python include problem. As the exec binding will have different environment as you when executing the script. Make sure executing the script as user openhab runs.

Make sure the sys.path contains the required library. Make sure that the shebang selects the correct Python installation. You might have the library installed only for one.