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

Crash during unitest #268

Open
mtribiere opened this issue Feb 29, 2024 · 3 comments
Open

Crash during unitest #268

mtribiere opened this issue Feb 29, 2024 · 3 comments
Labels
only on windows Happens on Windows OS only

Comments

@mtribiere
Copy link

I use this library in a project, and use the CMake/Ninja combo to unittest it.
On Linux no issues, but on Windows I have a crash. Probalby some issues with the Powershell encoding.
Thanks for your help.


Environment:

  • Windows 10
  • Python 3.12.0
  • CMake/Ninja combo

Log:

ERROR: test_md5_sums_valid (tests.test_cesam.TestCesamDownloadFolder.test_md5_sums_valid)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Program Files\Python312\Lib\unittest\mock.py", line 1387, in patched
    return func(*newargs, **newkeywargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Tools\DEV\libcesam\tests\test_cesam.py", line 666, in test_md5_sums_valid
    test_folder = cesam.download_folder(test_folder)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Tools\DEV\libcesam\libcesam\cesam.py", line 246, in download_folder
    with alive_bar(len(["test"])) as bar:
  File "C:\Program Files\Python312\Lib\contextlib.py", line 144, in __exit__
    next(self.gen)
  File "C:\Tools\DEV\libcesam\venv\Lib\site-packages\alive_progress\core\progress.py", line 364, in __alive_bar
    alive_repr()
  File "C:\Tools\DEV\libcesam\venv\Lib\site-packages\alive_progress\core\progress.py", line 165, in alive_repr
    run.last_len = print_cells(fragments, term.cols(), term, run.last_len)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Tools\DEV\libcesam\venv\Lib\site-packages\alive_progress\utils\cells.py", line 109, in print_cells
    term.write(join_cells(fragment))
  File "C:\Program Files\Python312\Lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'charmap' codec can't encode characters in position 1-2: character maps to <undefined>
@rsalmei
Copy link
Owner

rsalmei commented Mar 5, 2024

That's unfortunate, I know. But sadly, I don't know what to do to circumvent these weird windows incompatibilities...
I'd say perhaps you could try WSL2. Since it is a linux environment it should work flawlessly.
If everything else fails, I think you'd have to use both the classic bar and spinner, since they only use ASCII characters.

@rsalmei rsalmei added the only on windows Happens on Windows OS only label Mar 5, 2024
@ThomasByr

This comment was marked as off-topic.

@rsalmei
Copy link
Owner

rsalmei commented Apr 1, 2024

Thanks @ThomasByr, but I think the unicode "breaks" tool has nothing to do with it since it is not used on the alive_bar impl at all.

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

No branches or pull requests

3 participants