-
Notifications
You must be signed in to change notification settings - Fork 306
Import _opentime before actually creating the bindings for _otio #1396
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
Import _opentime before actually creating the bindings for _otio #1396
Conversation
…s allows to import _otio without manually importing _opentime before. Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1396 +/- ##
=======================================
Coverage 86.12% 86.12%
=======================================
Files 199 199
Lines 20522 20523 +1
Branches 2375 2375
=======================================
+ Hits 17674 17675 +1
Misses 2267 2267
Partials 581 581
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you make a small grammatical tweak please?
src/py-opentimelineio/opentimelineio-bindings/otio_bindings.cpp
Outdated
Show resolved
Hide resolved
Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch. LGTM
…demySoftwareFoundation#1396) Signed-off-by: Michele Spina <michelespina96@gmail.com>
I noticed that doing
python -c 'import opentimelineio._otio'
was not working. It was resulting in an import error:This error doesn't normally happen because we usually go through
opentimelineio/__init__.py
which imports_opentime
before importing_otio
.After some searching, I found https://pybind11.readthedocs.io/en/stable/advanced/misc.html#partitioning-code-over-multiple-extension-modules which describes some options to fix this. This PR implements the simplest option out there, which is to import
_opentime
before actually creating the_otio
bindings.This should be harmless because it is going to be a no-op when importing OTIO normally (via
import opentimelineio
). It will be a no-op in this case bacause Python doesn't re-import a package if imported twice.