Windows Path Normalization


I’m having some issues with path normalization in windows.
By default, a path like “D:_temp\houdini\sgtk_thumbc93px4hm.jpg” will be normalized to ‘D:\_temp\houdini\sgtk_thumbc93px4hm.jpg’. I don’t know how the internal logic works, but the normalization makes the thumbnail unreachable since the toolkit can’t find the file to upload.

I’m writing custom hooks for publishing files inside Houdini.
While reading the path inside the item in the publish hook, the path is working, but the create CRUD method is normalizing the path internally and therefore, making It unreachable. I’m assuming I’m skipping some steps here, so how can I fix that behavior?

From your screenshot all it seems to do is to double backslash your path as a backslash is a escape character in Python.

Maybe try feeding the publisher a forward slashed path, I seem to recall having some windows issues too.

I always sanitize my paths to replace backslashes with forward slashes:

myPath = "D:\_temp\houdini\sgtk_thumbc93px4hm.jpg"
myPath = myPath.replace("\\", "/")

Thanks, and sorry for the delay. I saw the message in my email and corrected the code.

1 Like