Python __file__ variable returns 'encoding error' -


so script in folder contains cyrillic symbols in path , __file__

variabale returns "encoding error" instead of real path.

adding following line doesnt help

# -*- coding: cp1252 -*-

what should do?

version of python 3.3

i'm not sure if answers question, but...

in python3 __file__ holds current running script , path str. *nix systems use binary filenames , have no preference particular encoding. when use __file__ system attempt take binary string , encode string using default encoding system. i'm wondering if maybe filenames in cp1252 , python trying interpret utf8.

python may follow convention outlined here when encoding __file__: http://docs.python.org/2/library/sys.html#sys.getfilesystemencoding

you didn't state os you're using, though...


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -