After spending the weekend with these issues I might report my findings.
- LibLoad or anything else using expandPath won’t find files if the full path includes non-ascii characters. Luckily I found this that had the following code to encode/decode the path.
import os filepath_bytes = os.fsencode(expandPath("path")) filepath_utf8 = filepath_bytes.decode('utf-8', "replace")
After feeding this to LibLoad things appear to work.
- For the Python controller using external module I’ve found no solution. Even if I put the file in the same directory as the .blend, the module isn’t found if there are non-ascii characters in the full path. This must suck major time for some people who use non-ascii more like the Eastern world. I know Monster has documented a way to add a custom python search path (Linked Python Folder doesn’t work either sadly, it’s what I was hoping to use) but I really think there should be something I can do to make this approach work as well.
Why these two issues? Linking .blend files work just fine with non-ascii paths and I assume it’s because they use relative path where the path is expanded internally in a way that accounts for non-ascii working directory path. Why can’t this nicely working path expanding also apply to expandPath, LibLoad (provide option to use relative path so you don’t need expandPath) and python module lookup?
The point is of course not to keep the game project where I want to but to make the distributed game in a way that has no special requirements for the path. I just stumbled upon the matter since I happen to have some non-ascii letters in the path to my game projects directory. I take non-ascii very seriously and usually avoid it but here I really felt like I needed to use them and I was under the assumption this day and age would be prepared for it.
Or is this just something I’ve screwed up myself?