AcademySoftwareFoundation / OpenCue

A render management system you can deploy for visual effects and animation productions.
https://www.opencue.io
Apache License 2.0
833 stars 203 forks source link

Maya plugin fails on compatibility library #679

Open bcipriano opened 4 years ago

bcipriano commented 4 years ago

Describe the bug The Maya plugin fails to load due to errors generated by one of the compatibility libraries we're using:

Failed to execute userSetup.py
Traceback (most recent call last):
  File "/opt/OpenCue/cuesubmit/plugins/maya/userSetup.py", line 18, in <module>
    import CueMayaSubmit
  File "/opt/OpenCue/cuesubmit/plugins/maya/CueMayaSubmit.py", line 50, in <module>
    from cuesubmit.ui import Submit
  File "/opt/OpenCue/cuesubmit/cuesubmit/ui/Submit.py", line 15, in <module>
    from cuesubmit import Submission
  File "/opt/OpenCue/cuesubmit/cuesubmit/Submission.py", line 21, in <module>
    from outline import Outline, cuerun
  File "/opt/OpenCue/venv/lib/python2.7/site-packages/pyoutline-unknown-py2.7.egg/outline/__init__.py", line 32, in <module>
    from .loader import *
  File "/opt/OpenCue/venv/lib/python2.7/site-packages/pyoutline-unknown-py2.7.egg/outline/loader.py", line 23, in <module>
    from past.builtins import execfile
  File "/opt/OpenCue/venv/lib/python2.7/site-packages/past/__init__.py", line 88, in <module>
    from past.translation import install_hooks as autotranslate
  File "/opt/OpenCue/venv/lib/python2.7/site-packages/past/translation/__init__.py", line 42, in <module>
    from lib2to3.refactor import RefactoringTool
  File "/usr/autodesk/maya2019/lib/python27.zip/lib2to3/refactor.py", line 27, in <module>
  File "/usr/autodesk/maya2019/lib/python27.zip/lib2to3/fixer_util.py", line 9, in <module>
  File "/usr/autodesk/maya2019/lib/python27.zip/lib2to3/pygram.py", line 32, in <module>
  File "/usr/autodesk/maya2019/lib/python27.zip/lib2to3/pgen2/driver.py", line 121, in load_grammar
    g = pgen.generate_grammar(gt)
  File "/usr/autodesk/maya2019/lib/python27.zip/lib2to3/pgen2/pgen.py", line 385, in generate_grammar
    p = ParserGenerator(filename)
  File "/usr/autodesk/maya2019/lib/python27.zip/lib2to3/pgen2/pgen.py", line 15, in __init__
    stream = open(filename)
IOError: [Errno 20] Not a directory: '/usr/autodesk/maya2019/lib/python27.zip/lib2to3/Grammar.txt'

To Reproduce Steps to reproduce the behavior:

  1. Install CueSubmit as a Maya plugin.
  2. Launch Maya via commandline (so you can see full error text in the console as it loads)
  3. OpenCue plugin does not appear, and above stacktrace is generated.

Expected behavior Plugin should load without error and an OpenCue shelf should appear in Maya.

Version Number 0.4.0

srbhss commented 4 years ago

IMO it is because lib2to3 fails to load the Grammar.txt file if it is located inside a .zip archive. Updating python zip file will work. Python community had updated pygram.py and driver.py to fix this issue.

https://bugs.python.org/issue24960 https://github.com/python/cpython/commit/770a802df7057bcf0d72bbc01026fac8d396e1b3 https://github.com/python/cpython/commit/417f76a20e93044e422fb328a2d8e200fc6df295

cwrightce commented 4 years ago

Not sure we can rely on studios patching their Maya installs with a new python.zip. If you're right though, then it's possible that newer versions of Maya won't have this issue if they ship with an updated Python... until then, this is what we did to make it work at my studio.

We commented out both the execfile import and the 'execfile(path, {})' line in loader.py (we're not using shell.py but iirc this happens there too) and dropped in this the parse_outline_script() method in it's place.

        with open(path, 'r') as f:
           outline_code = compile(f.read(), path, 'exec')
           exec(outline_code, {}, {})

I believe this works on both Python 2 and 3... though I'm not 100% certain.

ruchitinfushion commented 4 years ago

We commented out both the execfile import and the 'execfile(path, {})' line in loader.py (we're not using shell.py but iirc this happens there too) and dropped in this the parse_outline_script() method in it's place.

        with open(path, 'r') as f:
           outline_code = compile(f.read(), path, 'exec')
           exec(outline_code, {}, {})

I believe this works on both Python 2 and 3... though I'm not 100% certain.

still getting same error in Maya 2018.4

root : Generating grammar tables from /foo/apps/maya2018/lib/python27.zip/lib2to3/Grammar.txt  
Error: IOError: file /foo/apps/maya2018/lib/python27.zip/lib2to3/pgen2/pgen.py line 15: 20