@ilaxdal wrote:
I'm attempting to write a CGI script to control my explorer hat from a web page. The hat works fine with runtime scripts.
#!/usr/bin/env python import cgi import cgitb cgitb.enable() print ("Content-type: text/html\n\n") print ("<h1>Hello World</h1>") import explorerhat import RPi.GPIO as GPIO # import a library
The script works fine as a runtime script and works in cgi if I remove the line "import explorerhat" however, when the import is present I get:
A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
/usr/lib/cgi-bin/motor.py in ()
10
=> 11 import explorerhat
12 import RPi.GPIO as GPIO # import a library
13
explorerhat undefined
/usr/lib/python2.7/dist-packages/explorerhat/__init__.py in ()
26 exit("This library requires the cap1xxx module\nInstall with: sudo pip install cap1xxx")
27
=> 28 from .ads1015 import read_se_adc, adc_available
29 from .pins import ObjectCollection, AsyncWorker, StoppableThread
30
read_se_adc undefined, adc_available undefined
/usr/lib/python2.7/dist-packages/explorerhat/ads1015.py in ()
20
21 address = 0x48
=> 22 i2c = SMBus(i2c_bus_id())
23
24 REG_CONV = 0x00
i2c undefined, SMBus = None, i2c_bus_id = None
: [Errno 13] Permission denied
args = (13, 'Permission denied')
errno = 13
filename = None
message = ''
strerror = 'Permission denied'I have run:
sudo chown -R www-data /usr/lib/python2.7/dist-packages
and
sudo chmod -R 777 /usr/lib/python2.7/dist-packagesAny assistance would be greatly appreciated.
Posts: 4
Participants: 3