Skip to content

Commit 740169a

Browse files
authored
Merge pull request #1629 from rstudio/fix-config-module-import
Fix error when importing `config`
2 parents 9133fa3 + 4dd5319 commit 740169a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# reticulate (development version)
22

3+
- Fixed error when importing a module named `config` (#1628)
4+
35
# reticulate 1.38.0
46

57
- Python Exceptions converted to R conditions are now R lists instead

inst/config/config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def module_path(name):
3333

3434
# Get appropriate path-entry separator for platform
3535
pathsep = ";" if os.name == "nt" else ":"
36+
this_script_dir = os.path.dirname(__file__)
3637

3738
# Read default configuration values
3839
# fmt: off
@@ -43,7 +44,8 @@ def module_path(name):
4344
"Prefix" : getattr(sys, "prefix", ""),
4445
"ExecPrefix" : getattr(sys, "exec_prefix", ""),
4546
"BaseExecPrefix" : getattr(sys, "base_exec_prefix", ""),
46-
"PythonPath" : pathsep.join((x or "." for x in sys.path)),
47+
"PythonPath" : pathsep.join((x or "." for x in sys.path
48+
if x != this_script_dir)),
4749
"LIBPL" : sysconfig.get_config_var("LIBPL"),
4850
"LIBDIR" : sysconfig.get_config_var("LIBDIR"),
4951
"SharedLibrary" : sysconfig.get_config_var("Py_ENABLE_SHARED"),

0 commit comments

Comments
 (0)