Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
e67a56db
Commit
e67a56db
authored
Sep 03, 2022
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix to make scripts that failed to compile not crash the program
parent
226de5e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
11 deletions
+15
-11
modules/scripts.py
modules/scripts.py
+15
-11
No files found.
modules/scripts.py
View file @
e67a56db
...
@@ -41,17 +41,21 @@ def load_scripts(basedir):
...
@@ -41,17 +41,21 @@ def load_scripts(basedir):
with
open
(
path
,
"r"
,
encoding
=
"utf8"
)
as
file
:
with
open
(
path
,
"r"
,
encoding
=
"utf8"
)
as
file
:
text
=
file
.
read
()
text
=
file
.
read
()
from
types
import
ModuleType
try
:
compiled
=
compile
(
text
,
path
,
'exec'
)
from
types
import
ModuleType
module
=
ModuleType
(
filename
)
compiled
=
compile
(
text
,
path
,
'exec'
)
exec
(
compiled
,
module
.
__dict__
)
module
=
ModuleType
(
filename
)
exec
(
compiled
,
module
.
__dict__
)
for
key
,
script_class
in
module
.
__dict__
.
items
():
if
type
(
script_class
)
==
type
and
issubclass
(
script_class
,
Script
):
for
key
,
script_class
in
module
.
__dict__
.
items
():
obj
=
script_class
()
if
type
(
script_class
)
==
type
and
issubclass
(
script_class
,
Script
):
obj
.
filename
=
path
obj
=
script_class
()
obj
.
filename
=
path
scripts
.
append
(
obj
)
scripts
.
append
(
obj
)
except
Exception
:
print
(
f
"Error loading script: {filename}"
,
file
=
sys
.
stderr
)
print
(
traceback
.
format_exc
(),
file
=
sys
.
stderr
)
def
wrap_call
(
func
,
filename
,
funcname
,
*
args
,
default
=
None
,
**
kwargs
):
def
wrap_call
(
func
,
filename
,
funcname
,
*
args
,
default
=
None
,
**
kwargs
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment