From 57eef46f953574799e01b389e9f665f058bbd42d Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 1 Nov 2020 23:01:41 +0000 Subject: Fix for issue #59 Relative paths work great for running as a script. But break when running as a module since there is no `src/` folder to mention. This should clear that up as the `src/` now lives under wherever the python package was installed. --- archinstall/__main__.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'archinstall/__main__.py') diff --git a/archinstall/__main__.py b/archinstall/__main__.py index fe4a3732..48d8a5ce 100644 --- a/archinstall/__main__.py +++ b/archinstall/__main__.py @@ -33,6 +33,10 @@ def run_as_a_module(): if f'{profile}.py' not in library: raise ProfileNotFound(f'Could not locate {profile}.py among the example files.') + # Swap the working dir, otherwise certain relative lookups won't work within archinstall. + # Mainly to avoid https://github.com/Torxed/archinstall/issues/59 + os.chdir(os.path.abspath(os.path.dirname(__file__))) + # Import and execute the chosen `.py`: spec = importlib.util.spec_from_file_location( library[f"{profile}.py"], -- cgit v1.2.3-70-g09d2