Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

General: PYTHONPATH may break OpenPype dependencies #2493

Merged
merged 6 commits into from
Jan 10, 2022

Conversation

iLLiCiTiT
Copy link
Member

Brief description

Environment PYTHONPATH may break dependencies of OpenPype.

Description

This issue was found due to missing implementation of distutils.spawn which is overriden with Python 2 vendor (e.g. from Nuke). This is almost imposible to catch on OpenPype start as importing of defaukt Python module may be also modified with PYTHONPATH.

Changes

  • implemented clean_envs_for_openpype_process which modify envs so OpenPype subrpocess won't be affected by current env values (currently only removes PYTHONPATH env)
  • implemented run_openpype_process which use clean_envs_for_openpype_process and prepend openpype executable args
  • use run_openpype_process in ExtractBurnin plugin
  • renamed get_pype_execute_args -> get_openpype_execute_args

@mkolar
Copy link
Member

mkolar commented Jan 6, 2022

Task linked: OP-2333 PYTHONPATH may break OpenPype

@iLLiCiTiT iLLiCiTiT self-assigned this Jan 6, 2022
@iLLiCiTiT iLLiCiTiT requested review from kalisp and 64qam January 6, 2022 15:34
@iLLiCiTiT iLLiCiTiT added backend type: bug Something isn't working labels Jan 6, 2022
@iLLiCiTiT iLLiCiTiT requested a review from jrsndl January 7, 2022 12:51
@64qam
Copy link
Member

64qam commented Jan 10, 2022

Publishing from Nuke fails on Extract Burnins:

Instance: 
renderCompositingMain
Message: 
Executing arguments was not successful: "(['C:\\Users\\qam\\pypeclub\\OpenPype\\.venv\\Scripts\\python.exe', 'C:\\Users\\qam\\pypeclub\\OpenPype\\start.py', ['run', 'C:\\Users\\qam\\pypeclub\\OpenPype\\openpype\\scripts\\otio_burnin.py', 'c:/users/qam/appdata/local/temp/tmpaede8k.json']],)"

Output:
>>> version set by environment variable 
>>> run disk mapping command ... 
>>> loading environments ... 
  - for Avalon ... 
  - global OpenPype ... 
  - for modules ... 
*** OpenPype [ 3.8.0-nightly.2 ]  
>>> Using OpenPype from [  C:\Users\qam\pypeclub\OpenPype  ] 
... OpenPype variant:      [  production  ] 
... Running OpenPype from: [  C:\Users\qam\pypeclub\OpenPype  ] 
... Using mongodb:         [  localhost  ] 
... Using FTrack at:       [  https://pype.ftrackapp.com  ] 
... Logging to MongoDB:    [  localhost  ] 
...   - port:              [  27017  ] 
...   - database:          [  openpype  ] 
...   - collection:        [  logs  ] 
...   - user:              [  <N/A>  ] 
Error:
>>> [  Skipping module directory because of missing "__init__.py" file. "C:\Users\qam\pypeclub\OpenPype\openpype\modules\default_modules\settings_module"  ]  
Usage: openpype [OPTIONS] COMMAND [ARGS]... 
Try 'openpype --help' for help. 

Error: No such command 'runC:\Users\qam\pypeclub\OpenPype\openpype\scripts\otio_burnin.pyc:/users/qam/appdata/local/temp/tmpaede8k.json'. 

Line: 
136
Traceback: 
Traceback (most recent call last):
  File "C:\Users\qam\pypeclub\OpenPype\.venv\lib\site-packages\pyblish\plugin.py", line 522, in __explicit_process
    runner(*args)
  File "C:\Users\qam\pypeclub\OpenPype\openpype\plugins\publish\extract_burnin.py", line 79, in process
  File "C:\Users\qam\pypeclub\OpenPype\openpype\plugins\publish\extract_burnin.py", line 315, in main_process
  File "C:\Users\qam\pypeclub\OpenPype\openpype\lib\execute.py", line 181, in run_openpype_process
    return run_subprocess(args, env=env, **kwargs)
  File "C:\Users\qam\pypeclub\OpenPype\openpype\lib\execute.py", line 136, in run_subprocess
    raise RuntimeError(exc_msg)
RuntimeError: Executing arguments was not successful: "(['C:\\Users\\qam\\pypeclub\\OpenPype\\.venv\\Scripts\\python.exe', 'C:\\Users\\qam\\pypeclub\\OpenPype\\start.py', ['run', 'C:\\Users\\qam\\pypeclub\\OpenPype\\openpype\\scripts\\otio_burnin.py', 'c:/users/qam/appdata/local/temp/tmpaede8k.json']],)"

Output:
>>> version set by environment variable 
>>> run disk mapping command ... 
>>> loading environments ... 
  - for Avalon ... 
  - global OpenPype ... 
  - for modules ... 
*** OpenPype [ 3.8.0-nightly.2 ]  
>>> Using OpenPype from [  C:\Users\qam\pypeclub\OpenPype  ] 
... OpenPype variant:      [  production  ] 
... Running OpenPype from: [  C:\Users\qam\pypeclub\OpenPype  ] 
... Using mongodb:         [  localhost  ] 
... Using FTrack at:       [  https://pype.ftrackapp.com  ] 
... Logging to MongoDB:    [  localhost  ] 
...   - port:              [  27017  ] 
...   - database:          [  openpype  ] 
...   - collection:        [  logs  ] 
...   - user:              [  <N/A>  ] 
Error:
>>> [  Skipping module directory because of missing "__init__.py" file. "C:\Users\qam\pypeclub\OpenPype\openpype\modules\default_modules\settings_module"  ]  
Usage: openpype [OPTIONS] COMMAND [ARGS]... 
Try 'openpype --help' for help. 

Error: No such command 'runC:\Users\qam\pypeclub\OpenPype\openpype\scripts\otio_burnin.pyc:/users/qam/appdata/local/temp/tmpaede8k.json'. ```

@iLLiCiTiT
Copy link
Member Author

Should be fixed now

Copy link
Member

@64qam 64qam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@iLLiCiTiT iLLiCiTiT merged commit 1b3cfad into develop Jan 10, 2022
@iLLiCiTiT iLLiCiTiT deleted the bugfix/OP-2333_PYTHONPATH-may-break-OpenPype branch January 19, 2022 10:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants