Skip to content

Circular import #340

@50-scratch-tabs

Description

@50-scratch-tabs

Steps to reproduce:

C:\whereever> git clone https://github.com/TimMcCool/scratchattach
(insert normal git output here)
C:\whereever> cd scratchattach
C:\whereever\scratchattach> python
Python blah blah blah
>>> import scratchattach

(Note that it also happens if you rename C:\whereever\scratchattach; I thought the parent directory having the same name might cause the problem, but it even works when installed via pip with git.)

Python 3.12.5 (tags/v3.12.5:ff3bc82, Aug  6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import scratchattach
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\myname\AppData\Roaming\Python\Python312\site-packages\scratchattach\__init__.py", line 1, in <module>
    from .cloud.cloud import ScratchCloud, TwCloud, get_cloud, get_scratch_cloud, get_tw_cloud
  File "C:\Users\myname\AppData\Roaming\Python\Python312\site-packages\scratchattach\cloud\__init__.py", line 1, in <module>
    from ._base import *
  File "C:\Users\myname\AppData\Roaming\Python\Python312\site-packages\scratchattach\cloud\_base.py", line 27, in <module>
    from ..site.session import Session
  File "C:\Users\myname\AppData\Roaming\Python\Python312\site-packages\scratchattach\site\session.py", line 30, in <module>
    from . import activity, classroom, forum, studio, user, project, backpack_asset
  File "C:\Users\myname\AppData\Roaming\Python\Python312\site-packages\scratchattach\site\activity.py", line 6, in <module>
    from . import user, project, studio
  File "C:\Users\myname\AppData\Roaming\Python\Python312\site-packages\scratchattach\site\user.py", line 8, in <module>
    from ..eventhandlers import message_events
  File "C:\Users\myname\AppData\Roaming\Python\Python312\site-packages\scratchattach\eventhandlers\message_events.py", line 5, in <module>
    from ._base import BaseEventHandler
  File "C:\Users\myname\AppData\Roaming\Python\Python312\site-packages\scratchattach\eventhandlers\_base.py", line 8, in <module>
    from . import cloud_recorder
  File "C:\Users\myname\AppData\Roaming\Python\Python312\site-packages\scratchattach\eventhandlers\cloud_recorder.py", line 4, in <module>
    from .cloud_events import CloudEvents
  File "C:\Users\myname\AppData\Roaming\Python\Python312\site-packages\scratchattach\eventhandlers\cloud_events.py", line 4, in <module>
    from ..cloud._base import AnyCloud
ImportError: cannot import name 'AnyCloud' from partially initialized module 'scratchattach.cloud._base' (most likely due to a circular import) (C:\Users\myname\AppData\Roaming\Python\Python312\site-packages\scratchattach\cloud\_base.py)
>>> 

This error occurs when I clone the repo from source.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions