How can I get the stack trace of a PythonFlask/ React app, when the exception is caught?

32 Views Asked by At

I am working with a flask/react app (openplayground), which is not working correctly (on pressing a submit button on the web page, an error dialog opens with the message: "can only concatenate str (not "NoneType") to str"

The same message is written to the terminal window in which I started the app using

python3 -m server.app --host 0.0.0.0 --port 5432

The message looks as follows:

ERROR:server.lib.inference:Error: can only concatenate str (not "NoneType") to str

It seems that the python module throws an exception, which is caught and the error message text is passed back to the frontend.

But even the extended message in the terminl windows is not very helpful to me, since I cannot find out where EXACTLY the error occured. Ideally, I would get hold of the full stack trace to find out the code line number where the exception occured.

How can I do this? Is there a way to force the python interpreter to print the stack trace anyways? Or can I change the module's code so that the trace is printed? Any other way to find out what happened?

EDIT:

On clicking the button, an error is reported by the developer's console fo Firefox. I think it is related to the exception thrown by the python interpreter and maybe it is helpful:

Firefox can’t establish a connection to the server at ws://a.b.c.d/1234

BTW, the port 1234 on the Debian based VM is open, but according to netstat no service is listening there.

0

There are 0 best solutions below