Code Monkey home page Code Monkey logo

tsl2561's People

Contributors

sim0nx avatar thefork avatar zyeoman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tsl2561's Issues

import constants error

When running the example on my RPI2 I'm getting an import error from the: from tsl2561.constants import
My error is: ImportError: No module named constants

future library

I tried to use this library in my Raspberry Pi 3 and i had to modify a file in order to work because an error concerning future imports. I made a few changes in "tsl2561/tsl2561.py", changed the first future import for "_ future _" and deleted the second import. This is how the code looks like in my local installation:

#!/usr/bin/env python
from __future__ import absolute_import, division, print_function, unicode_literals
'''Driver for the TSL2561 digital luminosity (light) sensors.

Pick one up at http://www.adafruit.com/products/439

Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!

Code ported from Adafruit Arduino library,
commit ced9f731da5095988cd66158562c2fde659e0510:
https://github.com/adafruit/Adafruit_TSL2561
'''

import time
from Adafruit_GPIO import I2Cfrom
tsl2561.constants import *  # pylint: disable=unused-wildcard-import


IOError: [Errno 5] Input/output error

When I run the provided example on my raspberry pi 3..

from tsl2561 import TSL2561 if __name__ == "__main__": tsl = TSL2561(debug=1) print tsl.lux()

I get this error...
root@stark:/home/pi# python tsl.py
Traceback (most recent call last):
File "tsl.py", line 4, in
tsl = TSL2561(debug=1)
File "build/bdist.linux-armv7l/egg/tsl2561/tsl2561.py", line 50, in init
File "build/bdist.linux-armv7l/egg/tsl2561/tsl2561.py", line 57, in _begin
File "build/bdist.linux-armv7l/egg/Adafruit_GPIO/I2C.py", line 148, in readU8
File "build/bdist.linux-armv7l/egg/Adafruit_PureIO/smbus.py", line 155, in read_byte_data
IOError: [Errno 5] Input/output error

Any ideas? I have I2C enabled.

root@stark:/home/pi# i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Example code import does not work in Python3

$ python3
Python 3.6.1 (default, Mar 21 2017, 21:49:16)
[GCC 5.4.0] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from tsl2561 import TSL2561
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'TSL2561'

I believe the following does work:

from tsl2561.tsl2561 import TSL2561

I'm not sure, but maybe a tweak to __init__.py would make this work in both Python 2 and 3?

installing pip gives errors!

pip installation gives me following error.

Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 295, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1436, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 672, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 902, in move_wheel_files
    pycompile=self.pycompile,
  File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 214, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 204, in clobber
    os.makedirs(destdir)
  File "/usr/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/tsl2561-3.1.dist-info'

Storing debug log for failure in /home/pi/.pip/pip.log
pi@raspberrypi:~/tsl2561 $ pip install tsl2561
Downloading/unpacking tsl2561
  Downloading tsl2561-3.1-py2.py3-none-any.whl
Installing collected packages: tsl2561
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 295, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1436, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 672, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 902, in move_wheel_files
    pycompile=self.pycompile,
  File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 214, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 204, in clobber
    os.makedirs(destdir)
  File "/usr/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/tsl2561-3.1.dist-info'

Storing debug log for failure in /home/pi/.pip/pip.log

Cloned installation gives me;

Runtime error with tsl2561 library

Hi,

I just installed the tsl2561 library. The install appeared to be fine, but when I triy to run the following script:

#!/usr/bin/python
from tsl2561 import TSL2561
sensor = TSL2561()

I get

rpiw$ ./lux.py
Traceback (most recent call last):
File "./lux.py", line 5, in
sensor = TSL2561()
File "build/bdist.linux-armv6l/egg/tsl2561/tsl2561.py", line 65, in init
File "build/bdist.linux-armv6l/egg/tsl2561/tsl2561.py", line 79, in _begin
File "build/bdist.linux-armv6l/egg/tsl2561/tsl2561.py", line 129, in set_integration_time
File "build/bdist.linux-armv6l/egg/tsl2561/tsl2561.py", line 88, in enable
File "build/bdist.linux-armv6l/egg/Adafruit_GPIO/I2C.py", line 114, in write8
File "build/bdist.linux-armv6l/egg/Adafruit_PureIO/smbus.py", line 236, in write_byte_data
IOError: [Errno 121] Remote I/O error

Any chance you see what's wrong? I'm running this on a raspberry pi with

rpiw$ uname -a
Linux rpiw 4.9.24+ #993 Wed Apr 26 17:56:54 BST 2017 armv6l GNU/Linux

Apologies if this is the wrong place to bring this up, but I couldn't find a forum.

Pip version

The version in PYPI is still broken due to the bug I reported a few hours ago. Are you planing to upload it again in order to be able to install it via pip?

I2C update

Library doesn't work with current I2C micropython implementation.
AttributeError: 'I2C' object has no attribute...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.