NatronGitHub / Natron

Open-source video compositing software. Node-graph based. Similar in functionalities to Adobe After Effects and Nuke by The Foundry.
http://NatronGitHub.github.io
GNU General Public License v2.0
4.65k stars 338 forks source link

Check that natron-python-scripting scripts still work with Natron 2.5 #701

Closed devernay closed 1 year ago

devernay commented 2 years ago

this repo will require heavy translation. Currently Natron can't recognize/link qtpy library in Linux. So waiting for a proper patch. https://github.com/NatronGitHub/natron-python-scripting

Echolon commented 2 years ago

https://github.com/NatronGitHub/Natron/commit/626275e393df9db173191d767f74eed0ef7352b9

@devernay is this related?

devernay commented 2 years ago

Yes, Natron 2.5 is built with python3, which may bring a few incompatibilities. This issue is about checking that external scripts don't break.

cgvirus commented 2 years ago

@devernay Please let me know when lib binding is ready. I will start the translation then. Thanks.

devernay commented 2 years ago

I think just dealing with py2/py3 compatibility should be enough for now:

cgvirus commented 2 years ago

I think just dealing with py2/py3 compatibility should be enough for now:

  • use "2to3" from any python3 distrib to see what needs to be changed
  • edit manually the changes so that they are compatible both with python2 and python3: https://python-future.org/compatible_idioms.html
  • For scripts that import PySide.QtGui, use a backward-compatible import, which will work with Natron 2.4, 2.5, and possibly 2.6 (which will be using Qt5):
try:
    from qtpy.QtGui import *
except ImportError:
    from PySide.QtGui import *

Hi, I have updated the scripts and it's now working with 2.4 But I am getting binding issue with 2.5.0 Alpha 2: O/S: Linux Mint 20 This is what I am seeing without installing scripts. With script installation as it can't find qtpy, it tries to roll back to pyside and pyside is also not in installation. So it fails in 2.5.0.

Python library is in /home/production/Code_Project/NAtron python Translation/Natron-RB-2.5-202201231914-6956ce3-Linux-x86_64-no-installer/lib/python3.9/site-packages
Failed to import qtpy.QtCore, make sure it is bundled with your Natron installation or reachable through the Python path. Note that Natron disables usage of site-packages).
Failed to import qtpy.QtGui
Info: init.py script not loaded (this is not an error)
Info: initGui.py script not loaded (this is not an error)
libpng warning: iCCP: known incorrect sRGB profile
cgvirus commented 2 years ago

If I try to use natron-python console:

>>> import qtpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/production/Natron-snapshot/lib/python3.9/site-packages/qtpy/__init__.py", line 237, in <module>
    from . import QtDataVisualization as QtDatavisualization
  File "/home/production/Natron-snapshot/lib/python3.9/site-packages/qtpy/QtDataVisualization.py", line 22, in <module>
    raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found
cgvirus commented 2 years ago

Here is the branch for testing: https://github.com/NatronGitHub/natron-python-scripting/tree/py3-qtpy

YakoYakoYokuYoku commented 2 years ago

Currently Natron disables user site-packages because those would conflict with the bundled packages.

https://github.com/NatronGitHub/Natron/blob/v2.5.0-alpha.2/Engine/AppManager.cpp#L2954-L2958

But I think many users would be interested to have the capability to use site-packages. So I'll try to provide a better alternative in a PR.

cgvirus commented 1 year ago

Should be safe to merge now.

https://github.com/NatronGitHub/natron-python-scripting/issues/7#issuecomment-1331190271

YakoYakoYokuYoku commented 1 year ago

You can either open a PR there and get it approved by me or get someone else that has push privileges so that can be merged.

cgvirus commented 1 year ago

Merged. Issue can be closed. Thanks.