python-wifi-leds icon indicating copy to clipboard operation
python-wifi-leds copied to clipboard

error running script

Open avenantsoftware opened this issue 10 years ago • 7 comments

I have this python script:

!/usr/bin/env python

import wifileds

led_connection = wifileds.limitlessled.connect('192.168.2.10', 8899)

led_connection.rgbw.zone_on(1)

wich gives this error:

AttributeError: 'module' object has no attribute 'limitlessled'

Am I misisng something in the above code?

avenantsoftware avatar Aug 13 '14 11:08 avenantsoftware

That should have worked:

https://github.com/joaquincasares/python-wifi-leds/blob/master/tests/limitlessled.py#L128

How did you install the package? Try cloning the repo and placing your sample file in the root directory and try again. Perhaps I messed up in the actual packaging process.

joaquincasares avatar Aug 13 '14 14:08 joaquincasares

I installed the python module as instructed:

pip install wifileds

etc...

when i run from terminal: locate wifileds

the files are installed because it returns:

/usr/local/lib/python2.7/dist-packages/wifileds /usr/local/lib/python2.7/dist-packages/wifileds-1.0.6.egg-info /usr/local/lib/python2.7/dist-packages/wifileds/init.py /usr/local/lib/python2.7/dist-packages/wifileds/init.pyc /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/README.md /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/init.py /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/init.pyc /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/bridge.py /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/bridge.pyc /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/effects /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/rgb.py /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/rgb.pyc /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/rgbw.py /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/rgbw.pyc /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/white.py /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/white.pyc /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/effects/init.py /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/effects/init.pyc /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/effects/colorful_strobe.py /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/effects/colorful_strobe.pyc /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/effects/fade_down.py /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/effects/fade_down.pyc /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/effects/fade_up.py /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/effects/fade_up.pyc /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/effects/police_flashers.py /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/effects/police_flashers.pyc /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/effects/pulsating_swells.py /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/effects/pulsating_swells.pyc /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/effects/rainbow_fade.py /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/effects/rainbow_fade.pyc /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/effects/strobe.py /usr/local/lib/python2.7/dist-packages/wifileds/limitlessled/effects/strobe.pyc /usr/local/lib/python2.7/dist-packages/wifileds-1.0.6.egg-info/PKG-INFO /usr/local/lib/python2.7/dist-packages/wifileds-1.0.6.egg-info/SOURCES.txt /usr/local/lib/python2.7/dist-packages/wifileds-1.0.6.egg-info/dependency_links.txt /usr/local/lib/python2.7/dist-packages/wifileds-1.0.6.egg-info/installed-files.txt /usr/local/lib/python2.7/dist-packages/wifileds-1.0.6.egg-info/top_level.txt

avenantsoftware avatar Aug 13 '14 14:08 avenantsoftware

What's the exact stacktrace you get when you try to run your code?

Also, did running it in the folder work?

joaquincasares avatar Aug 13 '14 15:08 joaquincasares

Traceback (most recent call last): File "wifileds.py", line 2, in import wifileds File "/home/htpc/Hue/wifileds.py", line 4, in led_connection = wifileds.limitlessled.connect('192.168.2.10', 8899) AttributeError: 'module' object has no attribute 'limitlessled'

if the module was not installed correctly, python would give more errors, it only has a problem with the limitlessled part in the code, as if it was not defined

what do you mean by running it from the folder? do there have to be more files in the folder I run the script from, besides that the module is installed?

avenantsoftware avatar Aug 13 '14 15:08 avenantsoftware

In the meantime, try cloning this repo and running your sample script from the repo's root directory. Let me know if that works for you please.

joaquincasares avatar Aug 13 '14 17:08 joaquincasares

yeah that works

avenantsoftware avatar Aug 13 '14 17:08 avenantsoftware

Hey Guys - I am facing the same issue as spambus got above: 'module' object has no attribute 'limitlessled'

How did you guys fixed it? Also, what do you mean by running the sample script from repo's root directory? I tried running tests\limitless.py from multiple locations, and it always seem to fail.

TheGitLife avatar Sep 22 '14 08:09 TheGitLife