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

[tf] fix for python dll loading order #2595

Conversation

pmolodo
Copy link
Contributor

@pmolodo pmolodo commented Aug 16, 2023

Description of Change(s)

Tf uses WindowsImportWrapper to add directories on the PATH to the list of allowable directories to find .dll files, so python modules relying on finding .dlls on the PATH will continue to work.

However, it seems that os.add_dll_directory works in a "most recently added wins" manner, so we need to reverse the order that we call it for entries on the PATH.

Fixes Issue(s)

  • Errors loading incorrect dlls if order of entries on PATH matters
  • I have verified that all unit tests pass with the proposed changes
  • I have submitted a signed Contributor License Agreement

Tf uses WindowsImportWrapper to add directories on the
PATH to the list of allowable directories to find .dll
files, so python modules relying on finding .dlls on
the PATH will continue to work.

However, it seems that os.add_dll_directory works in a
"most recently added wins" manner, so we need to reverse
the order that we call it for entries on the PATH.
@jesschimein
Copy link
Contributor

Filed as internal issue #USD-8593

@pmolodo
Copy link
Contributor Author

pmolodo commented Oct 17, 2023

Hi - if this PR seems a bit bulky, the vast majority is an added test for correct PATH ordering, which was a bit tricky to get right.

The functional change is a single line (really, a single additional call to reversed()):

https://github.com/PixarAnimationStudios/OpenUSD/pull/2595/files#diff-78e4c3d1f9dc10a8e04395293a5f6fb8d46d3ac9d7123a0e1b3ee7867e7a003eR57

I'm ok with dropping the test if the test seems too bulky...

@pixar-oss pixar-oss merged commit 74c924c into PixarAnimationStudios:dev Nov 17, 2023
11 of 20 checks passed
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

Successfully merging this pull request may close these issues.

3 participants