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
Korean (unicode ?) signs in path makes tkinter fail when #613
Comments
My first thought was that maybe this is not UTF-8, some Asian encodings are not that, and that could be the issue. Your last program seems to suggest that is not the case, at least you were able to store it in a UTF-8 encoded script, is it? Something that we use on Python2, which is holy incapable of working with Unicode paths is the short path name. There is code in Nuitka which does shorten a path. I am pretty confident that would help.
|
Not sure how well that code runs on Python3 though, since Nuitka does it only to hand file names to Scons. It used to be highly problematic to be doing that, since there really is no good way to deal with unicode paths in Python2. But ever since I made that, reports from Asians were gone. Since TkInter gets its path from the short path binary directory name (this is happening in the C code of Nuitka) into the environment variable, it ought to work with Python2. Now that I realize that "Tcl" easily is not Unicode aware enough, even in Python3, then it makes sense to apply this or some other form of shortening to it. Today I wanted to check out your gift, while also day jobbing soon. But I kind of promise you to look into it. My suspect is that using that function in the module preload code of Nuitka in the TkInter will make it work for sure. My only uncertainty is if the ctypes usage above is all that correct. Sometimes it turned out the declarations were not portable. Question however is, if Nuitka ought to not go for the short path more globally, although this can cause problems on a network share. I didn't get any such reports yet, but compiling with Nuitka or running programs from there, with Python2, might give errors. I am not sure how much of a "use short path if possible" we do, or if we crash if it fails. All in all, no big thing, and thanks for breaking this down @deajan . |
So this is what I was talking about:
|
Behind host encoded, there is also a short path usage. |
And there is also this:
|
This is code that makes excplitely no use of that shorted path for Win32 for Python3. We would have to checkout these places, and try to go with short paths in what becomes path This ought to be easy. As I said, I will look into this more on Saturday if I can. |
Can do tests on rc versions whenever you request. |
I am currently stuck with my Python3, when I am compiling in this kind of sub folder, not copying the Python3 DLLs, which is strange. |
So, the not copying of the Python3 DLLs is due to a broken conditional clause that probably only works for my setup. As for the TCL, I think I got that going. However, it seems that strangely, compiling and then running in the Korean path does not work, but compiling above, moving to inside, then works, I will want to try out what that is about too. Hang on. |
Funny diff it is:
|
Ok, got that, dependency walker is to blame here, it doesn't like these kinds of paths, or my parsing is too stupid, anyway, with short paths, it works better. Merely adding I will put a test version out soon and let you know. |
Please check this out https://nuitka.net/doc/factory.html This has 3 changes. First, the loading of extension modules uses the short path of the binary directory. Second the plugins get handed the binary directory path in short path form as well. And third, before dependency walker is executed, the current directory is switched to a short path as well. As I previously mentioned, I am concerned about UNC paths and the error handling in those cases. It might not be possible to shorten there, but I don't know that for sure. And if it's not possible, we ought to not crash at least. I didn't test that yet, but I will. I think I only very recently added error handling, when I found some new use of this file name shortening. |
You didn't use the tk-inter plugin. |
Compiling inside the Korean path still led to unusable results, but compiling outside of it, and running inside did. I pushed the change to factory in the mean time, but currently it has corruptions due to lost references, so it's not usable, but I think that explains it. I will probably fix the corruptions later today and make a pre-release out of it. |
This is now on develop, and going to be part of the next release. You ought to be able to compile and/or execute in unicode paths as you wish. |
Setting the right codepage ( |
@JorjMcKie I guess so, but this behavior has changed from Nuitka 0.6.7 which hadn't that kind of output. |
These are supposed to be terminal color codes. Warnings are red. I thought this worked on Windows too, but maybe it does not. Maybe only in my git bash, but not cmd, I will have to try that out. |
Seems this needs an API call specific to Windows, or a bug using |
The trick with |
The release 0.6.8 was just made and contains the correction. |
Hello Kay,
I am progressively deploying a nuitka compiled app on 2500 computers, and had some fun with a Korean one, where the username has korean signs in it.
I've tried to reproduce that problem on my dev computer, and got to the conclusion that the app will fail with a tkinter library path error when the path contains Korean signs.
Of course, running the interpreted program in the same path works.
Could you perhaps have a look ?
0.6.7
Python: 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 18 2019, 23:46:00) [MSC v.1916 32 bit (Intel)]
Executable: c:\Python37-32\python.exe
OS: Windows
Arch: x86
what is a virtualenv ...), this is very important usually.
Installed with python -m pip install nuitka
My SSCEE:
The minimal source code:
I've compiled the program with
I've then placed both the compiled and the interpreted version in the same folder:
When I run the interpreted code I get:
When I run the compiled version I get:
Of course, running from the GUI without a cmd prompt triggers the same result.
I've then proceeded to create a second SSCEE:
Interpreted run:
Compiled run:
Of course, the TCL library is present
Since the LoadLibraryEx function is C related, I think this might not a python related problem.
@JorjMcKie could you please confirm this problem ? The korean signs can just be copy pasted from the browser.
[Update]
I managed to push investigations in a third SSCEE:
Copied the tcl and tk directories directly into the source directory so they would be present for interpreted source below:
Compiled or not, this one fails with:
[/UPDATE]
The text was updated successfully, but these errors were encountered: