-
Notifications
You must be signed in to change notification settings - Fork 32
Description
I am not sure if this is an issue, i am very new to classes and as such i apologies if this is a really simple question.
I am trying to read values from the SMbus python module, when i run it inside the class i get a bad descriptor error. If i run it outside the class it works fine, but i need to be able to call it withing the main program...
This is the error:
File "powertracker.py", line 100, in
daemon_runner.do_action()
File "/usr/lib/pymodules/python2.7/daemon/runner.py", line 186, in do_action
func(self)
File "/usr/lib/pymodules/python2.7/daemon/runner.py", line 131, in _start
self.app.run()
File "powertracker.py", line 80, in run
amps = selfed.read_ain()
File "powertracker.py", line 61, in read_ain
bus.write_byte(0x48, 0)
File "/usr/local/lib/python2.7/dist-packages/smbus_cffi-0.5.1-py2.7-linux-armv
return fn(*args, **kwdefaults)
File "/usr/local/lib/python2.7/dist-packages/smbus_cffi-0.5.1-py2.7-linux-armv
self._set_addr(addr)
File "/usr/local/lib/python2.7/dist-packages/smbus_cffi-0.5.1-py2.7-linux-armv
ioctl(self._fd, SMBUS.I2C_SLAVE, addr)
IOError: [Errno 9] Bad file descriptor