Skip to content

Commit fa19962

Browse files
committed
[jupyter] check existence of TWebCanvas methods
Looks like dummy TWebCanvas class is created by pyroot also when it not compiled. So extend check and verify that static method is really exists. Do the same for TBufferJSON
1 parent 40a3324 commit fa19962

File tree

1 file changed

+11
-7
lines changed
  • bindings/jupyroot/python/JupyROOT/helpers

1 file changed

+11
-7
lines changed

bindings/jupyroot/python/JupyROOT/helpers/utils.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,20 @@
8989

9090

9191
def TBufferJSONAvailable():
92-
if hasattr(ROOT, "TBufferJSON"):
93-
return True
94-
print(TBufferJSONErrorMessage, file=sys.stderr)
95-
return False
92+
if not hasattr(ROOT, "TBufferJSON"):
93+
return False
94+
if not hasattr(ROOT.TBufferJSON, "ConvertToJSON"):
95+
print(TBufferJSONErrorMessage, file=sys.stderr)
96+
return False
97+
return True
9698

9799

98100
def TWebCanvasAvailable():
99-
if hasattr(ROOT, "TWebCanvas"):
100-
return True
101-
return False
101+
if not hasattr(ROOT, "TWebCanvas"):
102+
return False
103+
if not hasattr(ROOT.TWebCanvas, "CreateCanvasJSON"):
104+
return False
105+
return True
102106

103107

104108
def RCanvasAvailable():

0 commit comments

Comments
 (0)