Spaces:
Runtime error
The startup error handler itself crashes: app.py uses sys.exit without importing sys, hiding the real failure
This Space's runtime error ends with:
AttributeError: 'str' object has no attribute 'name'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/app.py", line 34, in <module>
sys.exit(1)
^^^
NameError: name 'sys' is not defined. Did you forget to import 'sys'?
app.py calls sys.exit(1) in two places (when the APP environment variable is unset, and when executing it fails), but its import block โ os, re, time, tempfile, io, random, string, torch and friends โ never imports sys. So whenever the guard actually fires, the handler raises NameError and the original problem is buried under it. I reproduced the guard's exact shape in isolation: with APP unset it prints the warning and then raises NameError: name 'sys' is not defined instead of exiting cleanly.
The one-line fix is import sys with the other imports. With that in place, the first failure โ the AttributeError: 'str' object has no attribute 'name' raised while executing the APP script โ becomes the visible error to fix next, instead of the handler's own crash.