pudb icon indicating copy to clipboard operation
pudb copied to clipboard

'm' module load shows AttributeError: 'NoneType' object has no attribute 'rfind'

Open bedge opened this issue 7 years ago • 1 comments

I'm new to pudb so please forgive noob errors.

Immediately on starting pudb , the 'm' key does show a list of modules, however none of mine are present. (presumably because they have not yet been imported?) I'm guessing I need to load the module (via 'm') so I can set a breakpoint as I don't want to have to step all the way there.

I break after all the main's import statements are loaded (assuming that my module should be present in the list presented by 'm' now), I get this:

The program has terminated abnormally because of an exception.                                                                                                           
                                                                                                                                                                         
A full traceback is below. You may recall this traceback at any time using the 'e' key. The debugger has entered post-mortem mode and will prevent further state changes.
                                                                                                                                                                         
Traceback (most recent call last):                                                                                                                                       
  File "/usr/local/lib/python2.7/dist-packages/pudb/__init__.py", line 93, in runscript                                                                                  
    dbg._runscript(mainpyfile)                                                                                                                                           
  File "/usr/local/lib/python2.7/dist-packages/pudb/debugger.py", line 444, in _runscript                                                                                
    self.run(statement, globals=globals_, locals=locals_)                                                                                                                
  File "/usr/lib/python2.7/bdb.py", line 400, in run                                                                                                                     
    exec cmd in globals, locals                                                                                                                                          
  File "<string>", line 1, in <module>                                                                                                                                   
  File "/usr/bin/mlingestor-cli.py", line 16, in <module>                                                                                                                
    from mlutil.sqs.util import get_queue, delete_message                                                                                                                
  File "/usr/bin/mlingestor-cli.py", line 16, in <module>                                                                                                                
    from mlutil.sqs.util import get_queue, delete_message                                                                                                                
  File "/usr/lib/python2.7/bdb.py", line 49, in trace_dispatch                                                                                                           
    return self.dispatch_line(frame)                                                                                                                                     
  File "/usr/local/lib/python2.7/dist-packages/pudb/debugger.py", line 175, in dispatch_line                                                                             
    self.user_line(frame)                                                                                                                                                
  File "/usr/local/lib/python2.7/dist-packages/pudb/debugger.py", line 396, in user_line                                                                                 
    self.interaction(frame)                                                                                                                                              
  File "/usr/local/lib/python2.7/dist-packages/pudb/debugger.py", line 364, in interaction                                                                               
    show_exc_dialog=show_exc_dialog)                                                                                                                                     
  File "/usr/local/lib/python2.7/dist-packages/pudb/debugger.py", line 2113, in call_with_ui                                                                             
    return f(*args, **kwargs)                                                                                                                                            
  File "/usr/local/lib/python2.7/dist-packages/pudb/debugger.py", line 2344, in interaction                                                                              
    self.event_loop()                                                                                                                                                    
  File "/usr/local/lib/python2.7/dist-packages/pudb/debugger.py", line 2310, in event_loop                                                                               
    toplevel.keypress(self.size, k)                                                                                                                                      
  File "/usr/local/lib/python2.7/dist-packages/pudb/ui_tools.py", line 96, in keypress                                                                                   
    result = self._w.keypress(size, key)                                                                                                                                 
  File "/usr/local/lib/python2.7/dist-packages/urwid/container.py", line 1128, in keypress                                                                               
    return self.body.keypress( (maxcol, remaining), key )                                                                                                                
  File "/usr/local/lib/python2.7/dist-packages/urwid/container.py", line 2269, in keypress                                                                               
    key = w.keypress((mc,) + size[1:], key)                                                                                                                              
  File "/usr/local/lib/python2.7/dist-packages/urwid/container.py", line 1587, in keypress                                                                               
    key = self.focus.keypress(tsize, key)                                                                                                                                
  File "/usr/local/lib/python2.7/dist-packages/pudb/ui_tools.py", line 101, in keypress                                                                                  
    return handler(self, size, key)                                                                                                                                      
  File "/usr/local/lib/python2.7/dist-packages/pudb/debugger.py", line 1365, in pick_module                                                                              
    build_filtered_mod_list(filt_edit.get_edit_text()))                                                                                                                  
  File "/usr/local/lib/python2.7/dist-packages/pudb/debugger.py", line 1329, in build_filtered_mod_list                                                                  
    for name, mod in list(sys.modules.items())                                                                                                                           
  File "/usr/local/lib/python2.7/dist-packages/pudb/debugger.py", line 1330, in <genexpr>                                                                                
    if mod_exists(mod))                                                                                                                                                  
  File "/usr/local/lib/python2.7/dist-packages/pudb/debugger.py", line 1311, in mod_exists                                                                               
    base, ext = splitext(filename)                                                                                                                                       
  File "/usr/lib/python2.7/posixpath.py", line 98, in splitext                                                                                                           
    return genericpath._splitext(p, sep, altsep, extsep)                                                                                                                 
  File "/usr/lib/python2.7/genericpath.py", line 99, in _splitext                                                                                                        
    sepIndex = p.rfind(sep)                                                                                                                                              
AttributeError: 'NoneType' object has no attribute 'rfind'                                                                                                               

One thing that I'm doing that may be affecting this is that I have a

 sys.path.extend(['src', 'mylibs/src'])

in my source to expand my PYTHONPATH. Is that not allowed with pudb?

The mlutil stuff in the stack frame is mine, however, as I mentioned, this shows up when I hit 'm' to load modules, not as part of runtime operation.

bedge avatar Jun 22 '17 17:06 bedge

Looks like probably a bug in PuDB. Would have to investigate further.

asmeurer avatar Jun 22 '17 17:06 asmeurer