Skip to content

Commit 08405db

Browse files
committed
warn about usage on windows
1 parent 33ee268 commit 08405db

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

src/ogdf_python/loader.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,31 @@
11
import os
2+
import platform
23

3-
import cppyy.ll
44
import importlib_resources
55
import sys
66

7+
try:
8+
import cppyy
9+
import cppyy.ll
10+
except:
11+
print(
12+
"\n##########\n"
13+
"ogdf-python couldn't load cppyy. "
14+
"This is not an ogdf-python error, but probably a problem with your cppyy installation or python environment. "
15+
"To use ogdf-python, check that you can `import cppyy` in a freshly-started python interpreter.\n",
16+
file=sys.stderr
17+
)
18+
if platform.system() == "Windows":
19+
print(
20+
"Note that ogdf-python is not officially supported on Windows."
21+
"Instead, you should use ogdf-python within the Windows Subsystem for Linux (WSL)."
22+
"There, make sure to actually invoke the Linux python(3) binary instead of the Windows python.exe, which"
23+
"can be checked with `python -VV`.\n",
24+
file=sys.stderr
25+
)
26+
print("##########\n\n", file=sys.stderr)
27+
raise
28+
729
cppyy.ll.set_signals_as_exception(True)
830
cppyy.add_include_path(os.path.dirname(os.path.realpath(__file__)))
931

@@ -41,7 +63,7 @@
4163
"If you haven't installed OGDF globally to your system, "
4264
"please set environment variables OGDF_INSTALL_DIR or OGDF_BUILD_DIR. "
4365
"The current search path is:\n%s\n"
44-
"The current include path is:\n%s" %
66+
"The current include path is:\n%s\n" %
4567
(cppyy.gbl.gSystem.GetDynamicPath(), cppyy.gbl.gInterpreter.GetIncludePath()),
4668
file=sys.stderr)
4769
raise

0 commit comments

Comments
 (0)