diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-11-01 11:48:53 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-11-01 11:48:53 +0000 |
commit | b85e83c3bd869c3f1ffacf8d3ff97bd9d406acff (patch) | |
tree | a3d6754693c5bb302d92019fa885906b7fac7ee1 /launch.py | |
parent | d35bf649456da2558cbb6f2ea16fa1606022b7e7 (diff) | |
download | stable-diffusion-webui-gfx803-b85e83c3bd869c3f1ffacf8d3ff97bd9d406acff.tar.gz stable-diffusion-webui-gfx803-b85e83c3bd869c3f1ffacf8d3ff97bd9d406acff.tar.bz2 stable-diffusion-webui-gfx803-b85e83c3bd869c3f1ffacf8d3ff97bd9d406acff.zip |
add PYTHONPATH for extension's install.py
Diffstat (limited to 'launch.py')
-rw-r--r-- | launch.py | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -17,11 +17,11 @@ def extract_arg(args, name): return [x for x in args if x != name], name in args
-def run(command, desc=None, errdesc=None):
+def run(command, desc=None, errdesc=None, custom_env=None):
if desc is not None:
print(desc)
- result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, env=os.environ if custom_env is None else custom_env)
if result.returncode != 0:
@@ -115,7 +115,10 @@ def run_extensions_installers(): continue
try:
- print(run(f'"{python}" "{path_installer}"', errdesc=f"Error running install.py for extension {dirname_extension}"))
+ env = os.environ.copy()
+ env['PYTHONPATH'] = os.path.abspath(".")
+
+ print(run(f'"{python}" "{path_installer}"', errdesc=f"Error running install.py for extension {dirname_extension}", custom_env=env))
except Exception as e:
print(e, file=sys.stderr)
|