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.

`ValueError: I/O operation on closed file` when I exit REPL

See original GitHub issue
$ python -V
Python 3.8.8
$ ptpython --version
3.0.18
$ ptpython
>>> exit()
Traceback (most recent call last):
  File "/home/eggplants/.pyenv/versions/3.8.8/bin/ptpython", line 8, in <module>
    sys.exit(run())
  File "/home/eggplants/.pyenv/versions/3.8.8/lib/python3.8/site-packages/ptpython/entry_points/run_ptpython.py", line 207, in run
    embed(
  File "/home/eggplants/.pyenv/versions/3.8.8/lib/python3.8/site-packages/ptpython/repl.py", line 720, in embed
    repl.run()
  File "/home/eggplants/.pyenv/versions/3.8.8/lib/python3.8/site-packages/ptpython/repl.py", line 135, in run
    text = self.read()
  File "/home/eggplants/.pyenv/versions/3.8.8/lib/python3.8/site-packages/ptpython/python_input.py", line 1045, in read
    result = self.app.run(pre_run=pre_run, in_thread=True)
  File "/home/eggplants/.pyenv/versions/3.8.8/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 874, in run
    raise exception
  File "/home/eggplants/.pyenv/versions/3.8.8/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 855, in run_in_thread
    result = self.run(
  File "/home/eggplants/.pyenv/versions/3.8.8/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 891, in run
    return loop.run_until_complete(
  File "/home/eggplants/.pyenv/versions/3.8.8/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/home/eggplants/.pyenv/versions/3.8.8/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 816, in run_async
    return await _run_async2()
  File "/home/eggplants/.pyenv/versions/3.8.8/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 792, in _run_async2
    result = await _run_async()
  File "/home/eggplants/.pyenv/versions/3.8.8/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 721, in _run_async
    with self.input.raw_mode(), self.input.attach(
  File "/home/eggplants/.pyenv/versions/3.8.8/lib/python3.8/site-packages/prompt_toolkit/input/vt100.py", line 129, in raw_mode
    return raw_mode(self.stdin.fileno())
ValueError: I/O operation on closed file

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
jonathanslenderscommented, Jul 8, 2021

I pushed a new release to PyPI, so you should also be able to get it from there. Thanks for testing!

1reaction
eggplantscommented, Jul 8, 2021

@jonathanslenders It seems to work well. Thank you so much…!

$ pip uninstall prompt-toolkit ptpython -y
$ pip install 'git+https://github.com/prompt-toolkit/python-prompt-toolkit@fix-valueerror-io-operation-on-closed-file' ptpython
$ ptpython
>>> exit() # no error!!!
$
Read more comments on GitHub >

github_iconTop Results From Across the Web

Using exit(), I get "ValueError: I/O operation on closed file."
I am learning Python and while trying to build an authenticator (login), I came upon this error. credentials = { "Peter" : "123",...
Read more >
ValueError: I/O operation on closed file in Python | bobbyhadz
The Python "ValueError: I/O operation on closed file" occurs when we try to perform an operation on a closed file. To solve the...
Read more >
Python ValueError: I/O operation on closed file Solution
The “ValueError : I/O operation on closed file” error is raised when you try to read from or write to a file that...
Read more >
Pexpect 3.3 documentation - Read the Docs
'''Pexpect is a Python module for spawning child applications and controlling them automatically. Pexpect can be used for automating interactive ...
Read more >
Digging Simulator - Replit
ValueError : I/O operation on closed file. During handling of the above exception, another exception occurred: Traceback (most recent call last):
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