inducer / pudb

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

Open-module-command throws TypeError in conda-environment with matplotlib #327

Closed astier closed 5 years ago

astier commented 5 years ago

Problem

Pressing the key m in a pudb-session in a conda-environment where matplotlib is installed throws a TypeError and leaves me in the POST-MORTEM MODE. When I press m a second time pudb crashes with the same exception.

Traceback (most recent call last):
  File "/home/aleks/miniconda3/envs/mdp/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/aleks/miniconda3/envs/mdp/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/aleks/miniconda3/envs/mdp/lib/python3.7/site-packages/pudb/run.py", line 38, in <module>
    main()
  File "/home/aleks/miniconda3/envs/mdp/lib/python3.7/site-packages/pudb/run.py", line 34, in main
    steal_output=options.steal_output)
  File "/home/aleks/miniconda3/envs/mdp/lib/python3.7/site-packages/pudb/__init__.py", line 126, in runscript
    dbg.interaction(None, sys.exc_info())
  File "/home/aleks/miniconda3/envs/mdp/lib/python3.7/site-packages/pudb/debugger.py", line 376, in interaction
    show_exc_dialog=show_exc_dialog)
  File "/home/aleks/miniconda3/envs/mdp/lib/python3.7/site-packages/pudb/debugger.py", line 2118, in call_with_ui
    return f(*args, **kwargs)
  File "/home/aleks/miniconda3/envs/mdp/lib/python3.7/site-packages/pudb/debugger.py", line 2362, in interaction
    self.event_loop()
  File "/home/aleks/miniconda3/envs/mdp/lib/python3.7/site-packages/pudb/debugger.py", line 2328, in event_loop
    toplevel.keypress(self.size, k)
  File "/home/aleks/miniconda3/envs/mdp/lib/python3.7/site-packages/pudb/ui_tools.py", line 106, in keypress
    result = self._w.keypress(size, key)
  File "/home/aleks/miniconda3/envs/mdp/lib/python3.7/site-packages/urwid/container.py", line 1131, in keypress
    return self.body.keypress( (maxcol, remaining), key )
  File "/home/aleks/miniconda3/envs/mdp/lib/python3.7/site-packages/urwid/container.py", line 2271, in keypress
    key = w.keypress((mc,) + size[1:], key)
  File "/home/aleks/miniconda3/envs/mdp/lib/python3.7/site-packages/urwid/container.py", line 1590, in keypress
    key = self.focus.keypress(tsize, key)
  File "/home/aleks/miniconda3/envs/mdp/lib/python3.7/site-packages/pudb/ui_tools.py", line 111, in keypress
    return handler(self, size, key)
  File "/home/aleks/miniconda3/envs/mdp/lib/python3.7/site-packages/pudb/debugger.py", line 1355, in pick_module
    build_filtered_mod_list(filt_edit.get_edit_text()))
  File "/home/aleks/miniconda3/envs/mdp/lib/python3.7/site-packages/pudb/debugger.py", line 1319, in build_filtered_mod_list
    for name, mod in list(sys.modules.items())
  File "/home/aleks/miniconda3/envs/mdp/lib/python3.7/site-packages/pudb/debugger.py", line 1320, in <genexpr>
    if mod_exists(mod))
  File "/home/aleks/miniconda3/envs/mdp/lib/python3.7/site-packages/pudb/debugger.py", line 1301, in mod_exists
    base, ext = splitext(filename)
  File "/home/aleks/miniconda3/envs/mdp/lib/python3.7/posixpath.py", line 122, in splitext
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

Steps to reproduce

  1. echo 'print("Test")' > test.py
  2. conda create -n test matplotlib
  3. conda activate test
  4. pip install pudb
  5. python -m pudb.run test.py
  6. Press m and see the error
jojonki commented 5 years ago

I faced the same problem. Why did you close this issue? Here is the report. https://stackoverflow.com/questions/55737826/pudb3-raises-typeerror-when-i-try-to-open-modules

inducer commented 5 years ago

Yikes. Turns out this has been fixed on master for a long time (which was the reason why I couldn't reproduce it), but had never been part of a release. Time to do a release... 2019.1 is up on the package index. This should address the issue. Let me know (and reopen this issue) if not.

jojonki commented 5 years ago

I doubt the problem was related to Conda environment path. Though, after I have re-installed anaconda, the problem disappeared. I will open this issue when I found the way to reproduce the problem.

wackrat commented 4 years ago

I believe #309 solved this problem.