Hi,
we have hit a minor issue with using pyblish in maya-2020 and a external python-2 process running pyblish-qml.
Background
We wanted to make the pyblish-qml ui work in maya instead of pyblish-lite with out having to build PyQt5 for python-2.
Problem
The problem is that the python-3 pyblish-qml process starts with a ‘not-so-clean’ PYTHONPATH that is still coming from the maya python-2 pyblish-qml,
that confuses the python-3 pyblish-qml.
Here is such an error.
Could not import runpy module
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
raise ImportError('This package should not be accessible on Python 3. '
File ".../python-2.7.17/site-packages/reprlib/__init__.py", line 7, in <module>
from reprlib import recursive_repr as _recursive_repr
File "/app/packages/python/3.8.1/python-3.8.1/lib/python3.8/collections/__init__.py", line 27, in <module>
from collections import deque
File "/app/packages/python/3.8.1/python-3.8.1/lib/python3.8/contextlib.py", line 5, in <module>
from contextlib import contextmanager
File "/app/packages/python/3.8.1/python-3.8.1/lib/python3.8/importlib/util.py", line 14, in <module>
import importlib.util
File "/app/packages/python/3.8.1/python-3.8.1/lib/python3.8/runpy.py", line 15, in <module>
What we did as a workaround was to replace the python-3 execuable with a bootstrap.sh that cleans the PYTHONPATH inside and points to the correct python-3 version of the pyblish-qml only.
before wihout cleaning PYTHONPATH (without a bootstrap.sh):
'.../pyqt/5.15.0/python-3.8.1/site-packages',
'.../python-3.8.1/site-packages', # pip install of pyblish
'.../python-2.7.17/site-packages',# pip install of pyblish
#...some_maya_script_dirs ...
'.../pyqt/5.15.0/python-3.8.1/site-packages/PyQt5'
# hard setting PYTHONPATH (with a bootstrap.sh)
'.../pyqt/5.15.0/python-3.8.1/site-packages'
'.../python-3.8.1/site-packages'
Most of the code that seems to be responsible for this seems to be in
https://github.com/pyblish/pyblish-qml/blob/master/pyblish_qml/ipc/server.py
pretty much here where the python-2 environment get inherited to the python-3 process
Would be most interested if anybody else was running into this ?
Would that classify as a bug or is this somehow desired behaviour ?
Kind Regards
Enno