pudb icon indicating copy to clipboard operation
pudb copied to clipboard

Reloading modules messes up the UI

Open rudolfkral opened this issue 5 years ago • 2 comments

To reproduce:

First case:

  1. Load up a file
  2. Open the module menu(m)
  3. Choose file/module that you're running
  4. Choose "OK"

Second case(eligible after first):

  1. Open the module menu(m)
  2. Choose file/module that you're running
  3. Choose "Reload"

Shown in following recording:

pudb_error

(pudb) ➜  pudb-373 python -V
Python 3.7.2
(pudb) ➜  pudb-373 pip freeze
appdirs==1.4.3
attrs==19.3.0
black==19.10b0
certifi==2019.11.28
chardet==3.0.4
Click==7.0
codecov==2.0.5
coverage==4.3.4
idna==2.9
importlib-metadata==1.5.0
jedi==0.15.2
numpy==1.18.1
parso==0.6.1
pathspec==0.7.0
pbr==2.0.0
pluggy==0.13.1
-e git+http://git.tiker.net/trees/pudb.git@3f041b88b7cf623a22d50e702663b1e3e8076f3c#egg=pudb
py==1.4.33
Pygments==2.2.0
pyls-black==0.4.4
pyspark==2.4.4
pytest==3.0.7
pytest-cov==2.4.0
pytest-mock==1.10.0
python-jsonrpc-server==0.3.4
python-language-server==0.31.8
regex==2020.2.20
requests==2.23.0
six==1.10.0
toml==0.10.0
typed-ast==1.4.1
ujson==1.35
urllib3==1.25.8
urwid==1.3.1
zipp==3.0.0

Redrawing the screen after pick_module and call_with_ui appears to fix this issue. Result on following recording.

pudb_fixed

Do you think that forcing redrawing the screen is a good enough fix here? I can attach it as a PR, if yes.

I have noticed that the issue happens only when you try to reload your own file/module. That may point to another, cleaner solution, but I don't have it in mind yet.

rudolfkral avatar Feb 22 '20 11:02 rudolfkral

I think the better option would be to acknowledge that reloading a module can execute arbitrary code (and produce output) and switch away from the UI.

inducer avatar Feb 22 '20 20:02 inducer

This would have the added advantage that that output is not lost.

inducer avatar Feb 22 '20 20:02 inducer