CreativeLyons / NukeSurvivalToolkit_publicRelease

public version of the nuke survival toolkit
MIT License
219 stars 45 forks source link

Nuke 13/Python 3 compatibility #10

Closed pejaycee closed 1 year ago

pejaycee commented 3 years ago

The Nuke 13 beta is now public, but with the transfer to Python 3, it looks like a few things have broken.

https://www.foundry.com/products/nuke/beta/13.0

To launch with Nuke 13, you need to add brackets to a bunch of print statements, beyond that there might be other things that have also broken,

While Nuke 13 is still in beta, it would be a good time to look at making everything Python 3 compatible.

Njordy commented 3 years ago

Pretty much all of the python is inside of gizmos. So... technically it's a gizmo authors' job to prepare an update for py3. Plus, I actually think what 1) Foundry will release py2-compatible version, at least initially. Houdini does have both branches to help with transitioning. 2) It's pretty sure Nuke 13 will be barely usable for at last half a year due to bug infestation ;)

backhausmartin commented 3 years ago

Yes, it looks like the change from Python 2 to 3 is still a major challenge for the industry.

A lot of the tools / gizmos etc within the NukeSurvivalToolkit are maybe not maintained anymore, or a bit legacy (written once 5 years ago...). There are some Python scripts/tools to automatically do the conversion to Python 3.

I wrote to the Nuke support... maybe there is a way to move to Py3 with the help of the original maintainers, Foundry and the community...

And thanks to Tony for putting together the Nuke Survial Toolkit!

Just for the record, here are error messages I am currently getting from Nuke 13 Beta:

Nuke 13.0v1.628907b, 64 bit, built Feb  4 2021.
Copyright (c) 2021 The Foundry Visionmongers Ltd.  All Rights Reserved.
Using "nuke" (RLM) licence.  Beta expires on: 2021/4/5
Traceback (most recent call last):
  File "C:/Users/martin/.nuke/init.py", line 8, in <module>
    import cryptomatte_utilities
  File "C:/Users/martin/.nuke\cryptomatte_utilities.py", line 279
    print "Cryptomatte: Invalid sidecar path (Back-slashes not allowed): ", sidecar_path
                                                                         ^
SyntaxError: invalid syntax

Commenting out the cryptomatte imports I get the following:

Traceback (most recent call last):
  File "C:/Users/martin/.nuke/menu.py", line 34, in <module>
    import stamps
  File "C:/Users/martin/.nuke\stamps.py", line 35, in <module>
    if not globals().has_key('Stamps_LastCreated'):
AttributeError: 'dict' object has no attribute 'has_key'

And commenting out the stamps import:

C:/Users/martin/.nuke/NukeSurvivalToolkit\spin_tools\Keying
  File "C:/Users/martin/.nuke/NukeSurvivalToolkit/menu.py", line 290
    print "Could not load VectorTracker.py"
                                          ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Could not load VectorTracker.py")?
borsarinicola commented 3 years ago

I've been fighiting with old pluings for compatibility for a while and most of them can be easily updated. The main issues across the board are print statements and how the threading module has been handled.

The main thing is that any update should be backwards compatible but and I doubt most of the tools developers will actually update the codebase. Nukepedia is full PySide tools that were never updated to PySide2.

Njordy commented 3 years ago

Some people used this service with success : https://pythonconverter.com/

CreativeLyons commented 3 years ago

Thanks for looking in to this guys, I'll try and do some research and attempt to convert at least my tools in the toolset. I know a lot of people are posting updates, so I will try and grab those and update them as well as they pour in. Feel free to chip in if you fix a python code within a tool and wish to share the fix, I'll try and update the tool. You can also write an issue ticket per tool you wish to update, might be a nice way to manage. We'll get it all working, will just take a bit of time and updating. Thanks again

DanGraMMU commented 3 years ago

Hi, did we get anywhere with this? Looking to use this toolkit with Nuke 13 but getting the below error in the nuke start-up terminal after seeing '.../init.py - error interpreting this plugin':

nuke.pluginAddPath(".\NukeSurvivalToolkit") ^ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 1-2: malformed \N character escape

Note: the arrow aligns with the first braket in the terminal

gere89 commented 3 years ago

Put "r" before your path

So you will get something like this: nuke.pluginAddPath(r".\NukeSurvivalToolkit")

\n is interpreted as the new line. With the r you avoid this. There are other solutions, but this one is the easiest one

😉

Il giorno gio 22 lug 2021 alle ore 10:04 DanGraMMU @.***> ha scritto:

Hi, did we get anywhere with this? Looking to use this toolkit with Nuke 13 but getting the below error in the terminal after seeing '.../init.py - error interpreting this plugin':

nuke.pluginAddPath(".\NukeSurvivalToolkit") ^ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 1-2: malformed \N character escape

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/CreativeLyons/NukeSurvivalToolkit_publicRelease/issues/10#issuecomment-884727631, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGUI5FWXVKVVUBER324NUDTY7GJ5ANCNFSM4WTDRAMA .

DanGraMMU commented 3 years ago

Okay, I tried changing the backslashes, to double backslashes and I'm not getting the error anymore. However, the toolkit isn't showing for me in nuke when it boots up. Is this an issue with Nuek 13?

DanGraMMU commented 3 years ago

Got it working - cheers for that tip. Ended up having to change a few bits, but works now

EliWillyam2020 commented 2 years ago

Hey folks, Tried many things and every time it gives me this error with Nuke 13

NukeX 13.0v3, 64 bit, built Jun 30 2021. Copyright (c) 2021 The Foundry Visionmongers Ltd. All Rights Reserved. File "C:/Users/Administrator/.nuke/init.py", line 1 nuke.pluginAddPath(r".\NukeSurvivalToolkit") ^ SyntaxError: invalid syntax

EliWillyam2020 commented 2 years ago

nuke.pluginAddPath(r".\NukeSurvivalToolkit")

EliWillyam2020 commented 2 years ago

@gere89 Tried as you said but didn't work also

jeangjenq commented 2 years ago

NST_PlanarProjection.gizmo is still on py2. It's been updated in comment on the gist here

ValentinSteiner commented 2 years ago

I'm aware that NST expects the original authors to migrate to Python 3.

In that spirit: CardToTrack by Alexey Kuchinski & Helge Stang has been updated to Python 3. https://www.nukepedia.com/python/3d/cardtotrack/

Note that it now comes with a Python script, so whoever runs this must make sure that the directory containing the Python script is part of Python's search paths.

CreativeLyons commented 1 year ago

I'm aware that NST expects the original authors to migrate to Python 3.

In that spirit: CardToTrack by Alexey Kuchinski & Helge Stang has been updated to Python 3. https://www.nukepedia.com/python/3d/cardtotrack/

Note that it now comes with a Python script, so whoever runs this must make sure that the directory containing the Python script is part of Python's search paths.

Updated CardToTrack to v8.0, thank you.

CreativeLyons commented 1 year ago

NST_PlanarProjection.gizmo is still on py2. It's been updated in comment on the gist here

Updated PlanarProjection, thank you.

CreativeLyons commented 1 year ago

for any further nuke13 python3 updates, please make an individual ticket for each request, so i can close them 1 by 1. Thanks