Jul-10-2020, 02:28 PM
Hello,
I code on the idle python version 3.8.3 and I receive this error message "OSError: exception: access violation reading 0x00000004"
that does not manage to resolve I went through all the functions in the imported library and I find not "canopenchannel" I think it is hidden and I do not have access
for information I use windows 7 professional.
Traceback (most recent call last):
File "D:\Esss.py", line 25, in <module>
ch0 = setUpChannel(0)
File "D:\Esss.py", line 8, in setUpChannel
ch = canlib.openChannel(0,openFlags)
File "D:\Softs\lib\site-packages\canlib\canlib\channel.py", line 58, in openChannel
ch = Channel(channel, flags)
File "D:\Softs\lib\site-packages\canlib\canlib\channel.py", line 120, in __init__
self.handle = dll.canOpenChannel(channel_number, flags)
OSError: exception: access violation reading 0x00000004
>>>
I code on the idle python version 3.8.3 and I receive this error message "OSError: exception: access violation reading 0x00000004"



for information I use windows 7 professional.
from canlib import canlib, Frame from canlib.canlib import ChannelData def setUpChannel(channel=0, openFlags=canlib.canOPEN_ACCEPT_VIRTUAL, bitrate=canlib.canBITRATE_500K, bitrateFlags=canlib.canDRIVER_NORMAL): ch = canlib.openChannel(channel, openFlags) print("Using channel: %s, EAN: %s" % (ChannelData(channel).device_name, ChannelData(channel).card_upc_no) ) ch.setBusOutputControl(bitrateFlags) ch.setBusParams(bitrate) ch.busOn() return ch def tearDownChannel(ch): ch.busOff() ch.close() print("canlib version:", canlib.dllversion()) ch0 = setUpChannel(channel=0) ch1 = setUpChannel(channel=1) frame = Frame(id_=100, data=[1, 2, 3, 4], flags=canlib.canMSG_EXT) ch1.write(frame) while True: try: frame = ch0.read() print(frame) break except (canlib.canNoMsg) as ex: pass except (canlib.canError) as ex: print(ex) tearDownChannel(ch0) tearDownChannel(ch1)error:
Traceback (most recent call last):
File "D:\Esss.py", line 25, in <module>
ch0 = setUpChannel(0)
File "D:\Esss.py", line 8, in setUpChannel
ch = canlib.openChannel(0,openFlags)
File "D:\Softs\lib\site-packages\canlib\canlib\channel.py", line 58, in openChannel
ch = Channel(channel, flags)
File "D:\Softs\lib\site-packages\canlib\canlib\channel.py", line 120, in __init__
self.handle = dll.canOpenChannel(channel_number, flags)
OSError: exception: access violation reading 0x00000004
>>>