hacklab-in / webiopi

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

AttributeError: ‘module’ object has no attribute ‘GPIO’ #97

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1- download release 0.7.9 source code
2- perform install through : sudo ./setup.sh
3- run old project that was using version 0.6.2

The upgrade / installation finished successfully .. when I tried to run the 
project I was working on I got this weird error:

WebIOPi version used?
=> 0.7.0

Python version used?
=> 2.7.6

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

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

For Javascript side bugs, Browser?
=> No

Please provide any additional information below.

when running the server: sudo webiopi -c /etc/webiopi/config -d

Traceback (most recent call last):
File “build/bdist.linux-armv6l/egg/webiopi/__main__.py”, line 75, in
main(sys.argv)
File “build/bdist.linux-armv6l/egg/webiopi/__main__.py”, line 69, in main
server = Server(port=port, configfile=configfile, scriptfile=scriptfile)
File “build/bdist.linux-armv6l/egg/webiopi/server/__init__.py”, line 75, in 
__init__
loader.loadScript(name, source, self.restHandler)
File “build/bdist.linux-armv6l/egg/webiopi/utils/loader.py”, line 8, in 
loadScript
script = imp.load_source(name, source)
File “/home/pi/webio/python/script.py”, line 7, in
GPIO = webiopi.GPIO
AttributeError: ‘module’ object has no attribute ‘GPIO’

Original issue reported on code.google.com by isale...@gmail.com on 18 Apr 2014 at 8:54

GoogleCodeExporter commented 9 years ago
Module structure has slightly been reorganized from 0.6.2 to 0.7.0 release. For 
that, 0.6.2 custom Python server scripts don't run eventuelly properly due to 
module import errors. Please look at the 0.7.0 server script examples and adapt 
your script (nainly imports) to the changed module structures and then it will 
run again.

Original comment by andreas....@googlemail.com on 23 Apr 2014 at 7:46

GoogleCodeExporter commented 9 years ago
Actually .. I used the exact server script on the site (0.7.0) .. 

Original comment by isale...@gmail.com on 26 Apr 2014 at 11:05

GoogleCodeExporter commented 9 years ago
Are you sure that the compiling of the native C interface module of WebIOPi for 
the native GPIO ports really succeeded? It looks like that is missing for some 
reason.
Maybe your Distro is missing the gcc or something else went wrong.

Re-run the setup script and watch out for errors when compiling the native C 
code parts.

Original comment by andreas....@googlemail.com on 30 Apr 2014 at 1:29

GoogleCodeExporter commented 9 years ago
I had this issue and found a fix after hours of installing/unistalling webiopi

cd 
/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv61.egg/_web
iopi/

In this directory I was missing the file __init__.py
if you are missing it too, create it in nano and add the line:
__import__("pkg_resources").declare_namespace(__name__)

save and exit and try running your webiopi again.

Original comment by harrybro...@gmail.com on 2 May 2014 at 1:26

GoogleCodeExporter commented 9 years ago
note the double underscores, kinda looks like just one to me but they are 
doubles 

Original comment by harrybro...@gmail.com on 2 May 2014 at 1:28

GoogleCodeExporter commented 9 years ago
I'm still getting this issue, is there any workaround to solve it? I have 
checked the specified path by Harry and I have the file right in place with the 
corresponding code but still when trying to import it into my custom python 
script I'm getting that error.

Original comment by Alex.Szi...@gmail.com on 9 Jun 2014 at 11:19

GoogleCodeExporter commented 9 years ago
In the end managed to solve it by reinstall the OS and Webiopi :)

Original comment by Alex.Szi...@gmail.com on 10 Jun 2014 at 3:03

GoogleCodeExporter commented 9 years ago
I'm experiencing this as well, not sure what is going wrong. Is it possible to 
force webiopi to use specific python version?

Original comment by Christof...@gmail.com on 13 Nov 2014 at 10:30

GoogleCodeExporter commented 9 years ago
I'm having the same error (see issue #130).

Original comment by istva...@gmail.com on 13 Dec 2014 at 5:27

GoogleCodeExporter commented 9 years ago
I have the same problem anyone know how to fix it

Original comment by alveo...@gmail.com on 6 Jan 2015 at 7:41

GoogleCodeExporter commented 9 years ago
raspberry pi2 same error !!

Original comment by giancap...@gmail.com on 9 Mar 2015 at 9:43