-
Notifications
You must be signed in to change notification settings - Fork 616
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
character mapping issue from vispy.gloo.gl._constants #2386
Comments
I am not an expert on text encoding and how Python chooses one or the other, but my understanding was that Python would default to UTF-8. It is also my understanding based on: That CP1252 (the module doing the complaining about the encoding) should match UTF-8 for all ASCII characters. If I read the file on my machine, everything is telling me it is entirely ASCII. This leads me to believe the file somehow got corrupted on the users system. I think this could be tested by doing:
I believe this reads the file as if it was on-disk as cp1252. When I do this locally it loads fine. I would expect a ValueError if any of the file was non-ASCII and/or non-CP1252 compatible. I don't get an error. |
Update: Looks like Python |
Awesome, thank you kindly @djhoese. |
Keep us updated if the user lets you know if their issue has been resolved. |
Hi @djhoese, I am currently experiencing the same issue as OP. Specifically, |
@h-westmacott Great! (that we have someone who can test, not that you're having trouble) What do you get when you run
Other questions that come to mind:
|
Happy to be able to help! I'm working on a windows machine, and this issue occurs when I try to run any napari commands from python script or the terminal. resulst included below:
|
How do you feel about hacking your vispy installation? If you can find the vispy/vispy/gloo/gl/_constants.py Line 330 in c52c481
That says I guess I assume doing |
Adding in the print statement before line 330 adds the following to the terminal output before the traceback:
|
🤦♂️ Thanks. For the print out output, does the traceback say the |
One more hack:
If it is the |
Yes, the
Following the extra hack, the console outputs:
|
Ok so now, create a test module in your current directory named
And do |
I should have said this earlier, but regardless of what the cause of this error is we can definitely simplify this for loop and avoid unimportant things in the globals dictionary (things prefixed with |
Wild idea...does your username have non-ASCII characters in it? |
The check_builtins.py file raises the same error:
No non-ASCII in my username, no. |
Ok so we've removed vispy from the equation. So that part of And you can see where this is used here: We know from the error message that the problem is only with one of the If that fails, then could you find the LICENSE (or LICENSE.txt) file in your
|
Oh or the license file could be in your current directory or your parent directory. |
Scratch the parent directory idea, but I do think it can be a license file in your current directory. And you don't need to guess you could just edit the check script to do And I'm a little confused because at least in the current main branch of CPython the license file is read as UTF-8: So why is cp1252.py being used. |
Ah I bet this is a bug that was fixed in Python 3.10. Here is the open line in Python 3.9: And in Python 3.10: An encoding was added. |
I had this issue on Windows, reproduced by: Running with the "-X utf8" flag fixed the error here and in a broader napari/vispy call: |
Thanks @Charles-Fieseler-Vienna. I'll add my suggested fix from #1330. If someone wants to make a PR to fix it that would be greatly appreciated: I think a good solution might be the following: ENUM_MAP = {}
for var_name, ob in list(globals().items()):
if var_name.startswith('GL_'):
ENUM_MAP[int(ob)] = ob
del ob, var_name This has the added benefit that we don't even try Lines 117 to 123 in c52c481
As the |
It looks like there is a character encoding issue in vispy that is happening in this bug report, please correct me if I am wrong.
https://forum.image.sc/t/try-to-load-napari-library-from-stardist-napari-dock-widget-import-surface-from-polys-and-failed-like-bellow-any-help-would-be-more-than-welcome/71524
The text was updated successfully, but these errors were encountered: