#103 Cannot run exe file from localized directory name


In US Windows, the default locale, and filesystem encoding will be MBCS (Windows 1252) however, 2K/XP/Vista use Unicode internally for the filesystem, allowing for characters not available in the locale to be used.

Py2exe will not allow any exe files installed into these directories to be run giving an error "LoadLibrary(pythondll) failed. The specified file could not be found. C:\?????\python25.dll"

Where ????? was a directory name in Russian.

To reproduce: Create a py2exe .exe file, and place it in a directory containing characters not in your locale.

Potential Solution: Use windows wide functions when accessing the filesystem.

Associated problem, can't run python setup.py py2exe from within such a directory: error: could not create 'C:\?????': The filename, directory name, or volume label syntax is incorrect

Ran into this problem with people attempting to run software from their desktop, when logged in under a non-english username.


  • Thomas Heller

    Thomas Heller - 2007-08-14

    Logged In: YES
    Originator: NO

    This is not a problem of py2exe alone (as you can see that even 'python setup.py py2exe' does not work in such a directory.

    The real problem is that Python converts all sys.path entries to 8-bit strings internally, and that these paths cannot be represented in the locale.

    IIRC, there is a workoround: In control panel -> regional and language options -> advanced, set the language for 'non-unicode programs' to Russian.

    BTW: last time I checked, other programs had problems too when running from directories that have (for example) chinese characters in them running on an english or german windows installation (acrobat reader, for example). Although that is no excuse, of course.

  • Thomas Heller

    Thomas Heller - 2008-06-18
    • status: open --> closed-wont-fix

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks