python-intelhex / intelhex

Python IntelHex library
BSD 3-Clause "New" or "Revised" License
201 stars 107 forks source link

hexdiff.py not working on Ubuntu 19.10 #38

Closed superbonaci closed 4 years ago

superbonaci commented 4 years ago

hexdiff.py version 2.2.1

adams@ubuntu:/mnt/f$ pip install intelhex
Requirement already satisfied: intelhex in /home/adams/.local/lib/python2.7/site-packages (2.2.1)
adams@ubuntu:/mnt/f$ python hexdiff.py device1.raw device2.raw 
Traceback (most recent call last):
  File "hexdiff.py", line 90, in <module>
    sys.exit(main())
  File "hexdiff.py", line 84, in main
    ih1 = IntelHex(fname1)
  File "/home/adams/.local/lib/python2.7/site-packages/intelhex/__init__.py", line 90, in __init__
    self.loadhex(source)
  File "/home/adams/.local/lib/python2.7/site-packages/intelhex/__init__.py", line 212, in loadhex
    decode(s, line)
  File "/home/adams/.local/lib/python2.7/site-packages/intelhex/__init__.py", line 123, in _decode_record
    raise HexRecordError(line=line)
intelhex.HexRecordError: Hex file contains invalid record at line 1
adams@ubuntu:/mnt/f$ python
python              python2.7           python2-config      python3.7           python3-futurize    python3-pasteurize  python-config       
python2             python2.7-config    python3             python3.7m          python3m            python3-wsdump 
adams@ubuntu:/mnt/f$ python3.7 hexdiff.py device1.raw device2.raw
Traceback (most recent call last):
  File "hexdiff.py", line 90, in <module>
    sys.exit(main())
  File "hexdiff.py", line 83, in main
    from intelhex import IntelHex, diff_dumps
ModuleNotFoundError: No module named 'intelhex'
benfre commented 4 years ago

What is in the first line of these to files? To use with python3, you need install intelhex with pip3.

superbonaci commented 4 years ago

Those files are images from block devices.

The-42 commented 4 years ago

Python 2.7 has reached end-of-life, please try to reproduce this with Python 3 (see above)

superbonaci commented 4 years ago

With pip3:

pip3 install intelhex
Collecting intelhex
  Using cached https://files.pythonhosted.org/packages/bf/77/bf670318b3db325c71e2ac6a90b7bcfdf9fc739b7cf6aebb31715721623e/intelhex-2.2.1-py2.py3-none-any.whl
Installing collected packages: intelhex
Successfully installed intelhex-2.2.1
superbonaci commented 4 years ago

Still fails:

python3 --version
Python 3.7.5
python3 hexdiff.py device1.raw device2.raw
Traceback (most recent call last):
  File "hexdiff.py", line 90, in <module>
    sys.exit(main())
  File "hexdiff.py", line 84, in main
    ih1 = IntelHex(fname1)
  File "/home/adams/.local/lib/python3.7/site-packages/intelhex/__init__.py", line 90, in __init__
    self.loadhex(source)
  File "/home/adams/.local/lib/python3.7/site-packages/intelhex/__init__.py", line 212, in loadhex
    decode(s, line)
  File "/home/adams/.local/lib/python3.7/site-packages/intelhex/__init__.py", line 123, in _decode_record
    raise HexRecordError(line=line)
intelhex.HexRecordError: Hex file contains invalid record at line 1
bialix commented 4 years ago

I don't think raw files are IntelHex files. Probably you want to see files differences? This utility hexdiff.py is intended to be used with IntelHex files (file extension .hex).

чт, 23 апр. 2020 г. в 00:04, superbonaci notifications@github.com:

Still fails:

python3 hexdiff.py device1.raw device2.raw Traceback (most recent call last): File "hexdiff.py", line 90, in sys.exit(main()) File "hexdiff.py", line 84, in main ih1 = IntelHex(fname1) File "/home/adams/.local/lib/python3.7/site-packages/intelhex/init.py", line 90, in init self.loadhex(source) File "/home/adams/.local/lib/python3.7/site-packages/intelhex/init.py", line 212, in loadhex decode(s, line) File "/home/adams/.local/lib/python3.7/site-packages/intelhex/init.py", line 123, in _decode_record raise HexRecordError(line=line) intelhex.HexRecordError: Hex file contains invalid record at line 1

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/python-intelhex/intelhex/issues/38#issuecomment-618039779, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAUIG4Y3BKP5IEP6NEZBSTRN5LWPANCNFSM4MNO7SFA .

superbonaci commented 4 years ago

No, my files are not IntelHex files. I thought the script was general purpose. Thanks for clarification.