neissa / webiopi

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

NameError: global name 'GPIO' is not defined #140

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I have downloaded it at 
:https://code.google.com/p/webiopi/wiki/DOWNLOADS?tm=2
2. I type that in a terminal :
tar xvzf WebIOPi-0.7.1.tar.gz
cd WebIOPi-0.7.1
sudo ./setup.sh
3. I have launched it : 
sudo python -m webiopi 8000
4. I connected at :
http://....:8000/app/gpio-list

WebIOPi version used?
=>0.7.1

Python version used?
=>3.2

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

Raspberry Pi board revision? (1 or 2)
=>I've got the Raspberry Pi 2

For Javascript side bugs, Browser?
=> No bug with JS

Please provide any additional information below.

I have got this error :

Exception happened during processing of request from ('192.168.0.91', 56443)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 649, in __init__
    self.handle()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
    self.handle_one_request()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
    method()
  File "/usr/local/lib/python2.7/dist-packages/WebIOPi-0.7.1-py2.7-linux-armv7l.egg/webiopi/protocols/http.py", line 267, in do_GET
    self.processRequest()
  File "/usr/local/lib/python2.7/dist-packages/WebIOPi-0.7.1-py2.7-linux-armv7l.egg/webiopi/protocols/http.py", line 264, in processRequest
    raise e
NameError: global name 'GPIO' is not defined
----------------------------------------

Original issue reported on code.google.com by MisterLo...@gmail.com on 23 Feb 2015 at 5:57

GoogleCodeExporter commented 9 years ago
Having the same issue.

Original comment by sksell on 24 Feb 2015 at 2:28

GoogleCodeExporter commented 9 years ago
WebIOPI is not working yet on Raspberry Pi 2.

There are things that You can do to change it.

You must change two files located in /python/native directory.

First change setup method in gpio.c file
Second change get_cpuinfo_revision method in cpuinfo.c

I've attached two needed files.

When you replace files in sources You must install it once again.
Then it should work on RPI 2! :)

Original comment by lukasz...@gmail.com on 24 Feb 2015 at 7:26

Attachments:

GoogleCodeExporter commented 9 years ago
I can't find /python/native where is it located ?

Original comment by MisterLo...@gmail.com on 25 Feb 2015 at 10:07

GoogleCodeExporter commented 9 years ago
it is in sources when you untar downloaded archives.

Original comment by lukasz...@gmail.com on 25 Feb 2015 at 1:07

GoogleCodeExporter commented 9 years ago
Got it working after replacing the said files.

Noticed that GPIO list shows only up to pin 26. Pins 27 to 40 is not present.

Also use RPi 2...

Original comment by aln1...@yahoo.com on 25 Feb 2015 at 1:22

GoogleCodeExporter commented 9 years ago
Do you know when the WebIOPi 0.7.2 will appear ??

Original comment by MisterLo...@gmail.com on 25 Feb 2015 at 7:57

GoogleCodeExporter commented 9 years ago
to use pins 27 to 40 you must change a lot in WebIOPi...

First You must change version.py to handle new pins.

second you must do some changes in webiopi.js 

Original comment by lukasz...@gmail.com on 25 Feb 2015 at 8:32

GoogleCodeExporter commented 9 years ago
Sorry i wasn't able to post an update earlier.

I got it to show all pins the other night by modifying the mentioned files 
(namely version.py under python/webiopi/utils folder and webiopi.js under 
htdocs folder).

Everything seems ok except that I noticed pins #29 (GPIO 5) and #31 (GPIO 6) 
were not as the same as the rest in terms of default status.

Under GPIO header, it shows that GPIO 5 has a default status of OUT,HIGH, while 
GPIO 6 has IN,HIGH.

I don't know if it means anything. Just wanted to share what I experienced. 
Thanks for the help by the way regarding the two attached files under 
python/native folder...

Original comment by aln1...@yahoo.com on 26 Feb 2015 at 11:26

GoogleCodeExporter commented 9 years ago
Can you post your modified version.py I will see what mine has for status for 5 
and 6 this weekend and report back

Original comment by sksell on 26 Feb 2015 at 11:32

GoogleCodeExporter commented 9 years ago
Alright. Here you go...

Original comment by aln1...@yahoo.com on 26 Feb 2015 at 11:51

Attachments:

GoogleCodeExporter commented 9 years ago
in my pi gpio #5 and #6 are in default state IN and HIGH signal...
there is a config file where you can change the start state of pins..
just sudo nano /etc/webiopi/config

Original comment by lukasz...@gmail.com on 26 Feb 2015 at 3:59

GoogleCodeExporter commented 9 years ago
Can someone please post the modified webiopi.js 
Thanks

Original comment by oasha...@gmail.com on 28 Feb 2015 at 6:11

GoogleCodeExporter commented 9 years ago
Thanks a lot.

It's working perfectly on my Pi2 :)

-Mikael

Original comment by mwin...@gmail.com on 28 Feb 2015 at 8:53

GoogleCodeExporter commented 9 years ago
Yes cross fingers that a new version will be released soon...
Would also be intrested in the modified webiopi.js

Thanks

Original comment by week...@googlemail.com on 28 Feb 2015 at 12:32

GoogleCodeExporter commented 9 years ago
Here as requested...

Original comment by aln1...@yahoo.com on 28 Feb 2015 at 3:09

Attachments:

GoogleCodeExporter commented 9 years ago
After replacing the two files in the source and reinstall worked for me. Thank 
you.

Original comment by sutoand...@gmail.com on 9 Mar 2015 at 9:45

GoogleCodeExporter commented 9 years ago
Thanks for posting the files. they work perfectly on my pi2.
i do also have the pins 5/6 in IN and HIGH state, but that actually doesnt 
bother me.

Original comment by DaMal...@gmail.com on 23 Mar 2015 at 8:19

GoogleCodeExporter commented 9 years ago
This worked for me too. Just to make it a little easier for the next person, 
download the above files and then, with those in your home directory, and with 
your current working directory in $HOME/WebIOPi-0.7.1, assuming you've 
extracted the sources there, the following are the mv commands to put these 
files into place:

pi@raspberrypi ~/WebIOPi-0.7.1 $ mv ../gpio.c python/native/gpio.c
pi@raspberrypi ~/WebIOPi-0.7.1 $ mv ../cpuinfo.c python/native/cpuinfo.c
pi@raspberrypi ~/WebIOPi-0.7.1 $ mv ../version.py 
python/webiopi/utils/version.py
pi@raspberrypi ~/WebIOPi-0.7.1 $ mv ../webiopi.js htdocs/webiopi.js

Adjust your paths if you've got things in different places. Then run setup.sh 
and you're good to go.

Thanks to everyone who has contributed to this - very cool!

Original comment by v...@zymsys.com on 4 Apr 2015 at 10:39

GoogleCodeExporter commented 9 years ago
Thanks this worked for me also 

Original comment by mma19712...@googlemail.com on 27 May 2015 at 10:29

GoogleCodeExporter commented 9 years ago
Hi, I followed this but I am still getting this error:

----------------------------------------
Exception happened during processing of request from ('::ffff:10.0.1.10', 
58771, 0, 0)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 655, in __init__
    self.handle()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
    self.handle_one_request()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
    method()
  File "build/bdist.linux-armv7l/egg/webiopi/protocols/http.py", line 267, in do_GET
    self.processRequest()
  File "build/bdist.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 pistiol...@gmail.com on 1 Jun 2015 at 11:02