简体   繁体   中英

python-anvil-app-server: can you run the python debuggor pdb or ipdb on the server side code?

  • i'm doing some web development with python's anvil-app-server https://pypi.org/project/anvil-app-server/
  • i would like to use the debugger because it is a powerful/useful tool on the server side python code
  • i generated a hello-world application named ServerSidePdb
  • i put pdb and ipdb into the server side callback for the helloworld generated application and got a console output that looks like an error:
Calling function 'say_hello_name' for app 'ServerSidePdb' (ID client-q5jGe8vXpy/ATVXEjmwQAw==)
[DEBUG anvil.app-server.run] [SERVER] > /home/trevor/workspace/anvil/MyApp/ServerModule1.py(13)say_hello_name()
Worker terminated for IDs set() (return code -9)
[DEBUG anvil.app-server.run] [SERVER] (Pdb) 
[ERROR anvil.app-server.run] Error report from client code:
AnvilWrappedError: [unexpected error]
Traceback:
  /usr/lib64/python3.6/bdb.py:70

  /usr/lib64/python3.6/bdb.py:51

  MyApp/ServerModule1.py:13

  MyApp/ServerModule1.py:13

  app/MyApp/Form1/__init__.py:15

can you run the python debuggor pdb or ipdb on the server side code? if yes, how?

  • the server side code executes under a java server and the java server captures the stdin/stdout which prevents you from directly running pdb or ipdb
  • i've heard vscode has a good remote debug capability so that might be a way to jump into the debugger
    • all the anvil server callbacks have a 30 second timeout
    • so make sure you only try to debug in a anvil background task (or i think the timeout will stop you prematurely)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM