Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing __init__.py prevents proper module importing in scripts folder #765

Open
axs-1553 opened this issue Dec 26, 2024 · 0 comments
Open

Comments

@axs-1553
Copy link

axs-1553 commented Dec 26, 2024

When installing the Infinite Image Browser extension, it fails to load due to Python's module import system not recognizing the scripts directory as a proper package.

Error Details:

*** Error loading script: iib_setup.py
    Traceback (most recent call last):
      File "[...]/modules/scripts.py", line 525, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      [...]
      File "[...]/sd-webui-infinite-image-browsing/scripts/iib_setup.py", line 1, in <module>
        from scripts.iib.api import infinite_image_browsing_api, send_img_path
    ModuleNotFoundError: No module named 'scripts.iib'

Root Cause:

The scripts and scripts/iib folders are missing the required __init__.py files that Python needs to treat the directory as a package. This prevents the relative import 'from scripts.iib.api' from working correctly.

Solution:

1. Create an empty "__init__.py" file in the scripts folder
2. Create an empty "__init__.py" file in the scripts/iib folder

These files should be included in the repository by default to ensure proper Python package structure and prevent import errors during installation.

Environment:

  • Stable Diffusion WebUI Forge
  • Windows 10/11
  • Python 3.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant