Skip to content

UnicodeDecodeError: #3

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

Closed
francisco-lafe opened this issue Mar 22, 2023 · 8 comments
Closed

UnicodeDecodeError: #3

francisco-lafe opened this issue Mar 22, 2023 · 8 comments

Comments

@francisco-lafe
Copy link

francisco-lafe commented Mar 22, 2023

Running powershell, on Windows 10.
Python 3.11.2
Did all the steps, when running the .exe file, it throws this error:
Tried cmd, powershell 5 and powershell 7
image

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\francisco.laferriere\pythonclub\textual_apps\Scripts\regexexercises.exe\__main__.py", line 7, in <module>
  File "C:\Users\francisco.laferriere\pythonclub\textual_apps\Lib\site-packages\regexexercises\pyregex_exercises.py", line 341, in main
    app = PyRegexExercises()
          ^^^^^^^^^^^^^^^^^^
  File "C:\Users\francisco.laferriere\pythonclub\textual_apps\Lib\site-packages\regexexercises\pyregex_exercises.py", line 83, in __init__
    self.m_view = MarkdownViewer(f.read(), show_table_of_contents=False)
                                 ^^^^^^^^
  File "C:\Users\francisco.laferriere\AppData\Local\Programs\Python\Python311\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 0x90 in position 3649: character maps to <undefined>
@learnbyexample
Copy link
Owner

Thanks for the bug report.

I don't have Windows, but I think the issue is due to file encoding. I have now added encoding='UTF-8' to all file operations.

Can you check if the updated code works for you? Try pip install --upgrade regexexercises to get the new version, or try a fresh install.

@francisco-lafe
Copy link
Author

Hi, it launched and it looks like this:
image

@francisco-lafe
Copy link
Author

One thing I've noticed is that it does not let me input text.
I guess we're going to be facing a challenge on windows.
By the way, the instructions here: https://github.com/learnbyexample/TUI-apps/tree/main/PyRegexExercises
mention $ source bin/activate but the folder is called "scripts" instead of "bin".
is that also windows environment only?

@learnbyexample
Copy link
Owner

learnbyexample commented Mar 23, 2023

  • Input text - can you clarify what you are observing? Are you not able to use mouse to click within the input box and type text? What happens if you press Enter to execute?
  • Yeah, I think you have to execute Scripts/activate.bat on Windows instead of source bin/activate

Are you using Windows Terminal or some other application? I've heard Windows Terminal works well.

If issues persist, I think you might have better experience by using WSL (https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux)

@francisco-lafe
Copy link
Author

  • Input text - can you clarify what you are observing? Are you not able to use mouse to click within the input box and type text? What happens if you press Enter to execute?
  • Yeah, I think you have to execute Scripts/activate.bat on Windows instead of source bin/activate

Hi, basically the console is stuck, it doesn't let me move things. this was using PS5 and regexexercises.exe
BUT, after running regexexercises without exe on the same PS5. It let me move the cursor around and start typing.

The culprit of the behavior where it stops working is that if I switch windows, say I open the browser, and then I get back to the console, it gets stuck and unresponsive.

If issues persist, I think you might have better experience by using WSL

Sadly, on the environment we are working, having WSL is not allowed.

@learnbyexample
Copy link
Owner

learnbyexample commented Mar 23, 2023

Thanks for the report, I'll try to get help from someone tomorrow regarding running on Windows.

Can you give the exact name of the terminal application you are running? Or better yet, copy paste the output of textual diagnose? Also, can you try Windows Terminal if you haven't yet and let me know if it works any better?

@francisco-lafe
Copy link
Author

francisco-lafe commented Mar 23, 2023

I think windows terminal is just a wrapper.
But... It works! And it looks better!
You were right, it is far better than the alternatives!

image

Great suggestion, I would add it to the instructions.

Here's the equivalent commands for windows:

python -m venv textual_apps
cd ./textual_apps
. ./Scripts/activate.ps1
pip install regexexercises
#launch the app
regexexercises

@learnbyexample
Copy link
Owner

Thanks, I've added a note referring to this issue.

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

No branches or pull requests

2 participants