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

'Failed to execute script pyiboot01_bootstrap' for windows account name 'teşt' #2754

Closed
brian-a-clark opened this Issue Aug 21, 2017 · 9 comments

Comments

Projects
None yet
3 participants
@brian-a-clark

brian-a-clark commented Aug 21, 2017

PyInstaller: 3.2.1
Python: 2.7.13
OS: Windows 10

When I run my pyinstaller-packaged product on a windows machine with a local account name 'teşt' (that's 'test' but instead of a regular 's' it's a U+015F [http://www.fileformat.info/info/unicode/char/015f/index.htm]), the binaries fail to extract, with error message 'Failed to execute script pyiboot01_bootstrap'.

It looks like what is happening is this: The temp path is retrieved at

GetTempPathW(PATH_MAX, wchar_buffer);

GetTempNameW returns C:\Users\teşt\AppData\Local\Temp (i.e., it includes the unicode character)

Running in debug mode, I can see that it prints out the utf-8 version of the string with the multibyte character displayed as a two characters (unicode code point 015F => utf-8: C5 9F), so most debug message boxes show C:\Users\teÅŸt\AppData\Local\Temp_MEIxxxxx

Later, at

if (!pyi_win32_utf8_to_mbs_sfn(pyhome, status->mainpath, PATH_MAX)) {

the path gets converted to ANSI. The conversion to ANSI strips the cedilla off the 'ş' making it a plain 's', and the resulting path points to a temp directory that does not exist. This, I think, is what leads to the error.

I would have thought that the conversion to SFN should have made it c:\Users\TET~1\AppData\Local\Temp (which is the short name that works at the command prompt). But that doesn't seem to be the case.

Have you seen this before? If not, are you able to repro it? A user reported it to me, and I was able to repro on my windows machine.

It can be worked around by having the user create a new temp directory without the 'ş' and update their TMP environment variable. But the "Failed to execute script pyiboot01_bootstrap" is such a nebulous message that the user would never guess that workaround on their own and would have to contact me and then be able to follow instructions to change an env variable.

@brian-a-clark

This comment has been minimized.

brian-a-clark commented Aug 21, 2017

I said they "fail to extract". That's might not be accurate. Maybe it just doesn't run. I shouldn't have written that.

@htgoebel

This comment has been minimized.

Member

htgoebel commented Aug 21, 2017

@AndCycle can you please have a look at this, you last worked on this topic around 95d33e4. Thanks.

@ghost

This comment has been minimized.

ghost commented Aug 22, 2017

This one is super easy. Just add GetShortPathName right after GetTempPathW to replace the path and the problem should be resolved.

@htgoebel

This comment has been minimized.

Member

htgoebel commented Aug 22, 2017

@xoviat @brian-a-clark If one would provide a pull-request within about the next week, this will go into release 3.3.

@ghost

This comment has been minimized.

ghost commented Aug 24, 2017

@brian-a-clark you will need to upgrade to Python 3 to resolve this issue.

@AndCycle

This comment has been minimized.

Contributor

AndCycle commented Aug 24, 2017

@htgoebel really busy recently, hard to make some free time,

and yup, using Python 3 do resolve many unicode related issue,
but there are other issue on Python 3 currently not solved,

as Py 3.5 and above have Universal CRT lib issue,
the only choice here is Py 3.4

@ghost

This comment has been minimized.

ghost commented Aug 28, 2017

the only choice here is Py 3.4

Is there a problem with Python 3.4? And after some investigation by @codewarrior0 (much thanks) this problem may not be fixable.

@ghost

This comment has been minimized.

ghost commented Sep 4, 2017

Python 2 does not support Unicode paths, and some Unicode paths on Windows may not have an ANSI equivalent. This issue is not fixable.

@ghost ghost closed this Sep 4, 2017

@ghost ghost added won't fix and removed pull-request wanted labels Sep 4, 2017

@AndCycle

This comment has been minimized.

Contributor

AndCycle commented Sep 4, 2017

@xoviat oops, probably can raise the bar to 3.5, Universal CRT is use in 3.6?

py2 do support unicode path, if you pass unicode string into os.path, it return unicode as you expect,
but there are some pit fall hide in there,
that's why there are sys.setdefaultencoding hack floating around,

in short, py2 do support unicode path, but require extreme attention around everywhere, which doesn't worth it.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment