Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Fix module import issue in install.py #45

Merged
merged 1 commit into from May 9, 2023

Conversation

lcolok
Copy link
Contributor

@lcolok lcolok commented May 8, 2023

This PR addresses an issue I encountered in install.py while trying to install the package on a Linux system. The comfy module could not be found, leading to a ModuleNotFoundError when running the script.

The issue was caused by the comfy directory not being included in the Python module search path (sys.path). This problem might not manifest itself on every system, but it occurred on my Linux system and could potentially affect other users as well. The code might have been developed on a Windows system, where the issue did not appear due to differences in the module search path.

To fix this and ensure the script works correctly on different environments, including both Windows and Linux systems, I added the parent directory of comfy to sys.path in install.py.

Here are the changes I made in install.py:

import os
from time import sleep
from importlib.util import spec_from_file_location, module_from_spec
import sys
import argparse
import subprocess

this_module_name = "comfy_controlnet_preprocessors"
EXT_PATH = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.abspath(os.path.join(EXT_PATH, "../../")))

# ... other code ...

This commit addresses an issue in `install.py` where the `comfy` module
could not be found, leading to a `ModuleNotFoundError` when running the
script on some systems, such as Linux.

The issue was caused by the `comfy` directory not being included in the
Python module search path (`sys.path`). To fix this, the parent directory
of `comfy` is added to `sys.path` in `install.py`.

With these changes, the script should work correctly on different
environments, including both Windows and Linux systems.
@Fannovel16 Fannovel16 merged commit 5626971 into Fannovel16:main May 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants