Suche hilfe, Backend startet nicht, Fehlerbehebung

  • Ich programmiere gerade eine Anwendung. Ich muss sagen, dass ich mehr oder weniger ein totaler Anfänger bin. Aber ich will es trotzdem machen.

    Seit einer Woche hänge ich mit dem Backend fest (ich habe das Frontend und es scheint zu funktionieren) das backend will einfach nicht starten. ich habe die AI gefragt, hier im Forum nach Lösungen gesucht... nichts hat wirklich geholfen. Ich habe etwas gefunden, aber anscheinend ist die Lösung nicht optimal. utf-8 = ISO-8859-1, weil das Problem einfach ignoriert wird, aber nicht gelöst.

    Kann mir jemand helfen?

    Dies wird in der Eingabeaufforderung angezeigt:

    C:\Users\train\Desktop\App\backend>python app.py Traceback (most recent call last): File "C:\Users\train\Desktop\App\backend\app.py", line 433, in <module> db.create_all() # Create database tables ^^^^^^^^^^^^^^^ File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_sqlalchemy\extension.py", line 900, in create_all self._call_for_binds(bind_key, "create_all") File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_sqlalchemy\extension.py", line 881, in _call_for_binds getattr(metadata, op_name)(bind=engine) File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\sql\schema.py", line 5868, in create_all bind._run_ddl_visitor( File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 3252, in _run_ddl_visitor with self.begin() as conn: ^^^^^^^^^^^^ File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 137, in enter return next(self.gen) ^^^^^^^^^^^^^^ File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 3242, in begin with self.connect() as conn: ^^^^^^^^^^^^^^ File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 3278, in connect return self._connection_cls(self) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 146, in init self._dbapi_connection = engine.raw_connection() ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 3302, in raw_connection return self.pool.connect() ^^^^^^^^^^^^^^^^^^^ File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 445, in connect return _ConnectionFairy._checkout(self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 1259, in _checkout fairy = _ConnectionRecord.checkout(pool) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 708, in checkout rec = pool._do_get() ^^^^^^^^^^^^^^ File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\impl.py", line 179, in _do_get with util.safe_reraise(): ^^^^^^^^^^^^^^^^^^^ File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 146, in exit raise exc_value.with_traceback(exc_tb) File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\impl.py", line 177, in _do_get return self._create_connection() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 386, in _create_connection return _ConnectionRecord(self) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 670, in init self.__connect() File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect with util.safe_reraise(): ^^^^^^^^^^^^^^^^^^^ File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 146, in exit raise exc_value.with_traceback(exc_tb) File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 892, in __connect self.dbapi_connection = connection = pool.invoke_creator(self) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\create.py", line 643, in connect return dialect.connect(*cargs, **cparams) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\default.py", line 621, in connect return self.loaded_dbapi.connect(*cargs, **cparams) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\train\AppData\Local\Programs\Python\Python312\Lib\site-packages\psycopg2_init.py", line 122, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfc in position 97: invalid start byte


    ich habe die KI gefragt, nach Lösungen hier im Forum gesucht. utf-8 = ISO-8859-1, Flask, psycopg2-binary, python, postgresql-17.2-3 aktualisiert, die uri geändert und es codiert.

  • Was ist denn auf Position 97? Geht ja scheinbar um irgendwas mit Datenbanken, so viel kann man rauslesen.

    A red dragon falls from the heavens... Ah, that memory has been lost. A shame. It was a favorite of mine...

  • Danke für deine Antwort.
    Auf der Line 97 von backend/app.py, Ist der Code:

    Code
    97|                 'kty': key['kty'],


    Ja, ich wollte PostSQL 17 einbinden. Das läuft.
    Ich möchte eine mobile App programmieren. Ich verwendete Python, CSS, Javascript und HTML
    Was für allfällige Informationen bräuchtest du? Den Code aus Config.json?

    from datetime import datetime, timedelta
    from flask import Flask, request, jsonify
    from flask_socketio import SocketIO, emit
    from flask_sqlalchemy import SQLAlchemy
    import threading
    import time
    import jwt
    import requests
    from functools import wraps
    import json


    Ah utf-8 = ISO-8859-1 habe ich versucht, das ist offenbar aber nicht gut, da das Problem nur ignoriert wird, aber nicht gelöst.

    Einmal editiert, zuletzt von Dash (15. Februar 2025 um 17:28)

  • Ich selber habe mit Python nichts am hut

    Aber chatgpt sieht das ganz klar:

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!