Skip to content

Commit

Permalink
refact
Browse files Browse the repository at this point in the history
  • Loading branch information
ljleb committed Aug 11, 2023
1 parent 0e27b73 commit 43f58c8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
12 changes: 10 additions & 2 deletions lib_comfyui/comfyui/pre_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,24 @@ def main():

@ipc.restrict_to_process('comfyui')
def fix_path():
path = list(sys.path)
path = sys.path.copy()

# make path entries unique
sys.path.clear()
seen = set()
sys.path.extend(
p
for p in path
if not (p in seen or seen.add(p))
)

# put comfyui install dir first
sys.path[:0] = [sys.path.pop(sys.path.index(os.getcwd()))]
cwd = os.getcwd()
try:
sys.path.remove(cwd)
except ValueError:
pass
sys.path.insert(0, cwd)


@ipc.restrict_to_process('comfyui')
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions lib_comfyui/comfyui_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from lib_comfyui import ipc, torch_utils, argv_conversion, global_state
from lib_comfyui.webui import settings
from lib_comfyui.comfyui import pre_main, get_sys_path
from lib_comfyui.comfyui import pre_main, print_sys_path


comfyui_process = None
Expand Down Expand Up @@ -72,7 +72,7 @@ def get_base_sys_path(executable, comfyui_install_location):
env = os.environ.copy()
del env['PYTHONPATH']
return subprocess.run(
args=[executable, inspect.getfile(get_sys_path)],
args=[executable, inspect.getfile(print_sys_path)],
executable=executable,
cwd=str(comfyui_install_location),
env=env,
Expand Down

0 comments on commit 43f58c8

Please sign in to comment.