File tree Expand file tree Collapse file tree 2 files changed +17
-7
lines changed
Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change 1+ def env_type ():
2+ try :
3+ ipy_str = str (type (get_ipython ()))
4+ if 'zmqshell' in ipy_str :
5+ return 'jupyter'
6+ if 'terminal' in ipy_str :
7+ return 'ipython'
8+ except :
9+ return 'terminal'
Original file line number Diff line number Diff line change 2020from dataclasses import dataclass
2121from typing import Any , Iterable
2222import os
23+ from ._utils import env_type
2324
2425# This global variables for the module should not be accessed directy! Use the utilities below.
2526cms_lumi = "Run 2, 138 fb^{#minus1}"
@@ -725,13 +726,13 @@ def setCMSStyle(force=rt.kTRUE):
725726 cmsStyle .SetHatchesSpacing (1.3 )
726727
727728 # Some additional parameters we need to set as "style"
728-
729- if (
730- float ("." .join (re .split ("\\ .|/" , rt .__version__ )[0 :2 ])) >= 6.32
731- ): # Not available before!
732- # This change by O. Gonzalez allows to save inside the canvas the
733- # informnation about the defined colours.
734- rt .TColor .DefinedColors (1 )
729+ if env_type () != "jupyter" : # Snippet below crashes in jupyter as late as 6.36. Issue reproted to ROOT
730+ if (
731+ float ("." .join (re .split ("\\ .|/" , rt .__version__ )[0 :2 ])) >= 6.32
732+ ): # Not available before!
733+ # This change by O. Gonzalez allows to save inside the canvas the
734+ # informnation about the defined colours.
735+ rt .TColor .DefinedColors (1 )
735736
736737 # Using the Style.
737738 cmsStyle .cd ()
You can’t perform that action at this time.
0 commit comments