Commit 5d995ac9 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Fix problem with dirty sys.path entries in inline()

This is a workaround for strange entries in sys.path; either dirs that
don't exist, or are in unicode.
parent 512d70b8
...@@ -26,8 +26,12 @@ except ImportError: ...@@ -26,8 +26,12 @@ except ImportError:
raise libgraph_tool_core.raise_error\ raise libgraph_tool_core.raise_error\
("You need to have scipy installed to use 'run_action'.") ("You need to have scipy installed to use 'run_action'.")
# sys.path can be dirty and in unicode! :-p
sys_path = [str(d) for d in sys.path if os.path.isdir(d)]
prefix = None prefix = None
for d in [d + "/graph_tool" for d in sys.path]: for d in [p + "/graph_tool" for p in sys_path]:
if os.path.exists(d): if os.path.exists(d):
prefix = d prefix = d
break break
...@@ -243,7 +247,7 @@ def inline(code, arg_names=[], local_dict=None, ...@@ -243,7 +247,7 @@ def inline(code, arg_names=[], local_dict=None,
auto_downcast=auto_downcast, auto_downcast=auto_downcast,
support_code=support_code, support_code=support_code,
libraries=libraries, libraries=libraries,
library_dirs=sys.path + library_dirs, library_dirs=sys_path + library_dirs,
extra_compile_args=compile_args, extra_compile_args=compile_args,
runtime_library_dirs=runtime_library_dirs, runtime_library_dirs=runtime_library_dirs,
extra_objects=extra_objects, extra_objects=extra_objects,
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment