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?
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.
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.
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.