Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File encoding errors on Windows #63

Closed
phyto opened this issue Sep 24, 2024 · 2 comments
Closed

File encoding errors on Windows #63

phyto opened this issue Sep 24, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@phyto
Copy link

phyto commented Sep 24, 2024

Hi Moshi4,
Just to let you know that I got an error message when trying to use 1.4.0 on Windows. I installed using pip install pygenomeviz, everything went fine, but I got the following error message when importing pygenomeviz :

Traceback (most recent call last):
File "C:\Users\XXX\YYY.py", line 11, in
from pygenomeviz import GenomeViz
File "C:\Users\XXX\AppData\Local\Programs\Python\Python312\Lib\site-packages\pygenomeviz_init_.py", line 3, in
from pygenomeviz.genomeviz import GenomeViz
File "C:\Users\XXX\AppData\Local\Programs\Python\Python312\Lib\site-packages\pygenomeviz\genomeviz.py", line 27, in
from pygenomeviz.viewer import setup_viewer_html
File "C:\Users\XXX\AppData\Local\Programs\Python\Python312\Lib\site-packages\pygenomeviz\viewer_init_.py", line 41, in
JS_CONTENTS = _concat_target_files_contents(assets_files, ".js")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\XXX\AppData\Local\Programs\Python\Python312\Lib\site-packages\pygenomeviz\viewer_init
.py", line 18, in _concat_target_files_contents
contents += f.read() + "\n"
^^^^^^^^
File "C:\Users\XXX\AppData\Local\Programs\Python\Python312\Lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 5743: character maps to

I reverted to version 1.1.0 and everything is fine, but I thought it was better to let you know about this.
Thank you again for this great package!

@moshi4
Copy link
Owner

moshi4 commented Sep 25, 2024

Try changing Python default encoding to UTF-8 by setting the environment variable PYTHONUTF8=1.
This will probably fix the error, but it is a bit strange that there is a difference in behavior between v1.1.0 and v1.4.0.

@phyto
Copy link
Author

phyto commented Sep 25, 2024

Yes, this fixed the error. Thank you!

@moshi4 moshi4 mentioned this issue Sep 26, 2024
@moshi4 moshi4 added the bug Something isn't working label Sep 26, 2024
@moshi4 moshi4 changed the title Issue on Windows for version 1.4.0? File encoding errors on Windows Sep 26, 2024
@moshi4 moshi4 closed this as completed Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants