brock@uncacsci-pi-j:~/Adafruit_Python_PCA9685/Adafruit_PCA9685$ cd /var/www/html brock@uncacsci-pi-j:/var/www/html$ ls acctest foo.cgi index.lighttpd.html jdb.txt testit brock@uncacsci-pi-j:/var/www/html$ ls -l total 20 -rw-r--r-- 1 brock adm 1005 Nov 13 11:11 acctest -rwxr-xr-x 1 brock adm 31 Nov 13 10:48 foo.cgi -rw-r--r-- 1 root root 3373 Nov 13 10:34 index.lighttpd.html -rw-r--r-- 1 brock adm 12 Nov 13 10:39 jdb.txt drwxr-xr-x 2 brock adm 4096 Nov 13 11:27 testit brock@uncacsci-pi-j:/var/www/html$ cd testit brock@uncacsci-pi-j:/var/www/html/testit$ ls acctest~ acctest.cgi index.cgi listi2c.cgi listi2c.cgi~ brock@uncacsci-pi-j:/var/www/html/testit$ ls -l total 28 -rw-r--r-- 1 brock adm 1005 Nov 13 11:11 acctest~ -rwxr-xr-x 1 brock adm 284 Nov 13 11:26 acctest.cgi -rwxr-xr-x 1 brock adm 517 Nov 13 10:52 index.cgi -rw-r--r-- 1 brock adm 213 Nov 13 11:53 ledon.cgi -rw-r--r-- 1 brock adm 284 Nov 13 11:51 ledon.cgi~ -rwxr-xr-x 1 brock adm 132 Nov 13 11:08 listi2c.cgi -rw-r--r-- 1 brock adm 508 Nov 13 11:00 listi2c.cgi~ brock@uncacsci-pi-j:/var/www/html/testit$ chmod 755 ledon.cgi brock@uncacsci-pi-j:/var/www/html/testit$ ./ledon.cgi Content-Type: application/json
--> -->| NameError | Python 3.4.2: /usr/bin/python3 Sun Nov 13 11:53:47 2016 |
A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
| /var/www/html/testit/ledon.cgi in |
| 8 print('Content-Type: application/json') |
| 9 print() |
| => 10 print(json.dumps(True)) |
| 11 |
| 12 |
| builtin print = <built-in function print>, json undefined |
NameError: name 'json' is not defined
args =
("name 'json' is not defined",)
with_traceback =
<built-in method with_traceback of NameError object>
brock@uncacsci-pi-j:/var/www/html/testit$ !!
./ledon.cgi
Content-Type: application/json
true
brock@uncacsci-pi-j:/var/www/html/testit$ ls -l
total 36
-rw-r--r-- 1 brock adm 1005 Nov 13 11:11 acctest~
-rwxr-xr-x 1 brock adm 284 Nov 13 11:26 acctest.cgi
-rwxr-xr-x 1 brock adm 517 Nov 13 10:52 index.cgi
-rw-r--r-- 1 brock adm 222 Nov 13 11:54 ledoff.cgi
-rw-r--r-- 1 brock adm 225 Nov 13 11:54 ledoff.cgi~
-rwxr-xr-x 1 brock adm 225 Nov 13 11:53 ledon.cgi
-rw-r--r-- 1 brock adm 284 Nov 13 11:51 ledon.cgi~
-rwxr-xr-x 1 brock adm 132 Nov 13 11:08 listi2c.cgi
-rw-r--r-- 1 brock adm 508 Nov 13 11:00 listi2c.cgi~
brock@uncacsci-pi-j:/var/www/html/testit$ chmod 755 ./ledoff.cgi
brock@uncacsci-pi-j:/var/www/html/testit$ ./ledoff.cgi
Content-Type: application/json
true
brock@uncacsci-pi-j:/var/www/html/testit$ ./ledon.cgi
Content-Type: application/json
true
brock@uncacsci-pi-j:/var/www/html/testit$ ledoff.cgi
bash: ledoff.cgi: command not found
brock@uncacsci-pi-j:/var/www/html/testit$ ./ledoff.cgi
Content-Type: application/json
true
brock@uncacsci-pi-j:/var/www/html/testit$ ./ledread.cgi
bash: ./ledread.cgi: Permission denied
brock@uncacsci-pi-j:/var/www/html/testit$ chmod 755 ledread.cgi
brock@uncacsci-pi-j:/var/www/html/testit$ ./ledread.cgi
| NameError | Python 3.4.2: /usr/bin/python3 Sun Nov 13 12:02:14 2016 |
A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
| /var/www/html/testit/ledread.cgi in |
| 11 LED0_OFF_H = 0x09 |
| 12 channel=15 |
| => 13 lowon = pwm._device.read8(LED0_ON_L+4*channel) |
| 14 lowoff = pwm._device.read8(LED0_ON_H+4*channel) |
| 15 # pwm = Adafruit_PCA9685.PCA9685() |
| lowon undefined, pwm undefined, LED0_ON_L = 6, channel = 15 |
NameError: name 'pwm' is not defined
args =
("name 'pwm' is not defined",)
with_traceback =
<built-in method with_traceback of NameError object>
brock@uncacsci-pi-j:/var/www/html/testit$ !!
./ledread.cgi
| AttributeError | Python 3.4.2: /usr/bin/python3 Sun Nov 13 12:02:58 2016 |
A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
| /var/www/html/testit/ledread.cgi in |
| 12 pwm = Adafruit_PCA9685.PCA9685() |
| 13 channel=15 |
| => 14 lowon = pwm._device.read8(LED0_ON_L+4*channel) |
| 15 lowoff = pwm._device.read8(LED0_ON_H+4*channel) |
| 16 # pwm = Adafruit_PCA9685.PCA9685() |
| lowon undefined, pwm = <Adafruit_PCA9685.PCA9685.PCA9685 object>, pwm._device = <Adafruit_GPIO.I2C.Device object>, pwm._device.read8 undefined, LED0_ON_L = 6, channel = 15 |
AttributeError: 'Device' object has no attribute 'read8'
args =
("'Device' object has no attribute 'read8'",)
with_traceback =
<built-in method with_traceback of AttributeError object>
brock@uncacsci-pi-j:/var/www/html/testit$ !!
./ledread.cgi
Content-Type: application/json
[0, 0]
brock@uncacsci-pi-j:/var/www/html/testit$ !!
./ledread.cgi
Content-Type: application/json
| NameError | Python 3.4.2: /usr/bin/python3 Sun Nov 13 12:05:19 2016 |
A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
| /var/www/html/testit/ledread.cgi in |
| 20 print('Content-Type: application/json') |
| 21 print() |
| => 22 print(json.dumps([highon, lowon, highon, lowoff])) |
| 23 |
| 24 |
| builtin print = <built-in function print>, json = <module 'json' from '/usr/lib/python3.4/json/__init__.py'>, json.dumps = <function dumps>, highon = 0, lowon = 0, lowoff undefined |
NameError: name 'lowoff' is not defined
A problem occurred in a Python script. Here is the sequence of
function calls leading up to the error, in the order they occurred. AttributeError: 'str' object has no attribute 'highon'
A problem occurred in a Python script. Here is the sequence of
function calls leading up to the error, in the order they occurred. NameError: name 'highon' is not defined
A problem occurred in a Python script. Here is the sequence of
function calls leading up to the error, in the order they occurred. NameError: name 'highon' is not defined
args =
("name 'lowoff' is not defined",)
with_traceback =
<built-in method with_traceback of NameError object>
brock@uncacsci-pi-j:/var/www/html/testit$ !!
./ledread.cgi
Content-Type: application/json
[0, 0, 0, 0]
brock@uncacsci-pi-j:/var/www/html/testit$ !!
./ledread.cgi
Content-Type: application/json
[0, 0, 0, 0]
brock@uncacsci-pi-j:/var/www/html/testit$ ./ledon.cgi
Content-Type: application/json
true
brock@uncacsci-pi-j:/var/www/html/testit$ ./ledread.cgi
Content-Type: application/json
[0, 0, 0, 0]
brock@uncacsci-pi-j:/var/www/html/testit$ !!
./ledread.cgi
Content-Type: application/json
[0, 0, 0, 0]
brock@uncacsci-pi-j:/var/www/html/testit$ ./ledon.cgi
Content-Type: application/json
true
brock@uncacsci-pi-j:/var/www/html/testit$ ./ledread.cgi
Content-Type: application/json
[0, 0, 0, 0]
brock@uncacsci-pi-j:/var/www/html/testit$ ./ledon.cgi
Content-Type: application/json
true
brock@uncacsci-pi-j:/var/www/html/testit$ ./ledread.cgi
File "./ledread.cgi", line 15
print lowon
^
SyntaxError: Missing parentheses in call to 'print'
brock@uncacsci-pi-j:/var/www/html/testit$ !!
./ledread.cgi
0
0
0
0
Content-Type: application/json
[0, 0, 0, 0]
brock@uncacsci-pi-j:/var/www/html/testit$ ./ledon.cgi
Content-Type: application/json
true
brock@uncacsci-pi-j:/var/www/html/testit$ python3
Python 3.4.2 (default, Oct 19 2014, 13:31:11)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import Adafruit_PCA9685
>>> >>>
>>> LED0_ON_L = 0x06
>>> >>> LED0_ON_H = 0x07
>>> LED0_OFF_L = 0x08
>>> LED0_OFF_H = 0x09
>>> pwm = Adafruit_PCA9685.PCA9685()
>>> >>> channel=15
>>> lowon = pwm._device.readU8(LED0_ON_L+4*channel)
>>> pwm.set_pwm(15,0,2000)
>>> >>> print(LED0_ON_L+4*channel)
66
>>> pwm._device.readU8(LED0_ON_L+4*channel)
0
>>> pwm._device.readU8(LED0_ON_H+4*channel)
0
>>> pwm._device.readU8(LED0_OFF_L+4*channel)
208
>>> pwm._device.readU8(LED0_ON_H+4*channel)
0
>>> pwm._device.readU8(LED0_ON_H+4*channel)
0
>>> 208*255
53040
>>> 208*256
53248
>>> 2000/208
9.615384615384615
>>> print(LED0_ON_H+4*channel)
67
>>> pwm.set_pwm(15,0,2000)
>>> pwm._device.readU8(LED0_ON_L+4*channel)
0
>>> pwm._device.readU8(LED0_ON_H+4*channel)
0
>>> pwm._device.readU8(LED0_OFF_L+4*channel)
208
>>> pwm._device.readU8(LED0_OFF_H+4*channel)
7
>>> 7*256 + 208
2000
>>>
>>> >>>
>>>
>>>
>>>
>>>
brock@uncacsci-pi-j:/var/www/html/testit$ ls
acctest.cgi index.cgi ledoff.cgi ledon.cgi ledread.cgi listi2c.cgi
brock@uncacsci-pi-j:/var/www/html/testit$ ./ledread.cgi
0
0
0
0
Content-Type: application/json
[0, 0, 0, 0]
brock@uncacsci-pi-j:/var/www/html/testit$ python
Python 2.7.9 (default, Sep 17 2016, 20:26:04)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> pwm = Adafruit_PCA9685.PCA9685()
Traceback (most recent call last):
File "
AttributeErrorPython 3.4.2: /usr/bin/python3
Sun Nov 13 14:44:46 2016
/var/www/html/testit/ledread.cgi in 19 highon = pwm._device.readU8(LED0_ON_H+4*channel)
20 time.sleep(1)
=> 21 print('highon '.highon)
22 lowoff = pwm._device.readU8(LED0_OFF_L+4*channel)
23 time.sleep(1)
builtin print = <built-in function print>, 'highon '.highon undefined
args =
("'str' object has no attribute 'highon'",)
with_traceback =
<built-in method with_traceback of AttributeError object>
brock@uncacsci-pi-j:/var/www/html/testit$ ./ledon.cgi
Content-Type: application/json
true
brock@uncacsci-pi-j:/var/www/html/testit$ ./ledread.cgi
pwm
NameErrorPython 3.4.2: /usr/bin/python3
Sun Nov 13 14:50:46 2016
/var/www/html/testit/ledread.cgi in 29 print('Content-Type: application/json')
30 print()
=> 31 print(json.dumps([highon, lowon, highoff, lowoff]))
32
33
builtin print = <built-in function print>, json = <module 'json' from '/usr/lib/python3.4/json/__init__.py'>, json.dumps = <function dumps>, highon undefined, lowon undefined, highoff undefined, lowoff undefined
args =
("name 'highon' is not defined",)
with_traceback =
<built-in method with_traceback of NameError object>
brock@uncacsci-pi-j:/var/www/html/testit$ ./ledon.cgi
Content-Type: application/json
true
brock@uncacsci-pi-j:/var/www/html/testit$ ./ledread.cgi
pwm
NameErrorPython 3.4.2: /usr/bin/python3
Sun Nov 13 14:52:14 2016
/var/www/html/testit/ledread.cgi in 29 print('Content-Type: application/json')
30 print()
=> 31 print(json.dumps([highon, lowon, highoff, lowoff]))
32
33
builtin print = <built-in function print>, json = <module 'json' from '/usr/lib/python3.4/json/__init__.py'>, json.dumps = <function dumps>, highon undefined, lowon undefined, highoff undefined, lowoff undefined
args =
("name 'highon' is not defined",)
with_traceback =
<built-in method with_traceback of NameError object>
brock@uncacsci-pi-j:/var/www/html/testit$