Accented path issue

Hello! I’m having an issue with accented path (special characters) in python (I’m working on Windows (no problem on Linux)): (To download .rar, click on File>download or Fichier>télécharger)

As you can see in this file, you can update the texture of the cube if the path of the texture does not contain any accented characters, but it does not work with accented path.

Is there some python harcoder here who can tell me how to solve the problem? :slight_smile:

Thank you very much!!!

Windows has much more restrictive file path restrictions. It doesn’t like underscores, full stops, asterisks and so on.
The only solution I know is simply to only use alphanumeric characters.

I suggest to avoid non-ascii characters in your path.

Obviously it is a problem of the OS (otherwise it would not work on Linux either).

Thanks for the answers! The problem is I can’t avoid non ascii characters in all existant paths of my computer! I found a workaround but it is dirty. I don’t know why but I can copy a texture with accented path to another non accented path with shutils. Then, if the texture name is accented, I can rename it. So I can now refresh the texture, and delete the copy I made.

Someone else have another solution? Thank you!!

Forgive me if I’m being stupid, but why not? Are you trying to load textures from all over your computer? Or do you mean the texture is in a series of folders that all have accented characters in their paths?

I’m trying to load textures from all over my computer (cf my .blend in the first post). It works, but when you are on windows, and when the name of the texture OR the path of the texture contains non-ascii characters, it does not work…

Paths should be relative to your games blend “always.”
So create a folder for your game, create a subfolder called ‘textures’ and put your images in there.

I don’t want to make a game :). I just want to make a script to open a file dialog box in Windows, select a texture with accented name or path, and load it in the game engine!! Apparently it is not possible… Anyway, thank you for your answer!

Have you tried maybe using a raw string or something? Try posting for help somewhere on a general Python forum or StackOverflow, or on the Python IRC channel.