intrepidcs / python_ics

Library for interfacing with Intrepid devices in Python
MIT License
61 stars 29 forks source link

Fatal Python error: deallocating None #178

Open zesoo opened 3 months ago

zesoo commented 3 months ago

There is a fatal error when I execute ./examples/transmit_canfd_example.py in WIN10 environment.

Message #414 NetID: 0x1 ArbID: 0x243 Data: ['0x48', '0x0', '0x1', '0x0', '0x0', '0x28', '0x26', '0x47'] Message #415 NetID: 0x1 ArbID: 0x533 Data: ['0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0'] Fatal Python error: deallocating None Python runtime state: initialized

Current thread 0x00000c1c (most recent call first): File ".\transmit_canfd_example.py", line 115 in receive_can File ".\transmit_canfd_example.py", line 132 in Message #416

How can I fix it?

drebbe-intrepid commented 3 months ago

@zesoo Can you provide me details of the following:

  1. Python Version (3.11)
  2. Python architecture (32-bit or 64-bit)
  3. python_ics version (914.x)
  4. icsneo40.dll version (3.9.x.x)
  5. Intrepid hardware in use (ValueCAN4-2, FIRE2, etc.)
zesoo commented 3 months ago

@zesoo Can you provide me details of the following:

  1. Python Version (3.11)
  2. Python architecture (32-bit or 64-bit)
  3. python_ics version (914.x)
  4. icsneo40.dll version (3.9.x.x)
  5. Intrepid hardware in use (ValueCAN4-2, FIRE2, etc.)
  1. python 3.8.10
  2. 64bit
  3. python-ics 914.14.post1
  4. how can I get this version?
  5. ValueCAN4-2
drebbe-intrepid commented 3 months ago

@zesoo C:\Windows\System32\icsneo40.dll is the typical location. You can right click on it and go to properties to grab the version information.

zesoo commented 3 months ago

@zesoo C:\Windows\System32\icsneo40.dll is the typical location. You can right click on it and go to properties to grab the version information.

The version is:3.9.15.14

drebbe-intrepid commented 2 months ago

@zesoo Thank you, I'm looking at it now to see if I can reproduce it.

drebbe-intrepid commented 2 months ago

@zesoo I can't reproduce this here but it looks like its crashing due to use of ExtraDataPtr (It shouldn't). Whatever Message #416 is, is creating the crash.

Can you change line 115 that reads this:

data = m.Data if not m.ExtraDataPtr else m.ExtraDataPtr

to this:

data = m.Data if not m.ExtraDataPtrEnabled else m.ExtraDataPtr

please and report back?

python .\examples\transmit_canfd_example.py
Found 2 connected device(s)...
Opening Device ValueCAN 4-2 V20673 (Open Client handles: 0)...
Opened Device ValueCAN 4-2 V20673.
Opening Device neoVI FIRE 3 ON0390 (Open Client handles: 0)...
Opened Device neoVI FIRE 3 ON0390.
================================================================================
Transmitted Messages on ValueCAN 4-2 V20673
================================================================================
Message #1      NetID: 0x1      ArbID: 0x1      Data: ['0x0', '0x1', '0x2', '0x3', '0x4', '0x5', '0x6', '0x7', '0x8', '0x9', '0xa', '0xb', '0xc', '0xd', '0xe', '0xf', '0x10', '0x11', '0x12', '0x13', '0x14', '0x15', '0x16', '0x17', '0x18', '0x19', '0x1a', '0x1b', '0x1c', '0x1d', '0x1e', '0x1f', '0x20', '0x21', '0x22', '0x23', '0x24', '0x25', '0x26', '0x27', '0x28', '0x29', '0x2a', '0x2b', '0x2c', '0x2d', '0x2e', '0x2f', '0x30', '0x31', '0x32', '0x33', '0x34', '0x35', '0x36', '0x37', '0x38', '0x39', '0x3a', '0x3b', '0x3c', '0x3d', '0x3e', '0x3f']      Errors Present: False

================================================================================
Received Messages on neoVI FIRE 3 ON0390
================================================================================
Received 4 messages with 0 errors.
Message #1      NetID: 0x0      ArbID: 0x162    Data: ['0x1', '0x2', '0x1', '0x5d', '0x0', '0xff']
Message #2      NetID: 0x0      ArbID: 0x162    Data: ['0x0', '0x0', '0x0', '0x8', '0x2', '0xff']
Message #3      NetID: 0x0      ArbID: 0x162    Data: ['0x0', '0x0', '0x0', '0xc', '0x2', '0xff']
Message #4      NetID: 0x216    ArbID: 0x1      Data: ['0x0', '0x1', '0x2', '0x3', '0x4', '0x5', '0x6', '0x7', '0x8', '0x9', '0xa', '0xb', '0xc', '0xd', '0xe', '0xf', '0x10', '0x11', '0x12', '0x13', '0x14', '0x15', '0x16', '0x17', '0x18', '0x19', '0x1a', '0x1b', '0x1c', '0x1d', '0x1e', '0x1f', '0x20', '0x21', '0x22', '0x23', '0x24', '0x25', '0x26', '0x27', '0x28', '0x29', '0x2a', '0x2b', '0x2c', '0x2d', '0x2e', '0x2f', '0x30', '0x31', '0x32', '0x33', '0x34', '0x35', '0x36', '0x37', '0x38', '0x39', '0x3a', '0x3b', '0x3c', '0x3d', '0x3e', '0x3f']
Finished.
zesoo commented 2 months ago

@zesoo I can't reproduce this here but it looks like its crashing due to use of ExtraDataPtr (It shouldn't). Whatever Message #416 is, is creating the crash.

Can you change line 115 that reads this:

data = m.Data if not m.ExtraDataPtr else m.ExtraDataPtr

to this:

data = m.Data if not m.ExtraDataPtrEnabled else m.ExtraDataPtr

please and report back?

python .\examples\transmit_canfd_example.py
Found 2 connected device(s)...
Opening Device ValueCAN 4-2 V20673 (Open Client handles: 0)...
Opened Device ValueCAN 4-2 V20673.
Opening Device neoVI FIRE 3 ON0390 (Open Client handles: 0)...
Opened Device neoVI FIRE 3 ON0390.
================================================================================
Transmitted Messages on ValueCAN 4-2 V20673
================================================================================
Message #1      NetID: 0x1      ArbID: 0x1      Data: ['0x0', '0x1', '0x2', '0x3', '0x4', '0x5', '0x6', '0x7', '0x8', '0x9', '0xa', '0xb', '0xc', '0xd', '0xe', '0xf', '0x10', '0x11', '0x12', '0x13', '0x14', '0x15', '0x16', '0x17', '0x18', '0x19', '0x1a', '0x1b', '0x1c', '0x1d', '0x1e', '0x1f', '0x20', '0x21', '0x22', '0x23', '0x24', '0x25', '0x26', '0x27', '0x28', '0x29', '0x2a', '0x2b', '0x2c', '0x2d', '0x2e', '0x2f', '0x30', '0x31', '0x32', '0x33', '0x34', '0x35', '0x36', '0x37', '0x38', '0x39', '0x3a', '0x3b', '0x3c', '0x3d', '0x3e', '0x3f']      Errors Present: False

================================================================================
Received Messages on neoVI FIRE 3 ON0390
================================================================================
Received 4 messages with 0 errors.
Message #1      NetID: 0x0      ArbID: 0x162    Data: ['0x1', '0x2', '0x1', '0x5d', '0x0', '0xff']
Message #2      NetID: 0x0      ArbID: 0x162    Data: ['0x0', '0x0', '0x0', '0x8', '0x2', '0xff']
Message #3      NetID: 0x0      ArbID: 0x162    Data: ['0x0', '0x0', '0x0', '0xc', '0x2', '0xff']
Message #4      NetID: 0x216    ArbID: 0x1      Data: ['0x0', '0x1', '0x2', '0x3', '0x4', '0x5', '0x6', '0x7', '0x8', '0x9', '0xa', '0xb', '0xc', '0xd', '0xe', '0xf', '0x10', '0x11', '0x12', '0x13', '0x14', '0x15', '0x16', '0x17', '0x18', '0x19', '0x1a', '0x1b', '0x1c', '0x1d', '0x1e', '0x1f', '0x20', '0x21', '0x22', '0x23', '0x24', '0x25', '0x26', '0x27', '0x28', '0x29', '0x2a', '0x2b', '0x2c', '0x2d', '0x2e', '0x2f', '0x30', '0x31', '0x32', '0x33', '0x34', '0x35', '0x36', '0x37', '0x38', '0x39', '0x3a', '0x3b', '0x3c', '0x3d', '0x3e', '0x3f']
Finished.
zesoo commented 2 months ago

@drebbe-intrepid Thanks a lot,it worked,I wondering how to get the exact timestamp of the message.

 timeHw=m.TimeHardware|m.TimeHardware2<<32
 timeSys=m.TimeSystem|m.TimeSystem2<<32
drebbe-intrepid commented 2 months ago

@drebbe-intrepid Thanks a lot,it worked,I wondering how to get the exact timestamp of the message.

 timeHw=m.TimeHardware|m.TimeHardware2<<32
 timeSys=m.TimeSystem|m.TimeSystem2<<32

try this:

https://python-ics.readthedocs.io/en/master/index.html#ics.ics.get_timestamp_for_msg

drebbe-intrepid commented 2 months ago

Also you can keep this open, I'll update the examples to resolve this issue.

zesoo commented 2 months ago

@drebbe-intrepid Thanks a lot,it worked,I wondering how to get the exact timestamp of the message.

 timeHw=m.TimeHardware|m.TimeHardware2<<32
 timeSys=m.TimeSystem|m.TimeSystem2<<32

try this:

https://python-ics.readthedocs.io/en/master/index.html#ics.ics.get_timestamp_for_msg

HI: I use the API get_timestamp_for_msg to get timestamp,

ts=ics.get_timestamp_for_msg(device,m)

but the result was 37 years off from the actual value.

================================================================================
Received Messages on ValueCAN 4-2 V2B290
================================================================================
Received 95 messages with 0 errors.
Msg:#1 Ts:550056817.0359169 NetID: 0x1  ArbID: 0x175    Data: ['0xff', '0xff', '0xff', '0xff', '0xff', '0xfe', '0x1', '0x0']
Msg:#2 Ts:550056817.0369124 NetID: 0x1  ArbID: 0x101    Data: ['0x8d', '0xa8', '0x7', '0x11', '0x42', '0x7c', '0xd9', '0xd4']
Msg:#3 Ts:550056817.0382698 NetID: 0x1  ArbID: 0x310    Data: ['0x55', '0x95', '0xa1', '0xa', '0x91', '0x41', '0x1e', '0xa5']
Msg:#4 Ts:550056817.0386523 NetID: 0x1  ArbID: 0x107    Data: ['0x75', '0x30', '0x75', '0x30', '0x0', '0x0', '0x0', '0x0']
drebbe-intrepid commented 2 months ago

@zesoo sorry for the late reply, ValueCAN4-2 doesn't have a battery for the RTC so you need to set the RTC when you open. See https://python-ics.readthedocs.io/en/master/index.html#ics.ics.set_rtc

drebbe-intrepid commented 2 months ago

Also the intrepid epoch is 1-1-2007.