NatLee / HEIC2PNG

Convert format of HEIC image to PNG by using Python.
https://pypi.org/project/HEIC2PNG/
MIT License
23 stars 1 forks source link

Error with can't set attribute 'mode' #2

Closed lucajovine closed 10 months ago

lucajovine commented 11 months ago

Worked fine until a few days ago, but now:

----- Input file path is ./IMG_4393.HEIC ----- Error with can't set attribute 'mode' ----- Please report this issue!

This is with version 1.0.1, installed on Mac OS 13.5.2 using conda's 23.10.0 python -m pip heic2png .

NatLee commented 11 months ago

Hi Luca!

You can update this package to the latest version 1.1.3.

python -m pip install -U heic2png

And try it again.

lucajovine commented 11 months ago

Oh thank you! Odd that conda did not apply the update automatically though...

lucajovine commented 10 months ago

Uhm, updating to 1.1.3 does not seem to solve the issue:

heic2png -i ./IMG_4410.HEIC -o IMG_4410.png -q 100 -w HEIC2PNG v1.1.3 Processing the HEIC image at ./IMG_4410.HEIC Specified output path: IMG_4410.png

==== HEIC2PNG Options ====

Input file path: ./IMG_4410.HEIC Output file path: IMG_4410.png Quality: 100 Overwrite: True

An unexpected error occurred: can't set attribute 'mode' Please report this issue with details of the error.

NatLee commented 10 months ago

Hi Luca,

Thank you so much for bringing this issue.

Would it be possible for you to test with other .heic files as well? If you encounter the same problem, could you kindly upload a sample image for examining?

Please ensure that the image doesn't contain any private information; a completely black image would be ideal.

Your cooperation is invaluable as it will help me in reproducing this bug. 😊

Looking forward to your response.

lucajovine commented 10 months ago

Yes, it happens on every file I try. Here's a sample file that gives the same error on my system! IMG_4443.HEIC.zip

NatLee commented 10 months ago

Thank you But I cannot download it πŸ‘€

lucajovine commented 10 months ago

Yes not sure why. UI won't accept .HEIC files:

We don’t support that file type.

Try again with GIF, JPEG, JPG, MOV, MP4, PNG, SVG, WEBM, CPUPROFILE, CSV, DMP, DOCX, FODG, FODP, FODS, FODT, GZ, JSON, JSONC, LOG, MD, ODF, ODG, ODP, ODS, ODT, PATCH, PDF, PPTX, TGZ, TXT, XLS, XLSX or ZIP.

...so I tried zipping it as that should be supported.

NatLee commented 10 months ago

Try this service https://fastupload.io/en

lucajovine commented 10 months ago

Try again from above, maybe it was just slow... .zip file seems to be available now.

NatLee commented 10 months ago

Okay, I got the zip file Let me check the problem :)

NatLee commented 10 months ago

Wired. πŸ€”

I have no problem with my device with the same command.

- Intel i7-12700
- Windows 11
- conda 4.10.3
- python 3.9.5

image

I also try on other device.

- Intel i5-1235P
- Ubuntu 22.04.3 LTS
- conda 23.5.0
- python 3.10.11

image

lucajovine commented 10 months ago

This is on Mac OS 13.5.2 (on an Apple M2 Max), with conda 23.10.0 and python 3.10.12

NatLee commented 10 months ago

Thank you!

I am aware of your system specifications, but my Mac is not currently with me. I can only test using other devices for now.

My current suspicion is that the issue may be caused by the versions of other dependent packages. Could you please use pip freeze to provide the versions of the packages you're using?

I will help you with the testing once I have access to a macOS environment.

lucajovine commented 10 months ago

