Xuzheng Wang
Xuzheng Wang

Reputation: 531

exe file produced by pyinstaller cannot be used in other's PC

I have used pyinstaller to convert a python.py file to executable one. The executable file works in my computer but crashes in other's computer.I got below error message.

Failed to get ANSI buffer size <WideCharToMultiByte: parameter error
Failed to convert progname to wchar_t

What could possibly be the problem?

Upvotes: 2

Views: 813

Answers (1)

mabe02
mabe02

Reputation: 2744

On msdn of Microsoft you can find

Caution Using the WideCharToMultiByte function incorrectly can compromise the security of your application. Calling this function can easily cause a buffer overrun because the size of the input buffer indicated by lpWideCharStr equals the number of characters in the Unicode string, while the size of the output buffer indicated by lpMultiByteStr equals the number of bytes. To avoid a buffer overrun, your application must specify a buffer size appropriate for the data type the buffer receives. Data converted from UTF-16 to non-Unicode encodings is subject to data loss, because a code page might not be able to represent every character used in the specific Unicode data.

WideCharToMultiByte function

You might make sure that:

  • you are using a UTF encoding in your application
  • you are including all the ddl when you build the application (this could be another reason why it is running on your pc and not other people's)

Upvotes: 3

Related Questions