Skip to content

Commit 66a35fa

Browse files
committed
[Python] Local imports in _facade.py to delay pythonization lib. loading
This should fix errors on Windows where the `libROOTPythonizations` is attempted to be loaded before the DLL directory is set correctly in `ROOT/__init__.py`.
1 parent 2afc829 commit 66a35fa

File tree

1 file changed

+6
-4
lines changed
  • bindings/pyroot/pythonizations/python/ROOT

1 file changed

+6
-4
lines changed

bindings/pyroot/pythonizations/python/ROOT/_facade.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
import cppyy
88
import cppyy.ll
99

10-
from ._application import PyROOTApplication
11-
from ._numbadeclare import _NumbaDeclareDecorator
12-
from ._pythonization import pythonization
13-
1410

1511
class PyROOTConfiguration(object):
1612
"""Class for configuring PyROOT"""
@@ -57,6 +53,8 @@ class ROOTFacade(types.ModuleType):
5753
"""Facade class for ROOT module"""
5854

5955
def __init__(self, module, is_ipython):
56+
from ._pythonization import pythonization
57+
6058
types.ModuleType.__init__(self, module.__name__)
6159

6260
self.module = module
@@ -181,6 +179,8 @@ def _register_converters_and_executors(self):
181179
CPyCppyyRegisterExecutorAlias(name, target)
182180

183181
def _finalSetup(self):
182+
from ._application import PyROOTApplication
183+
184184
# Prevent this method from being re-entered through the gROOT wrapper
185185
self.__dict__["gROOT"] = cppyy.gbl.ROOT.GetROOT()
186186

@@ -443,6 +443,8 @@ def TMVA(self):
443443
# Create and overload Numba namespace
444444
@property
445445
def Numba(self):
446+
from ._numbadeclare import _NumbaDeclareDecorator
447+
446448
cppyy.cppdef("namespace Numba {}")
447449
ns = self._fallback_getattr("Numba")
448450
ns.Declare = staticmethod(_NumbaDeclareDecorator)

0 commit comments

Comments
 (0)