[Python]Encoding and execfile
Question: I am trying to do something like that using python 2.4:

    
    
    #!/usr/bin/python
    # -*- coding: utf-8 -*-
    
    afile = unicode('C:\\國立國語院.py', 'UTF-8')
    execfile(afile.encode("UTF-8",'replace'))
    

And I receive this error:

    
    
    IOError: [Errno 2] No such file or directory: 'C:\\\xef\xbb\xbf\xe5\x9c\x8b\xe7\xab\x8b\xe5\x9c\x8b\xe8\xaa\x9e\xe9\x99\xa2.py'
    

So my question is how can I do an execfile if the file I want to exec have a
name with Korean chars?

Thank you very much


Answer: I think you should just be able to do `execfile(afile)` with a unicode
argument on Windows, but I can't test it.

If not, get the file system encoding:

    
    
    import sys
    fsenc = sys.getfilesystemencoding()
    execfile(afile.encode(fsenc))
    

