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

[Bug]_Maya Picky about import order of the resolver #26

Open
2 tasks done
BigRoy opened this issue Aug 31, 2024 · 0 comments
Open
2 tasks done

[Bug]_Maya Picky about import order of the resolver #26

BigRoy opened this issue Aug 31, 2024 · 0 comments
Assignees

Comments

@BigRoy
Copy link
Collaborator

BigRoy commented Aug 31, 2024

Describe the bug

This will fail with an error:

from pxr import Ar
import time
from usdAssetResolver import AyonUsdResolver

Ar.SetPreferredResolver("AyonUsdResolver")
resolver = Ar.GetResolver()
context = AyonUsdResolver.ResolverContext()

Stack trace:

# Error: DLL load failed while importing _ayonUsdResolver: The specified module could not be found.
# # Traceback (most recent call last):
# #   File "<maya console>", line 5, in <module>
# #   File "E:\dev\ayon-usd\client\ayon_usd\downloads\Maya2024_2_Py310_Win_Windows_AMD64\ayonUsdResolver\lib\python\usdAssetResolver\AyonUsdResolver\__init__.py", line 2, in <module>
# #     Tf.PreparePythonModule()
# #   File "C:\Program Files\Autodesk\MayaUSD\Maya2024\0.27.0_202402071410-bf4bd3e\mayausd\USD\lib\python\pxr\Tf\__init__.py", line 88, in PreparePythonModule
# #     module = importlib.import_module(
# #   File "C:\Program Files\Autodesk\Maya2024\Python\lib\importlib\__init__.py", line 126, in import_module
# #     return _bootstrap._gcd_import(name[level:], package, level)
# # ImportError: DLL load failed while importing _ayonUsdResolver: The specified module could not be found.

It fails on line: from usdAssetResolver import AyonUsdResolver

However, if you load the mayaUsd plug-in and create an empty stage (mayaUsdProxyShape). Then these imports work fine.


Workaround ✅

However this code does work, without having mayaUsd plug-in loaded nor a stage opened.

from pxr import Ar
import time

Ar.SetPreferredResolver("AyonUsdResolver")
resolver = Ar.GetResolver()

from usdAssetResolver import AyonUsdResolver
context = AyonUsdResolver.ResolverContext()

Describe yourself

TD

To Reproduce

  1. Launch Maya with resolver.
  2. Run:
from pxr import Ar
import time
from usdAssetResolver import AyonUsdResolver

Ar.SetPreferredResolver("AyonUsdResolver")
resolver = Ar.GetResolver()
context = AyonUsdResolver.ResolverContext()

How did you discover the bug?

I ran that code when testing resolver.

Expected behaviour

Preferably, we can make AYON USD Resolver in Maya less picky about the import order.

Looking at the provided "workaround" I wonder if there's anything we should do to enforce the default resolver since that seemed to fix the import?

Screenshots

No response

Hardware Setup

n/a

Software Setup

Maya 2024.2

User Type

TD

Additional Environment Details

No response

What platform are you running on?

Windows 10

Additional context

No response

Is there an existing issue with this?

  • I have searched the existing issues

Are there any labels you wish to add?

  • I have added the relevant labels to the bug report.
@BigRoy BigRoy added the type: bug Something isn't working label Aug 31, 2024
@Lypsolon Lypsolon self-assigned this Oct 7, 2024
@mkolar mkolar removed the type: bug Something isn't working label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants