Unicode decode error can occur from path(s) with "\x" in them, subprocess still uses backslashes
Closed this issue · 6 comments
Reposting comment from closed PR #70
It appears that if a path has \x
in it, it is interpreted as a Unicode escape character instead of a path:
Debugging seems to indicate that Popen
makes the path with backslashes, even though the args
variable appears to use forward ones as input?
SourceOps/addon/types/model_export/model.py
Line 313 in bbc8838
More info on what is happening on Windows: https://docs.python.org/3/library/subprocess.html#converting-argument-sequence
Originally posted by @CabbageMcGravel in #70 (comment)
This is actually visible in the .log
file too it seems. (This is a model without any unicode error happening)
qdir: "d:\steamlibrary\steamapps\common\half-life 2\hl2\modelsrc\example\model"
gamedir: "D:\SteamLibrary\steamapps\common\Half-Life 2\hl2"
g_path: "D:\SteamLibrary\steamapps\common\Half-Life 2\hl2\modelsrc\example\model\model.qc"
Building binary model files...
Working on "model.qc"
SMD MODEL Collection.smd
SMD MODEL model_anims.smd
---------------------
writing D:\SteamLibrary\steamapps\common\Half-Life 2\hl2\models/example/model.mdl:
...and so on...
#68 seems to change the affected line where the error occurs, I wonder if it would fix this issue?
I checked the above, the issue still occurs there unfortunately.
Besides that, it appears to be a functional PR!
Looks like it's been narrowed down a bit to the encoding used with Popen
to decode.
For example, UTF8 doesn't cause the exception.
@bonjorno7 Is this issue closed by commit 4ab6a8e?
I think so yeah.