inducer / pudb

Full-screen console debugger for Python
https://documen.tician.de/pudb/
Other
2.97k stars 229 forks source link

toggle breakpoints in .txt file accidently #73

Open oliveagle opened 11 years ago

oliveagle commented 11 years ago

I'm using vim-pudb to toggle breakpoints directly while editing the python file. Accidently, I press my shortcut keybinds to toggle a breakpoint on a .txt file. then pudb crashed. it throws out an syntax error.

[oliveagle@myhost python ]$ pudb test.py Traceback (most recent call last): File "/usr/local/share/python/pudb", line 9, in load_entry_point('pudb==2013.2', 'console_scripts', 'pudb')() File "/Library/Python/2.7/site-packages/pudb/run.py", line 30, in main steal_output=options.steal_output) File "/Library/Python/2.7/site-packages/pudb/init.py", line 24, in runscript dbg = _get_debugger(steal_output=steal_output) File "/Library/Python/2.7/site-packages/pudb/init.py", line 12, in _get_debugger dbg = Debugger(**kwargs) File "/Library/Python/2.7/site-packages/pudb/debugger.py", line 151, in init for bpoint_descr in load_breakpoints(): File "/Library/Python/2.7/site-packages/pudb/settings.py", line 409, in load_breakpoints return parse_breakpoints(lines) File "/Library/Python/2.7/site-packages/pudb/settings.py", line 375, in parse_breakpoints if get_breakpoint_invalid_reason(filename, lineno) is None: File "/Library/Python/2.7/site-packages/pudb/lowlevel.py", line 48, in get_breakpoint_invalid_reason if lineno not in get_executable_lines_for_file(filename): File "/Library/Python/2.7/site-packages/pudb/lowlevel.py", line 23, in get_executable_lines_for_file codes = [compile("".join(getlines(filename)), filename, "exec")] File "/usr/local/share/vim/vim73/doc/help.txt", line 1 help.txt For Vim version 7.3. Last change: 2010 Jul 20 ^

pudb come back after delete that breakpoint in saved-breakpoints directly.

So. I think pudb should check whether a breakpoint is added from a .py file or not before save that breakpoint in 'saved-breakpoints' file. and handle exceptions gracefully while parsing breakpoints.

p.s. It would be better to make it clear where to find those 'saved-breakpoints' file without dig into the source code.

inducer commented 11 years ago

Makes sense, sorry for the trouble. I'm kind of swamped right now, but I'd be happy to take a patch.

asmeurer commented 11 years ago

I added an item to the FAQ about where breakpoints are stored in #74. See what you think.

oliveagle commented 11 years ago

bravo :D

oliveagle

QQ: 54679821

微博: @奔跑在高架上 Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Saturday, June 1, 2013 at 1:09 AM, Aaron Meurer wrote:

I added an item to the FAQ about where breakpoints are stored in #74 (https://github.com/inducer/pudb/issues/74). See what you think.

— Reply to this email directly or view it on GitHub (https://github.com/inducer/pudb/issues/73#issuecomment-18758132).