question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

InputMode.REPLACE_SINGLE unhandled exception

See original GitHub issue

Description

pgcli throws an unhandled exception upon trying to perform a REPLACE_SINGLE operation when pressing “r” in vim normal mode

Unhandled exception in event loop:
  File "/usr/lib/python3.8/asyncio/events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "/home/iz/.local/lib/python3.8/site-packages/prompt_toolkit/eventloop/utils.py", line 72, in schedule
    func()
  File "/home/iz/.local/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 469, in redraw
    self._redraw()
  File "/home/iz/.local/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 536, in _redraw
    self.context.run(run_in_context)
  File "/home/iz/.local/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 522, in run_in_context
    self.renderer.render(self, self.layout)
  File "/home/iz/.local/lib/python3.8/site-packages/prompt_toolkit/renderer.py", line 629, in render
    layout.container.preferred_height(size.columns, size.rows).preferred,
  File "/home/iz/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 325, in preferred_height
    dimensions = [
  File "/home/iz/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 326, in <listcomp>
    c.preferred_height(width, max_available_height) for c in self._all_children
  File "/home/iz/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 2598, in preferred_height
    return self.content.preferred_height(width, max_available_height)
  File "/home/iz/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 1623, in preferred_height
    return self._merge_dimensions(
  File "/home/iz/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 1651, in _merge_dimensions
    preferred = get_preferred()
  File "/home/iz/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 1616, in preferred_content_height
    return self.content.preferred_height(
  File "/home/iz/.local/lib/python3.8/site-packages/prompt_toolkit/layout/controls.py", line 379, in preferred_height
    content = self.create_content(width, None)
  File "/home/iz/.local/lib/python3.8/site-packages/prompt_toolkit/layout/controls.py", line 392, in create_content
    fragments_with_mouse_handlers = self._get_formatted_text_cached()
  File "/home/iz/.local/lib/python3.8/site-packages/prompt_toolkit/layout/controls.py", line 358, in _get_formatted_text_cached
    return self._fragment_cache.get(
  File "/home/iz/.local/lib/python3.8/site-packages/prompt_toolkit/cache.py", line 41, in get
    value = getter_func()
  File "/home/iz/.local/lib/python3.8/site-packages/prompt_toolkit/layout/controls.py", line 359, in <lambda>
    get_app().render_counter, lambda: to_formatted_text(self.text, self.style)
  File "/home/iz/.local/lib/python3.8/site-packages/prompt_toolkit/formatted_text/base.py", line 78, in to_formatted_text
    return to_formatted_text(value(), style=style)
  File "/home/iz/.local/lib/python3.8/site-packages/prompt_toolkit/formatted_text/base.py", line 78, in to_formatted_text
    return to_formatted_text(value(), style=style)
  File "/usr/share/pgcli/pgcli/pgtoolbar.py", line 43, in get_toolbar_tokens
    ("class:bottom-toolbar", "[F4] Vi-mode (" + _get_vi_mode() + ")")
  File "/usr/share/pgcli/pgcli/pgtoolbar.py", line 8, in _get_vi_mode
    return {
  • Please provide your OS and version information. Ubuntu 20.04
  • Please provide your CLI version. Version: 2.2.0
  • What is the output of pip freeze command:
alembic==1.1.0.dev0
apturl==0.5.2
Babel==2.6.0
bcrypt==3.1.7
blinker==1.4
Brlapi==0.7.0
certifi==2019.11.28
chardet==3.0.4
chrome-gnome-shell==0.0.0
cli-helpers==2.1.0
Click==7.0
colorama==0.4.3
command-not-found==0.3
configobj==5.0.6
cryptography==2.8
cupshelpers==1.0
dbus-python==1.2.16
defer==1.0.6
distro==1.4.0
distro-info===0.23ubuntu1
entrypoints==0.3
Flask==1.1.1
Flask-BabelEx==0.9.3
Flask-Compress==1.4.0
Flask-Gravatar==0.4.2
Flask-Login==0.4.1
Flask-Mail==0.9.1
Flask-Migrate==2.5.2
Flask-Paranoid==0.2.0
Flask-Principal==0.4.0
Flask-Security-Too==3.4.2
Flask-SQLAlchemy==2.1
Flask-WTF==0.14.2
greenlet==0.4.15
httplib2==0.14.0
humanize==1.0.0
idna==2.8
isc==2.0
itsdangerous==1.1.0
Jinja2==2.10.1
keyring==18.0.1
language-selector==0.1
launchpadlib==1.10.13
lazr.restfulclient==0.14.2
lazr.uri==1.0.3
ldap3==2.4.1
louis==3.12.0
macaroonbakery==1.3.1
Mako==1.1.0
MarkupSafe==1.1.0
msgpack==0.6.2
netifaces==0.10.4
oauthlib==3.1.0
paramiko==2.6.0
passlib==1.7.2
pgcli==3.0.0
pgspecial==1.11.10
ply==3.11
prompt-toolkit==3.0.8
protobuf==3.6.1
psutil==5.5.1
psycopg2==2.8.5
pyasn1==0.4.2
pycairo==1.16.2
pycups==1.9.73
Pygments==2.3.1
PyGObject==3.36.0
pyinotify==0.9.6
PyJWT==1.7.1
pymacaroons==0.13.0
PyNaCl==1.3.0
pynvim==0.4.1
pyOpenSSL==19.0.0
pyRFC3339==1.1
python-apt==2.0.0+ubuntu0.20.4.1
python-dateutil==2.7.3
python-debian===0.1.36ubuntu1
pytz==2019.3
pyxdg==0.26
PyYAML==5.3.1
requests==2.22.0
requests-unixsocket==0.2.0
rofication==1.2.2
SecretStorage==2.3.1
setproctitle==1.1.10
simplejson==3.16.0
six==1.14.0
speaklater==1.4
SQLAlchemy==1.3.12
sqlparse==0.3.1
sshtunnel==0.1.4
systemd-python==234
tabulate==0.8.6
terminaltables==3.1.0
ubuntu-advantage-tools==20.3
ubuntu-drivers-common==0.0.0
ufw==0.36
unattended-upgrades==0.1
urllib3==1.25.8
wadllib==1.3.3
wcwidth==0.1.8
Werkzeug==0.16.1
WTForms==2.2.1
xkit==0.0.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
UriBarenholzcommented, Jul 21, 2021

I can confirm upgrading prompt-toolkit to 3.0.19 then pip install’ing pgcli (3.1.0) solved the problem (on ubuntu 20.04, python 3.8)

1reaction
Aprechecommented, Mar 15, 2021

I can confirm it is not fixed. I pip installed from master. pgcli --version reports Version: 3.1.0. If I enable vi = True in the pgcli config file, then I get the error as soon as I start pgcli. Also using Ubuntu 20.04 LTS on WSL.

Package                Version
---------------------- --------------------
appdirs                1.4.4
attrs                  19.3.0
Automat                0.8.0
awscli                 1.18.69
backcall               0.1.0
blinker                1.4
boto3                  1.7.84
botocore               1.20.9
certifi                2019.11.28
chardet                3.0.4
cli-helpers            2.1.0
cliapp                 1.20180812.1
Click                  7.0
cloud-init             20.4
cmdtest                0.32+git
colorama               0.4.3
command-not-found      0.3
configobj              5.0.6
constantly             15.1.0
cryptography           2.8
dbus-python            1.2.16
decorator              4.4.2
diff-highlight         1.2.0
distlib                0.3.0
distro                 1.4.0
distro-info            0.23ubuntu1
docutils               0.16
ec2instanceconnectcli  1.0.2
entrypoints            0.3
filelock               3.0.12
flake8                 3.8.2
httplib2               0.14.0
hyperlink              19.0.0
idna                   2.8
importlib-metadata     1.5.0
incremental            16.10.1
ipdb                   0.13.2
ipython                7.15.0
ipython-genutils       0.2.0
jedi                   0.17.0
Jinja2                 2.10.1
jmespath               0.10.0
jsonpatch              1.22
jsonpointer            2.0
jsonschema             3.2.0
keyring                18.0.1
language-selector      0.1
launchpadlib           1.10.13
lazr.restfulclient     0.14.2
lazr.uri               1.0.3
Markdown               3.1.1
MarkupSafe             1.1.0
mccabe                 0.6.1
more-itertools         4.2.0
netifaces              0.10.4
oauthlib               3.1.0
olefile                0.46
packaging              20.3
parso                  0.7.0
pbr                    5.4.5
pendulum               2.1.2
pexpect                4.8.0
pgcli                  3.1.0
pgspecial              1.12.1
pickleshare            0.7.5
Pillow                 7.0.0
pip                    21.0.1
prompt-toolkit         3.0.5
psycopg2               2.8.6
ptyprocess             0.6.0
pyasn1                 0.4.2
pyasn1-modules         0.2.1
pycodestyle            2.6.0
pyflakes               2.2.0
Pygments               2.6.1
PyGObject              3.36.0
PyHamcrest             1.9.0
PyJWT                  1.7.1
pymacaroons            0.13.0
PyNaCl                 1.3.0
pyOpenSSL              19.0.0
pyparsing              2.4.6
pyrsistent             0.15.5
pyserial               3.4
python-apt             2.0.0+ubuntu0.20.4.4
python-dateutil        2.8.1
python-debian          0.1.36ubuntu1
pytzdata               2020.1
PyYAML                 5.3.1
requests               2.22.0
requests-unixsocket    0.2.0
roman                  2.0.0
rsa                    4.0
s3transfer             0.1.13
SecretStorage          2.3.1
service-identity       18.1.0
setproctitle           1.2.2
setuptools             45.2.0
simplejson             3.16.0
six                    1.14.0
sos                    4.0
sqlparse               0.4.1
ssh-import-id          5.10
ssmtoenv               0.8
stevedore              1.32.0
systemd-python         234
tabulate               0.8.9
terminaltables         3.1.0
traitlets              4.3.3
ttystatus              0.38
Twisted                18.9.0
ubuntu-advantage-tools 20.3
ufw                    0.36
unattended-upgrades    0.1
urllib3                1.25.8
virtualenv             20.0.21
virtualenv-clone       0.5.4
virtualenvwrapper      4.8.4
wadllib                1.3.3
wcwidth                0.1.9
wheel                  0.34.2
zipp                   1.0.0
zope.interface         4.7.1
Read more comments on GitHub >

github_iconTop Results From Across the Web

litecli crashes when trying to replace a char in vi mode #96
After setting key_bindings = vi in the config.file, everytime I hit r, instead of entering in single char replace mode, a loop of...
Read more >
inputmode - HTML: HyperText Markup Language | MDN
The inputmode global attribute is an enumerated attribute that hints at the type of data that might be entered by the user while...
Read more >
Everything You Ever Wanted to Know About inputmode
The inputmode global attribute provides a hint to browsers for devices with onscreen keyboards to help them decide which keyboard to display ...
Read more >
Potential to use ssh keys for sftp - PHP panel - GitAnswer
Per a request in the #feedback channel using ssh keys could be a good enhancement for the new daemon. Back burner for now...
Read more >
Crash in vi mode issue - PythonTechWorld
Description. Pressed r to replace a single character in vi mode, got this: Unhandled exception in event loop: File "/usr/lib/python3.8/asyncio/events.py", ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found