glenn20 / mp-image-tool-esp32

Tool for manipulating MicroPython esp32 image files.
MIT License
14 stars 0 forks source link

TypeError: unsupported operand type(s) for |: 'type' and 'type' #2

Closed amplatzer closed 1 day ago

amplatzer commented 4 months ago

./mp-image-tool-esp32 -h Traceback (most recent call last): File "/Users/xx/Downloads/github/mp-image-tool-esp32/./mp-image-tool-esp32", line 7, in import src.mp_image_tool_esp32.main File "/Users/xx/Downloads/github/mp-image-tool-esp32/src/mp_image_tool_esp32/main.py", line 22, in from . import image_device, image_file, layouts, ota_update, parse_args File "/Users/xx/Downloads/github/mp-image-tool-esp32/src/mp_image_tool_esp32/image_file.py", line 52, in ByteString = bytes | bytearray | memoryview TypeError: unsupported operand type(s) for |: 'type' and 'type'

python 3.9

Lemenxzy commented 3 months ago

I also encountered the same problem

Python version 3.8.2

glenn20 commented 3 months ago

Ah, thanks for the bug report. There are clearly lines of my code dependent on the newer typing features of python 3.10+. I will look into a fix.

gampam2000 commented 1 month ago

i have similar errors, how can I fix this?

glenn20 commented 1 month ago

The current version requires python 3.10+ (3.10 has been out for nearly 3 years now ;). Unfortunately I havent been able to backport it to earlier versions yet (job is mostly done - I think, but not tested). I have just pushed that work to the dev branch (not fully tested yet): https://github.com/glenn20/mp-image-tool-esp32/tree/dev.

gampam2000 commented 1 month ago

Yes with python 3.10 it works. I still run Ubunut 20.04, i installed it that way:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.10-venv python3.10-dev python3.10-distutils
python3.10 -m ensurepip --upgrade
python3.10 -m pip install --upgrade pip
python3.10 -m pip install tqdm

python3.10 mp-image-tool-esp32 firmware.bin

glenn20 commented 4 weeks ago

I have pushed some updates to the main branch and incremented the version number to 0.0.2.

v0.0.2

I will leave this issue open foir a few weeks. Please test and let me know if there are still issues.

Apologies for the slow response.. life and getting a proper test suite in place diverted me from this work for longer than expected.

glenn20 commented 1 day ago

Closing as it appears to be resolved with v0.0.2. Thanks for raising the issue.