Originally reported by: Mathias Giacomuzzi (Bitbucket: mgiaco, GitHub: mgiaco)
Hello,
I tried to read back a message. So I tried:
#!python
from __future__ import print_function
from time import sleep
import can
TIMEOUT = 30
def send_one():
bus = can.interface.Bus(bitrate=250000)
msg = can.Message(arbitration_id=0x2,
data=[1, 0, 0, 0, 0, 0, 0, 0],
extended_id=False)
try:
can.Notifier(bus, [can.Printer()])
bus.send(msg)
print("Message sent on {}".format(bus.channel_info))
except can.CanError:
print("Message NOT sent")
if __name__ == "__main__":
send_one()
sleep(5)
So I attached a sniffer and I get a message back but I get this error:
#!python
Exception in thread Thread-1:
Traceback (most recent call last):
File "c:\python27\Lib\threading.py", line 801, in __bootstrap_inner
self.run()
File "c:\python27\Lib\threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "C:\Users\lwngim1\Envs\py27_pycan\lib\site-packages\python_can-1.5.0-py2.7.egg\can\notifier.py", line 35, in rx_thread
callback(msg)
File "C:\Users\lwngim1\Envs\py27_pycan\lib\site-packages\python_can-1.5.0-py2.7.egg\can\CAN.py", line 43, in __call__
return self.on_message_received(msg)
File "C:\Users\lwngim1\Envs\py27_pycan\lib\site-packages\python_can-1.5.0-py2.7.egg\can\CAN.py", line 90, in on_message_received
print(msg)
File "C:\Users\lwngim1\Envs\py27_pycan\lib\site-packages\python_can-1.5.0-py2.7.egg\can\message.py", line 73, in __str__
if (self.data is not None) and (self.data.isalnum()):
AttributeError: 'c_ubyte_Array_8' object has no attribute 'isalnum'
Exception AttributeError: "'NoneType' object has no attribute 'write'" in <bound method Printer.__del__ of <can.CAN.Printer object at 0x0000000002963080>> ignored
Process finished with exit code 0
Originally reported by: Mathias Giacomuzzi (Bitbucket: mgiaco, GitHub: mgiaco)
Hello,
I tried to read back a message. So I tried:
So I attached a sniffer and I get a message back but I get this error:
Is it possible that this is a python2.7 problem?
thx