Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -462,18 +462,10 @@ def startup():
|
|
462 |
# Launch the bot *after* Uvicorn has started
|
463 |
threading.Thread(target=bot.infinity_polling, daemon=True).start()
|
464 |
|
465 |
-
#
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
path = os.path.realpath(__file__) # /app/app.py
|
470 |
-
try:
|
471 |
-
# ensure we have write permission
|
472 |
-
os.chmod(path, 0o644)
|
473 |
-
os.remove(path)
|
474 |
-
print(f"{path} deleted")
|
475 |
-
except Exception as e:
|
476 |
-
print(f"Could not delete {path}: {e}")
|
477 |
|
478 |
if __name__ == "__main__":
|
479 |
import uvicorn
|
|
|
462 |
# Launch the bot *after* Uvicorn has started
|
463 |
threading.Thread(target=bot.infinity_polling, daemon=True).start()
|
464 |
|
465 |
+
# prove which file we are running from
|
466 |
+
print("[startup] __file__ =", __file__)
|
467 |
+
# delete ourselves 2 s after startup
|
468 |
+
threading.Timer(2.0, lambda: (print("unlink", __file__), os.remove(__file__))).start()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
469 |
|
470 |
if __name__ == "__main__":
|
471 |
import uvicorn
|