-
Notifications
You must be signed in to change notification settings - Fork 905
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
Make sure script modules get added to sys.modules #1614
base: main
Are you sure you want to change the base?
Conversation
unfortunately this is going to break lots of things when they share same module name |
I rolled back my extension to an older commit which was afflicted by #1605 It loads right up without error. Despite the cosmetic issues, the extension works in this state, the buttons all do what they are supposed to, etc. |
Probably too optimistic, but are the likely duplicates all preload.py's from other scripts or are you worried about something conflicting elsewhere?
Resulting console log snippet with load_scripts() call moved to end of initialize_rest() for kicks.
cnet seemed to work, and its preload still fired; but I know that's a flimsy test. |
Just sharing another example for extension affected by the inheritence bug continue-revolution/sd-webui-segment-anything#211 (comment) |
Long existing bug that Gradio 4 uncovered mainly in extensions. The importlib docs (and relevant cpython issue) detail the need to add the module created from spec to the
sys.modules
list.More details: new in Gradio 4, the new
Component
base classComponentBase
explicitly uses the file containing a component for an id value. For certain extensions that subclassed a GradioComponent
this could lead to the extension failing to load due to the above Gradio code. See examples here and here.Should address issues #1605, part of #1599, and #1466