MCPcopy Index your code
hub / github.com/plotly/plotly.py / orca_env

Function orca_env

plotly/io/_orca.py:869–894  ·  view source on GitHub ↗

Context manager to clear and restore environment variables that are problematic for orca to function properly NODE_OPTIONS: When this variable is set, orca <v1.2 will have a segmentation fault due to an electron bug. See: https://github.com/electron/electron/issues/12695 E

()

Source from the content-addressed store, hash-verified

867
868@contextmanager
869def orca_env():
870 """
871 Context manager to clear and restore environment variables that are
872 problematic for orca to function properly
873
874 NODE_OPTIONS: When this variable is set, orca <v1.2 will have a
875 segmentation fault due to an electron bug.
876 See: https://github.com/electron/electron/issues/12695
877
878 ELECTRON_RUN_AS_NODE: When this environment variable is set the call
879 to orca is transformed into a call to nodejs.
880 See https://github.com/plotly/orca/issues/149#issuecomment-443506732
881 """
882 clear_env_vars = ["NODE_OPTIONS", "ELECTRON_RUN_AS_NODE", "LD_PRELOAD"]
883 orig_env_vars = {}
884
885 try:
886 # Clear and save
887 orig_env_vars.update(
888 {var: os.environ.pop(var) for var in clear_env_vars if var in os.environ}
889 )
890 yield
891 finally:
892 # Restore
893 for var, val in orig_env_vars.items():
894 os.environ[var] = val
895
896
897# Public orca server interaction functions

Callers 2

validate_executableFunction · 0.85
ensure_serverFunction · 0.85

Calls 3

updateMethod · 0.45
popMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected