1

I'm trying to create a folder on My Documents in Windows. I managed to do it, but only for O.S using latin alphabet, but not for cyrilic or kanji, for example. I'm using python 3.7.

This is my code

def rutdir(file):
    if system() == 'Windows':
        cuser = getuser()
        rmod = 'C:\\Users\\' + cuser + '\\Documents\\folder\\data\\'
    elif system() == 'Linux':
        rmod = '/var/games/folder/data/'
    rutaf = rmod + file
    return rutaf   

"rutaf" is working on english, spanish... but not in kanji or cyrilic. How can i define the route 'C:\Users\' + cuser + '\Documents\folder\data\' to be readable by all locale?

Thanks.

Calvarez
  • 35
  • 5
  • 1
    Does this answer your question? [Finding the user's "My Documents" path](https://stackoverflow.com/questions/6227590/finding-the-users-my-documents-path) – Sumner Evans Mar 16 '21 at 23:35
  • Mmm i think no, because the purpose of that question is to solve changes on user account. I have managed to solve it with "getuser". My problem is with the locale. For example, in a cyrilic O.S C:\\Documents would be C:\\Документы, but, my route is declared as C:\\Documents, in latin alphabet, so, when my program crash when is opened on a machine using an O.S in cyrilic or other alphabet, because it is not capable to find the folder "Documents". – Calvarez Mar 17 '21 at 23:31
  • I must reconsider my last comment. The solution given is working. Thanks. – Calvarez Jun 01 '21 at 19:27

0 Answers0