Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug module #21

Closed
rysson opened this issue Sep 27, 2019 · 2 comments
Closed

Debug module #21

rysson opened this issue Sep 27, 2019 · 2 comments

Comments

@rysson
Copy link

rysson commented Sep 27, 2019

It looks great, but I need some help.

How to debug my module? In pure python I type:

python3 -m mymodule

With

trepan3k transys/

I've got

[Errno 21] Is a directory: '/projects/mymodule'
trepan3k: That's all, folks...

With

trepan3k transys/__main__.py

I've got:

Traceback (most recent call last):
  File "/projects/.venv/bin/trepan3k", line 10, in <module>
    sys.exit(main())
  File "/projects/.venv/lib/python3.7/site-packages/trepan/cli.py", line 212, in main
    normal_termination = dbg.run_script(mainpyfile)
  File "/projects/.venv/lib/python3.7/site-packages/trepan/debugger.py", line 217, in run_script
    exec(compiled, globals_, locals_)
  File "/projects/mymodule/__main__.py", line 2, in <module>
    from . import main
  File "/projects/.venv/lib/python3.7/site-packages/tracer.py", line 123, in _tracer_func
    if not hook.trace_fn(frame, event, arg):
  File "/projects/.venv/lib/python3.7/site-packages/trepan/lib/core.py", line 443, in trace_dispatch 
    return self.processor.event_processor(frame, self.event, arg)
  File "/projects/.venv/lib/python3.7/site-packages/trepan/processor/cmdproc.py", line 465, in event_processor
    self.process_commands()
  File "/projects/.venv/lib/python3.7/site-packages/trepan/processor/cmdproc.py", line 643, in process_commands
    self.location()
  File "/projects/.venv/lib/python3.7/site-packages/trepan/processor/cmdproc.py", line 360, in <lambda>
    self.location         = lambda : print_location(self)
  File "/projects/.venv/lib/python3.7/site-packages/trepan/processor/cmdproc.py", line 267, in print_location 
    fd.write(''.join(lines))
  File "/projects/.venv/lib/python3.7/tempfile.py", line 620, in func_wrapper
    return func(*args, **kwargs)
TypeError: a bytes-like object is required, not 'str'
Uncaught exception. Entering post-mortem debugger...
(/projects/.venv/lib/python3.7/tempfile.py:620 @6): func_wrapper
!! 620                 return func(*args, **kwargs)
R=> (<class 'TypeError'>, TypeError("a bytes-like object is required, not 'str'"), <traceback object at 0x7f6e97628b08>)
(Trepan3k:pm)

And how to install trepan3k to catch build-in breakpoint()?

@rocky
Copy link
Owner

rocky commented Sep 27, 2019

First, I should say that trepan3k is in need of a major overhaul to keep up to date with changing Python. It was written even before Python 3.0 and Python has changed a lot since then. In particular 3.7, added breakpoint().

However if you look at the upvotes of this project versus others, this project doesn't even rank in the top 6 projects of things that I done. (Not in the top 7 if you consider projects that I wrote but now have spun off into a separate organization like realgud).

This code is open source, so anyone can take interest in it and start working on it. However the support I've gotten from the Python community has largely been negative.

As I need to use Python3 (and use it successfully with all of its warts, many times when I develop Python), I'll probably work on this sometime in the future.

The second thing I'll say is that it just doesn't feel like you've looked at the extensive documentation that I've spent a lot of time writing. See https://python3-trepan.readthedocs.io/en/latest/entry-exit.html#entering-the-trepan-debugger and the secton under that called "calling the debugger from your program".

So before I try answering your questions, would you please read the docs first and see if that clears things up? Thanks (and upvote the project if you think it worthwhile for me to work on it - if not, then don't bother.)

@rysson
Copy link
Author

rysson commented Sep 27, 2019

Thanks a lot for your answer.

Yes, it's true, I've read documentation very cursory and 've messed old style invoking (It's strange, I called pdb in this way many times before). Thanks for point the section.

When I just googled better debugger for Python and I found your project on first google page. It looks very interesting.

OK, I close issue and, start reading docs and I will vote everywhere I found your project.
Thanks for your work.

@rysson rysson closed this as completed Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants