Ho-Ro / Hantek6022API

Hantek 6022BE Python API for Windows and Linux.
https://ho-ro.github.io/Hantek6022API/
Other
98 stars 15 forks source link

calibrate_6022.py fails with python 3.9 #10

Closed hosh0r closed 4 years ago

hosh0r commented 4 years ago

Apparently tostring for array.array was removed with python 3.9: https://docs.python.org/3.9/whatsnew/3.9.html#removed

Hantek6022API/examples$ python3 calibrate_6022.py 
Traceback (most recent call last):
  File "/Users/martin/Documents/200_projekte/Hantek6022API/examples/calibrate_6022.py", line 21, in <module>
    from PyHT6022.LibUsbScope import Oscilloscope
  File "/usr/local/lib/python3.9/site-packages/Python_Hantek_6022BE_Wrapper-0.0.2-py3.9.egg/PyHT6022/LibUsbScope.py", line 12, in <module>
    from PyHT6022.Firmware import dso6022be_firmware, dso6022bl_firmware, fx2_ihex_to_control_packets
  File "/usr/local/lib/python3.9/site-packages/Python_Hantek_6022BE_Wrapper-0.0.2-py3.9.egg/PyHT6022/Firmware/__init__.py", line 41, in <module>
    stock_firmware = fx2_ihex_to_control_packets(os.path.join(base_path, 'stock', 'stock_fw.ihex'))
  File "/usr/local/lib/python3.9/site-packages/Python_Hantek_6022BE_Wrapper-0.0.2-py3.9.egg/PyHT6022/Firmware/__init__.py", line 30, in fx2_ihex_to_control_packets
    packets.append(FirmwareControlPacket(record_len, addr, array.array('B', record_data).tostring()))
AttributeError: 'array.array' object has no attribute 'tostring'