Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate data into USD pinning file error - _pinning_file_generation_funcs.py #63

Closed
Jeremyball opened this issue Oct 3, 2024 · 5 comments · Fixed by #64
Closed

Integrate data into USD pinning file error - _pinning_file_generation_funcs.py #63

Jeremyball opened this issue Oct 3, 2024 · 5 comments · Fixed by #64
Assignees
Labels
type: bug Something isn't working

Comments

@Jeremyball
Copy link

Jeremyball commented Oct 3, 2024

Current Behavior:

Trying to publish a simple asset, sphere and cube, fails on Integrate data into USD pinning file.

What platform you are running on?

Windows

Steps To Reproduce:

  1. Create geo
  2. Create maya USD (use selection and create asset hierarchy)
  3. Turn off export animation
  4. Publish, error below

Relevant log output:

Traceback (most recent call last):
  File "C:\Users\jeremyb\AppData\Local\Ynput\AYON\dependency_packages\ayon_2406251801_windows.zip\dependencies\pyblish\plugin.py", line 528, in __explicit_process
    runner(*args)
  File "C:\Users\jeremyb\AppData\Local\Ynput\AYON\addons\usd_0.1.1\ayon_usd\plugins\publish\integrate_pinning_file.py", line 79, in process
    generate_pinning_file(
  File "C:\Users\jeremyb\AppData\Local\Ynput\AYON\addons\usd_0.1.1\ayon_usd\standalone\usd\pinning\_pinning_file_generation_funcs.py", line 354, in generate_pinning_file
    rootless_pinning_data = remove_root_from_dependency_info(
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jeremyb\AppData\Local\Ynput\AYON\addons\usd_0.1.1\ayon_usd\standalone\usd\pinning\_pinning_file_generation_funcs.py", line 55, in remove_root_from_dependency_info
    regx = re.compile(pattern)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Autodesk\Maya2025\Python\Lib\re\__init__.py", line 227, in compile
    return _compile(pattern, flags)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Autodesk\Maya2025\Python\Lib\re\__init__.py", line 294, in _compile
    p = _compiler.compile(pattern, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Autodesk\Maya2025\Python\Lib\re\_compiler.py", line 743, in compile
    p = _parser.parse(p, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Autodesk\Maya2025\Python\Lib\re\_parser.py", line 980, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Autodesk\Maya2025\Python\Lib\re\_parser.py", line 455, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Autodesk\Maya2025\Python\Lib\re\_parser.py", line 863, in _parse
    p = _parse_sub(source, state, sub_verbose, nested + 1)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Autodesk\Maya2025\Python\Lib\re\_parser.py", line 455, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Autodesk\Maya2025\Python\Lib\re\_parser.py", line 539, in _parse
    code = _escape(source, this, state)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Autodesk\Maya2025\Python\Lib\re\_parser.py", line 438, in _escape
    raise source.error("bad escape %s" % escape, len(escape))
re.error: bad escape \p at position 8

Additional context:

plugin versions
usd ( 0.1.1 )
maya ( 0.2.12 )

Maya 2025.2

@BigRoy
Copy link
Collaborator

BigRoy commented Oct 3, 2024

Thanks @Jeremyball - I can not seem to reproduce it here.

I think I know what the issue in the code - but your setup would need to confirm that. Can you share your configured "roots" for the project? Or provide the output printed from:

import ayon_api
from ayon_core.pipeline import get_current_project_name

print(ayon_api.get_project_roots_by_site_id(get_current_project_name()))

I have a feeling you have it configured with backslashes maybe, or with other 'special' characters that may be special to regex patterns.

It'd be nice if you can also attach a JSON Publish report from the Publisher UI (you can export that from bottom left in the publisher).

In the meantime, I'll prepare a potential fix.

@BigRoy
Copy link
Collaborator

BigRoy commented Oct 3, 2024

@Jeremyball Here's a PR to test at least it passing this particular point: #64


However, looking at the code I think the 'matching' it tries to do against the filename will fail anyway (at least without error so you can still publish).
@antirotor and @Lypsolon would need to tell me more about how this should work.

At this point in the code the variables for me are:

dependency_info={'c:\\projects\\ayontest\\asset\\char_beast\\publish\\usd\\usdAsset\\v007\\ynts_char_beast_usdAsset_v007.usd': 'c:\\projects\\ayontest\\asset\\char_beast\\publish\\usd\\usdAsset\\v007\\ynts_char_beast_usdAsset_v007.usd', 'c:\\projects\\ayontest\\asset\\char_beast\\publish\\usd\\usdAsset\\v007\\payload.usd': 'c:\\projects\\ayontest\\asset\\char_beast\\publish\\usd\\usdAsset\\v007\\payload.usd', 'c:\\projects\\ayontest\\asset\\char_beast\\publish\\usd\\usdAsset_model\\v003\\ynts_char_beast_usdAsset_model_v003.usd': 'c:\\projects\\ayontest\\asset\\char_beast\\publish\\usd\\usdAsset_model\\v003\\ynts_char_beast_usdAsset_model_v003.usd', 'c:\\projects\\ayontest\\asset\\char_beast\\publish\\usd\\usdMain\\v004\\ynts_char_beast_usdMain_v004.usd': 'c:\\projects\\ayontest\\asset\\char_beast\\publish\\usd\\usdMain\\v004\\ynts_char_beast_usdMain_v004.usd', 'c:\\projects\\ayontest\\asset\\char_beast\\publish\\usd\\usdAsset_rig\\v003\\ynts_char_beast_usdAsset_rig_v003.usd': 'c:\\projects\\ayontest\\asset\\char_beast\\publish\\usd\\usdAsset_rig\\v003\\ynts_char_beast_usdAsset_rig_v003.usd', 'c:\\projects\\ayontest\\asset\\char_beast\\publish\\rig\\rigMain\\v004\\ynts_char_beast_rigMain_v004.usd': 'c:\\projects\\ayontest\\asset\\char_beast\\publish\\rig\\rigMain\\v004\\ynts_char_beast_rigMain_v004.usd', 'c:\\projects\\ayontest\\asset\\char_beast\\publish\\rig\\rigMain\\v004\\ynts_char_beast_rigMain_v004.ma': 'c:\\projects\\ayontest\\asset\\char_beast\\publish\\rig\\rigMain\\v004\\ynts_char_beast_rigMain_v004.ma'}
root_info={'work': 'C:/projects'}
replacements={'C:/projects': 'work'}
pattern='(C:/projects)'

As you can see - the regex doesn't match it - and hence my pinning file does NOT contain rootless keys @Lypsolon @antirotor


Also @antirotor I'm quite sure we don't want the pinning file to be generated for EACH USD file, right? Only for renders? or?

@Jeremyball
Copy link
Author

Hey, thanks for the quick response. Attached publish report

Print out:
{'work': 'E:\AYON\projects'}

publish-report-241004-09-22.json

@BigRoy
Copy link
Collaborator

BigRoy commented Oct 3, 2024

{'work': 'E:\AYON\projects'}

Thanks, that confirms it:

import re

re.compile(r"E:\AYON\projects")
# Error: error: file C:\Program Files\Autodesk\Maya2025\Python\Lib\re\_parser.py line 438: bad escape \p at position 7
import re

pattern = re.escape(r"E:\AYON\projects")
print(pattern)  # prints: E:\\AYON\\projects
re.compile(pattern)

So my PR should at least allow you to continue - or if hard for you to update and deploy yourself, otherwise change your path in settings to use forward slashes, like: E:/AYON/projects.

@Jeremyball
Copy link
Author

Jeremyball commented Oct 3, 2024

For now I will reconfigure with forward slashes. Thanks!

Edit: Confirming publish works as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants