Error local variable 'data' referenced before assignment
Closed this issue · 1 comments
deblockt commented
I try to use rfxtrx on Home assistant and .i have this error.
Send: 0x0d 0x00 0x00 0x01 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Exception in thread Thread-22:
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/usr/lib/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "/home/thomas/homeassistant/lib/python3.5/site-packages/RFXtrx/__init__.py", line 705, in _connect
self.transport.reset()
File "/home/thomas/homeassistant/lib/python3.5/site-packages/RFXtrx/__init__.py", line 640, in reset
return self.receive_blocking()
File "/home/thomas/homeassistant/lib/python3.5/site-packages/RFXtrx/__init__.py", line 613, in receive_blocking
if not data or data == '\x00':
UnboundLocalError: local variable 'data' referenced before assignment
my python version is 3.5.3.
this error append on if not data or data == '\x00':
on line 621 on file __init__.py
.
the if not not work if there are an exception on try
. To fix it localy I have add
data = False
before the Try
Danielhiversen commented
It seems that you use an old version of pyRFXtrx. This should be fixed in the latest version.
Edit: Added another line to make sure it can not happen again: #69