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

Encoding in util.py #396

Merged
merged 1 commit into from
Sep 2, 2024
Merged

Encoding in util.py #396

merged 1 commit into from
Sep 2, 2024

Conversation

Allain18
Copy link
Contributor

@Allain18 Allain18 commented Sep 2, 2024

When calling apio upload on Windows 10 for a TinyFPGA-BX, I get a UnicodeDecodeError, but the upload is still a success.

With the correct encoding, I get the loading bar during upload.

Tested only with a TinyFPGA-BX on Windows 10 and Linux.

Without the fix
---------------------------------------------------------------------------------------------------------------------------------------------tinyprog --pyserial -c COM4 --program hardware.bin

TinyProg CLI
------------
Using device id 1d50:6130
Programming COM4 with hardware.bin
Programming at addr 028000
Waking up SPI flash
135100 bytes to program
Exception in thread Thread-6:
Traceback (most recent call last):
  File "C:\Program Files\Python312\Lib\threading.py", line 1075, in _bootstrap_inner
    self.run()
  File "C:\Users\super\.icestudio\venv\Lib\site-packages\apio\util.py", line 88, in run
    for line in iter(self._pipe_reader.readline, ""):
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\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 0x8d in position 27: character maps to <undefined>
Success!

======================================================== [SUCCESS] Took 2.48 seconds ========================================================
With the fix
---------------------------------------------------------------------------------------------------------------------------------------------tinyprog --pyserial -c COM4 --program hardware.bin

TinyProg CLI
------------
Using device id 1d50:6130
Programming COM4 with hardware.bin
Programming at addr 028000
Waking up SPI flash
135100 bytes to program
Erasing: 100%|██████████| 135k/135k [00:00<00:00, 188kB/s]
Writing: 100%|██████████| 135k/135k [00:00<00:00, 194kB/s]
Success!
Reading:  98%|█████████▊| 133k/135k [00:00<00:00, 437kB/s]
Reading: 100%|██████████| 135k/135k [00:00<00:00, 437kB/s]
======================================================== [SUCCESS] Took 2.44 seconds ========================================================

@Allain18
Copy link
Contributor Author

Allain18 commented Sep 2, 2024

Seems to be a bug with my venv, I created a new venv and it works now.

@Allain18 Allain18 closed this Sep 2, 2024
@Allain18
Copy link
Contributor Author

Allain18 commented Sep 2, 2024

Update, it seems to be a problem with the terminal in VSCode, feel free to merge or close

@Allain18 Allain18 reopened this Sep 2, 2024
@Obijuan Obijuan merged commit 67d7cc5 into FPGAwars:develop Sep 2, 2024
@Obijuan
Copy link
Member

Obijuan commented Sep 2, 2024

Thanks for the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants