iamdual / webiopi

Automatically exported from code.google.com/p/webiopi
0 stars 0 forks source link

ERROR - global name 'GPIO' is not defined #134

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.install webiopi
2.add two line on /etc/webiopi/config [GPIO]
7 = OUT 1
8 = OUT 1
3.sudo webiopi -d -c /etc/webiopi/config
...

WebIOPi version used?
=>0.7.0

Python version used?
=>3.2

Distro used? (WebIOPi has only been tested on Raspbian Wheezy)
=>Raspbian 

Raspberry Pi board revision? (1 or 2)
=>2

For Javascript side bugs, Browser?
=>no

Please provide any additional information below.

pi@pi2garage ~ $ sudo webiopi -d -c /etc/webiopi/config
2015-02-06 22:35:40 - WebIOPi - INFO - Starting WebIOPi/0.7.0/Python3.2
2015-02-06 22:35:40 - WebIOPi - DEBUG - Mapping GPIO.digitalCount to REST GET 
/GPIO/count
2015-02-06 22:35:40 - WebIOPi - DEBUG - Mapping GPIO.digitalRead to REST GET 
/GPIO/%(channel)d/value
2015-02-06 22:35:40 - WebIOPi - DEBUG - Mapping GPIO.digitalWrite to REST POST 
/GPIO/%(channel)d/value/%(value)d
2015-02-06 22:35:40 - WebIOPi - DEBUG - Mapping GPIO.getFunctionString to REST 
GET /GPIO/%(channel)d/function
2015-02-06 22:35:40 - WebIOPi - DEBUG - Mapping GPIO.getPulse to REST GET 
/GPIO/%(channel)d/pulse
2015-02-06 22:35:40 - WebIOPi - DEBUG - Mapping GPIO.outputSequence to REST 
POST /GPIO/%(channel)d/sequence/%(args)s
2015-02-06 22:35:40 - WebIOPi - DEBUG - Mapping GPIO.portRead to REST GET 
/GPIO/*/integer
2015-02-06 22:35:40 - WebIOPi - DEBUG - Mapping GPIO.portWrite to REST POST 
/GPIO/*/integer/%(value)d
2015-02-06 22:35:40 - WebIOPi - DEBUG - Mapping GPIO.pulse to REST POST 
/GPIO/%(channel)d/pulse/
2015-02-06 22:35:40 - WebIOPi - DEBUG - Mapping GPIO.pulseAngle to REST POST 
/GPIO/%(channel)d/pulseAngle/%(value)f
2015-02-06 22:35:40 - WebIOPi - DEBUG - Mapping GPIO.pulseRatio to REST POST 
/GPIO/%(channel)d/pulseRatio/%(value)f
2015-02-06 22:35:40 - WebIOPi - DEBUG - Mapping GPIO.setFunctionString to REST 
POST /GPIO/%(channel)d/function/%(value)s
2015-02-06 22:35:40 - WebIOPi - DEBUG - Mapping GPIO.wildcard to REST GET 
/GPIO/*
2015-02-06 22:35:40 - WebIOPi - INFO - GPIO - Native mapped to REST API /GPIO
2015-02-06 22:35:40 - WebIOPi - INFO - Loading configuration from 
/etc/webiopi/config
2015-02-06 22:35:40 - WebIOPi - ERROR - global name 'GPIO' is not defined
Traceback (most recent call last):
  File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/__main__.py", line 75, in <module>
    main(sys.argv)
  File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/__main__.py", line 69, in main
    server = Server(port=port, configfile=configfile, scriptfile=scriptfile)
  File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/server/__init__.py", line 52, in __init__
    self.gpio.addSetups(config.items("GPIO"))
  File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/devices/digital/gpio.py", line 62, in addSetups
    self.addGPIOSetup(gpio, params)
  File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/devices/digital/gpio.py", line 55, in addGPIOSetup
    self.addGPIO(self.gpio_setup, gpio, params)
  File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv7l.egg/webiopi/devices/digital/gpio.py", line 45, in addGPIO
    func = GPIO.OUT
NameError: global name 'GPIO' is not defined

Original issue reported on code.google.com by junquan....@gmail.com on 7 Feb 2015 at 4:39

GoogleCodeExporter commented 9 years ago
If GPIO is undefined your initial setup may have been incomplete, i.e. the 
compilation of the native C module for GPIO may have failed.

Redo setup and check if everything went through correct.

Original comment by andreas....@googlemail.com on 9 Feb 2015 at 1:48

GoogleCodeExporter commented 9 years ago
I have same issue, redo setup multiple times and it does not work.
Raspberry PI 2 is fresh Raspian installed and second thing done is install 
WebIOPi. 

Original comment by lukasz...@gmail.com on 11 Feb 2015 at 9:37

GoogleCodeExporter commented 9 years ago
I believe it's the GPIO library not compatible with Pi2 yet. Hopefully they 
will release new update soon. Finger cross! 

Original comment by junquan....@gmail.com on 11 Feb 2015 at 9:50

GoogleCodeExporter commented 9 years ago
Hi, complete Rpi newby here, but getting the exact same error - all routes seem 
to lead to an incompatibility with the new Pi?

Original comment by tallguy...@gmail.com on 14 Feb 2015 at 12:17

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
To add, I updated to RPi.GPIO 0.5.10 and still get the same issue. The error 
materializes in the verbose logging when I click any of the buttons / pins on 
the GPIO-Header page.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.2/socketserver.py", line 295, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python3.2/socketserver.py", line 321, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python3.2/socketserver.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.2/socketserver.py", line 648, in __init__
    self.handle()
  File "/usr/lib/python3.2/http/server.py", line 396, in handle
    self.handle_one_request()
  File "/usr/lib/python3.2/http/server.py", line 384, in handle_one_request
    method()
  File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.1-py3.2-linux-armv7l.egg/webiopi/protocols/http.py", line 267, in do_GET
    self.processRequest()
  File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.1-py3.2-linux-armv7l.egg/webiopi/protocols/http.py", line 258, in processRequest
    except (GPIO.InvalidDirectionException, GPIO.InvalidChannelException, GPIO.SetupException) as e:
NameError: global name 'GPIO' is not defined

Original comment by tallguy...@gmail.com on 14 Feb 2015 at 12:19

GoogleCodeExporter commented 9 years ago
I got same error on Pi2. Please help!

Original comment by emy...@gmail.com on 19 Apr 2015 at 6:08