Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/+513f19bc.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Convert import_root to a string if it was submitted as a Path object to ensure that anything added to sys.path is a string
4 changes: 4 additions & 0 deletions infrahub_sdk/_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ def import_module(
if import_root and relative_path:
file_on_disk = Path(import_root, relative_path, module_path.name)

# This is a temporary workaround for to account for issues if "import_root" is a Path instead of a str
# Later we should rework this so that import_root and relative_path are all Path objects. Here we must
# ensure that anything we add to sys.path is a string and not a Path or PosixPath object.
import_root = str(import_root)
if import_root not in sys.path:
sys.path.append(import_root)

Expand Down
Loading