Whitetrade / fixer.py
VinpolarX's picture
Create fixer.py
743a652 verified
raw
history blame contribute delete
907 Bytes
import os
def fix_app_code():
if not os.path.exists("app.py"): return
with open("app.py", "r", encoding="utf-8") as f:
lines = f.readlines()
fixed_lines = []
for line in lines:
# تصحيح خطأ إملائي شهير وقعنا فيه
new_line = line.replace("import gardio", "import gradio")
# تصحيح منطق الإزاحة البسيطة (مثال)
if "yf.download" in line and not line.startswith(" "):
new_line = " " + line.lstrip()
fixed_lines.append(new_line)
with open("app.py", "w", encoding="utf-8") as f:
f.writelines(fixed_lines)
print("✅ تم فحص وتصحيح الأخطاء تلقائياً!")
if __name__ == "__main__":
fix_app_code()
# بعد الإصلاح، قم بتشغيل التطبيق الحقيقي
os.system("python app.py")