aiofiles==22.1.0 aiosqlite==0.19.0 anyio==3.6.2 appnope==0.1.3 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 arrow==1.2.3 asttokens==2.2.1 attrdict==2.0.1 attrs==23.1.0 Babel==2.12.1 backcall==0.2.0 beautifulsoup4==4.12.2 biopython==1.81 bleach==6.0.0 Brotli==1.0.9 certifi==2022.12.7 cffi==1.15.1 charset-normalizer==3.1.0 collections-extended==2.0.2 comm==0.1.3 contourpy==1.1.0 cycler==0.11.0 debugpy==1.6.7 decorator==5.1.1 defusedxml==0.7.1 docutils @ file:///private/tmp/docutils-20231015-5350-1xd6hrn/docutils-0.20.1 entrypoints==0.4 executing==1.2.0 fastjsonschema==2.16.3 fonttools==4.42.1 fqdn==1.5.1 gemmi==0.6.1 idna==3.4 iniconfig==2.0.0 ipykernel==6.23.0 ipython==8.13.2 ipython-genutils==0.2.0 isoduration==20.11.0 jedi==0.18.2 Jinja2==3.1.2 json5==0.9.14 jsonpointer==2.3 jsonschema==4.17.3 jupyter-events==0.6.3 jupyter-server==1.24.0 jupyter-ydoc==0.2.4 jupyter_client==7.4.1 jupyter_core==5.3.0 jupyter_server_fileid==0.9.0 jupyter_server_terminals==0.4.4 jupyter_server_ydoc==0.8.0 jupyterlab==3.6.3 jupyterlab-pygments==0.2.2 jupyterlab_server==2.22.1 kiwisolver==1.4.5 libxml2-python @ file:///private/tmp/libxml2-20231009-5487-1ii5umg/libxml2-2.11.5/python MarkupSafe==2.1.2 matplotlib==3.7.2 matplotlib-inline==0.1.6 mistune==2.0.5 modelcraft==3.3.0 mutagen==1.46.0 nbclassic==1.0.0 nbclient==0.7.4 nbconvert==7.4.0 nbformat==5.8.0 nest-asyncio==1.5.6 nose==1.3.7 notebook==6.5.4 notebook_shim==0.2.3 numpy==1.24.3 packaging==23.1 pandas==2.0.1 pandocfilters==1.5.0 parso==0.8.3 pexpect==4.8.0 pickleshare==0.7.5 Pillow @ file:///private/tmp/pillow-20231015-7803-8opflx/Pillow-10.1.0 platformdirs==3.5.1 pluggy==1.0.0 pooch==1.7.0 prometheus-client==0.16.0 prompt-toolkit==3.0.38 protobuf==4.25.1 psutil==5.9.5 ptyprocess==0.7.0 pure-eval==0.2.2 pybind11==2.11.1 pycparser==2.21 pycryptodomex==3.17 Pygments @ file:///private/tmp/pygments-20231008-5407-1u4v80i/Pygments-2.16.1 pyparsing==3.0.9 PyQt3D==5.15.6 PyQt5==5.15.10 PyQt5-sip==12.13.0 PyQt6==6.5.0 PyQt6-Qt6==6.5.0 PyQt6-sip==13.5.1 PyQtChart==5.15.6 PyQtDataVisualization==5.15.5 PyQtNetworkAuth==5.15.5 PyQtPurchasing==5.15.5 PyQtWebEngine==5.15.6 pyrsistent==0.19.3 pytest==7.3.1 python-dateutil==2.8.2 python-json-logger==2.0.7 pytz==2023.3 PyYAML==6.0 pyzmq==25.0.2 qtconsole==5.4.3 QtPy==2.3.1 reportlab==4.0.6 requests==2.31.0 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 scipy==1.10.1 Send2Trash==1.8.2 six==1.16.0 sniffio==1.3.0 soupsieve==2.4.1 stack-data==0.6.2 tabulate @ file:///private/tmp/python-tabulate-20231113-17078-1g28b0w/tabulate-0.9.0 terminado==0.17.1 tinycss2==1.2.1 tk==0.1.0 tornado==6.3.2 traitlets==5.9.0 tzdata==2023.3 uri-template==1.2.0 urllib3==2.1.0 voila==0.4.0 wcwidth==0.2.6 webcolors==1.13 webencodings==0.5.1 websocket-client==1.5.1 websockets==11.0.2 wxPython==4.2.1 y-py==0.5.9 ypy-websocket==0.8.2 yt-dlp==2023.11.16

NatLee commented 10 months ago

I've successfully run it on my Mac without any problems.

Here are the spec of my system:

M1 Pro
MacOS Sonoma 14.1.1
conda 23.5.0
python 3.10.13

Additionally, I followed the requirements you provided and executed them accordingly.

Based on this, I would recommend trying to reinstall the pillow library, specifically version 10.1.0 from PyPI.

You can do this using the following commands:

pip uninstall pillow && pip install pillow==10.1.0

After reinstalling pillow, proceed with installing the heic2png package using this command:

pip install -U heic2png

This should potentially resolve the issue you're encountering. Let me know how it goes!

lucajovine commented 10 months ago

Yes, reinstalling pillow fixed the issue - thank you!!!