From 0adfe7fcb959306ba297b56f1f4d98a2018cf65d Mon Sep 17 00:00:00 2001 From: Swee Date: Wed, 2 Oct 2024 21:56:40 -0700 Subject: [PATCH] fix paths --- sweebot-dashboard.py | 5 +++-- sweebot.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sweebot-dashboard.py b/sweebot-dashboard.py index b664a45..a8e84aa 100644 --- a/sweebot-dashboard.py +++ b/sweebot-dashboard.py @@ -3,6 +3,7 @@ from flask import send_file from flask import request from flask import redirect import os +from pathlib import Path from time import sleep as wait app = Flask(__name__) @@ -12,11 +13,11 @@ def index(): @app.route('/run.txt') def run(): wait(2) - return send_file("run.txt", mimetype='text/html') + return send_file(str(Path.home()) + "/run.txt", mimetype='text/html') @app.route('/block.txt') def block(): wait(2) - return send_file("block.txt", mimetype='text/html') + return send_file(str(Path.home()) + "/block.txt", mimetype='text/html') @app.route('/script.js') def script(): return send_file("script.js", mimetype='application/javascript') diff --git a/sweebot.py b/sweebot.py index 41fd6ee..20ef116 100644 --- a/sweebot.py +++ b/sweebot.py @@ -9,6 +9,7 @@ import re from random import choice, randint as random import traceback import threading +from pathlib import Path class config: def __init__(self): self.conn = sqlite3.connect(environ["SBconfig"]) @@ -147,8 +148,8 @@ block = 0 global times times = 0 def update(): - open("/home/swee/run.txt", 'w').write(str(run)) - open("/home/swee/block.txt", 'w').write(str(block)) + open(str(Path.home()) + "/run.txt", 'w').write(str(run)) + open(str(Path.home()) + "/block.txt", 'w').write(str(block)) update() def irci2():