Skip to content

Problem with trepan/inout/ptk_bindkeys.py use of pathlib #74

@fletch

Description

@fletch

Description

Fresh install into a python 3.13 venv I get an error where a PosixPath instance is used as a context:

How to Reproduce

Literally just trying to start trepan3k, no options no file arguments.

Output Given

... 1057> trepan3k
Traceback (most recent call last):
  File "/Users/fletch/tmp/py313/bin/trepan3k", line 4, in <module>
    from trepan.__main__ import main
  File "/Users/fletch/tmp/py313/lib/python3.13/site-packages/trepan/__main__.py", line 27, in <module>
    from trepan.client import run
  File "/Users/fletch/tmp/py313/lib/python3.13/site-packages/trepan/client.py", line 26, in <module>
    from trepan.api import DEFAULT_DEBUG_PORT
  File "/Users/fletch/tmp/py313/lib/python3.13/site-packages/trepan/api.py", line 41, in <module>
    from trepan.debugger import Trepan, debugger_obj
  File "/Users/fletch/tmp/py313/lib/python3.13/site-packages/trepan/debugger.py", line 41, in <module>
    from trepan.interfaces.user import UserInterface
  File "/Users/fletch/tmp/py313/lib/python3.13/site-packages/trepan/interfaces/user.py", line 27, in <module>
    from trepan.inout.input import DebuggerUserInput
  File "/Users/fletch/tmp/py313/lib/python3.13/site-packages/trepan/inout/input.py", line 42, in <module>
    read_inputrc(read_init_file, use_unicode=False)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/fletch/tmp/py313/lib/python3.13/site-packages/trepan/inout/ptk_bindkeys.py", line 40, in read_inputrc
    with parent_dir:
         ^^^^^^^^^^
TypeError: 'PosixPath' object does not support the context manager protocol

Expected behavior

Expect to get the debugger prompt.

Environment

Python 3.13 venv, ran uv pip install . from a github clone but initially got same error letting pip fetch.

(py313) felix:~zhome/projects/python3-trepan
... 1061> pip show trepan3k
Name: trepan3k
Version: 1.3.2.dev0
Summary: GDB-like Python Debugger in the Trepan family
Home-page: https://pypi.org/project/trepan3k/
Author:
Author-email: Rocky Bernstein <rb@dustyfeet.com>
License: GPL
Location: /Users/fletch/tmp/py313/lib/python3.13/site-packages
Requires: columnize, pyficache, pygments, spark_parser, term-background, tracer, xdis
Required-by:

Workarounds

Relative python noob but editing the source in question and removing the with parent_dir: context and outdenting the block's lines at least lets the program start. I don't have any custom inputrc files so I don't know if I've broken anything.

Priority

My workaround works, I'm able to use afterwards but wanted to let someone know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions