rapidograf wrote: ↑
Sat Dec 15, 2018 8:25 pm
Can you give some sample how working without smbus with i2c devices ?
Oh, you meant that smbus, not the session manager bus, my mistake, sorry. In that case, yes, you're using the correct py library. A few links:
https://www.instructables.com/id/Raspbe ... 2C-Python/
http://raspberry-projects.com/pi/progra ... nterface-2
and last, but not least
file /tmp/prpyoutput.txt was created , size zero , no information , python script wit strings about smbus not working .
Those strings are what we need
Do they have some filenames in them? Chances are good that the file you lack permission for is /dev/i2c. To be sure, run this:
Code: Select all
strace python /home/pi/pr.py 2>&1 | grep open >/tmp/prpytrace.txt
This will list all linux system calls, and then grep will limit the output to opening files only. You'll see a lot of them (shared libraries and other technical files required by python for example), but somewhere around the end you'll see the one which causes the problem. When executed from php (the one which fails), it's very likely that the last line (or the one before) will be the one causing the trouble.
When you've found the filename, do "ls -l filename" to see which group it belongs to, then add your webserver's user to that group. (If the file is under /dev, then you can't simply modify the file permissions, because /dev is generated, and your modifications will be lost. You'll have to write an udev rule to make that permanent, which is not easy for a beginner, therefore I suggest to add it's group instead)