Applying winpdb_reborn

Cameron Simpson cs at cskk.id.au
Fri May 28 19:07:52 EDT 2021


On 28May2021 08:34, Rich Shepard <rshepard at appl-ecosys.com> wrote:
>I'm trying to debug a module of a PyQt5 application using winpdb_reborn.
>When I invoke the debugger with the module's name I get an empty winpdb
>window and the console tells me that it cannot find RPDBTERM. The full
>traceback is attached.
[...]
>Traceback (most recent call last):
>  File "/usr/lib64/python3.7/site-packages/winpdb.py", line 1288, in __wrapper
>    self.m_f(*args, **kwargs)
>  File "/usr/lib64/python3.7/site-packages/rpdb/session_manager.py", line 197, in launch
>    return self.__smi.launch(fchdir, command_line, interpreter, fload_breakpoints)
>  File "/usr/lib64/python3.7/site-packages/rpdb/session_manager.py", line 1160, in launch
>    self._spawn_server(fchdir, ExpandedFilename, args, rid, interpreter)
>  File "/usr/lib64/python3.7/site-packages/rpdb/session_manager.py", line 1269, in _spawn_server
>    terminal_command = CalcTerminalCommand()
>  File "/usr/lib64/python3.7/site-packages/rpdb/session_manager.py", line 2385, in CalcTerminalCommand
>    if RPDBTERM in os.environ:
>NameError: name 'RPDBTERM' is not defined

It looks to me like a straight up bug in rpdb. I'd expect that line to 
read:

    if 'RPDBTERM' in os.environ:

The easiest fix might be this (in your code, at the top):

    import builtins
    builtins.RPDBTERM = os.environ.get('TERM')

that way the offending code can at least find the name RPDBTERM in the 
builtin names (just like "print" can always be found).

It's a hack, but will at least make that line work. I do not know if the 
value of your $TERM environment variable is suitable, I'm just guessing.  
You'd need to read the code in 
/usr/lib64/python3.7/site-packages/rpdb/session_manager.py if it seemed 
unsuitable.

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Python-list mailing list