Skip to content

Pantograph doesn't work when a debugger is one eg vscode debugger #70

@brando90

Description

@brando90

I get this error:

Exception has occurred: AssertionError
Server failed to emit ready signal: 9.14s - pydevd: Sending message related to process being replaced timed-out after 5 seconds
; Maybe the project needs to be rebuilt
  File "/lfs/skampere1/0/brando9/PyPantograph/pantograph/server.py", line 161, in restart_async
    assert ready.rstrip() == "ready.", f"Server failed to emit ready signal: {ready}; Maybe the project needs to be rebuilt"
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lfs/skampere1/0/brando9/PyPantograph/pantograph/utils.py", line 16, in wrapper
    return asyncio.run(func(*args, **kwargs))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lfs/skampere1/0/brando9/PyPantograph/pantograph/server.py", line 78, in __init__
    self.restart()
  File "/lfs/skampere1/0/brando9/ZIP-FIT/zip_fit/lean_pass_k_unbiased.py", line 211, in main
    server = Server()
             ^^^^^^^^
  File "/lfs/skampere1/0/brando9/ZIP-FIT/zip_fit/lean_pass_k_unbiased.py", line 228, in <module>
    main()
AssertionError: Server failed to emit ready signal: 9.14s - pydevd: Sending message related to process being replaced timed-out after 5 seconds
; Maybe the project needs to be rebuilt

I think this is the reason:

Debugger or IDE Interference

Sometimes, when stepping through code with pydevd or other debuggers, the server’s stdout can be wrapped or redirected, or the Lean process gets confused. Pantograph never sees “ready.”
Try running your script outside of a step debugger (e.g., from the terminal) to see if that solves it.
...
C) Disable or Avoid Debugger Interference
If you see mention of “pydevd: Sending message related to process being replaced timed-out after 5 seconds,” it might be your Python debugger is interfering with the sub-process’s stdout.
Try running the script directly from the terminal (e.g. python my_script.py) with no breakpoints or debugger.
If that solves the problem, you know the debugger was messing with sub-process I/O.

This is essential for python dev and vscode is the standard interface for lean anyway. I recommend to support this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions