ファイルを開こうとしていますが、py がユーザー名に問題があることに気付きました (ロシア語です)。アイドルを幸せにするためにこれを適切にデコード/エンコードする方法に関する提案はありますか?
私はpy 2.6.5を使用しています
xmlfile = open(u"D:\\Users\\Эрик\\Downloads\\temp.xml", "r")
Traceback (most recent call last):
File "<pyshell#23>", line 1, in <module>
xmlfile = open(str(u"D:\\Users\\Эрик\\Downloads\\temp.xml"), "r")
UnicodeEncodeError: 'ascii' codec can't encode characters in position 9-12: ordinal not in range(128)
os.sys.getfilesystemencoding() 'mbcs'
xmlfile = open(u"D:\Users\Эрик\Downloads\temp.xml".encode("mbcs"), "r")
トレースバック (最新の呼び出しが最後): ファイル ""、1 行目、xmlfile = open(u"D:\Users\Эрик\Downloads\temp.xml".encode("mbcs"), "r") IOError: [ Errno 22] 無効なモード ('r') またはファイル名: 'D:\Users\Y?ee\Downloads\temp.xml'