Pipeline tutorial python bug/issue

I am going through the Shotgrid Pipeline Tutorial. It has all been going well until I got to the part where I am creating a custom maya shader publish plugin. I copied and pasted the provided code but when I run the publish from Maya I get a Validation error. In python the error is “NameError: name ‘unicode’ is not defined.” Line 423 of publish_shader_network.py. The code was copy and pasted from the tutorial code (via git) and a diff shows no difference between my file and the one from git.

When I change unicode in the code to str I get an error ‘a bytes-like object is required, not str’. In other toolkit code I see ‘str’ being used in this case (the notes in the code state that unicode is for py2 and str is used for py3 but it still doesn’t work.

Anyone with stronger python skill than mine know how to make this work. I am guessing that that tutorial was written for py2.

Here is the path to the code:

Line 423

Thanks for any thoughts on this.

For better or worse I have commented out the isinstance(path, unicode) block. The publish is working now. I am still curious if I should in fact be using the isinstance block.

One way is to use the six library if you want to support both py2 and py3 - How to check if variable is string with python 2 and 3 compatibility - Stack Overflow
Where does the error from the second paragraph get thrown? Python 3 is a bit stricter about strings vs bytes.

Thanks for the info on the six library. I’ll dig into.
The error gets thrown to the SG Desktop log file (and probably the SG Desktop but I didn’t look there). At the moment however it’s all running smoothly.