ipython / ipython/ipython

IPython throws error on exitfuncs when the program is unsuspended in a different directory and the initial directory has been removed

Open
#12,867 4 comments 0 reactions 0 assignees View on GitHub
bug core
Dominant language
Python
Stars
16.8k
Forks
4.5k
Avg merge
1d 2h
Merged PRs (30d)
6

Description

If I were to suspend ipython, change directory, delete the directory that ipython was suspended in, bring ipython to foreground, and run exit, ipython will throw an exception as it is exiting.

```
...
❯ cd ..
❯ rm -rf ~/Manga/mangadex-dl/download
❯ fg
[1] - 15305 continued ipython
(pwd : ~/Manga/mangadex-dl/download)
In [5]: exit
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3802, in atexit_operations
self.reset(new_session=False)
File "/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 1421, in reset
self.history_manager.reset(new_session)
File "/usr/local/lib/python3.8/site-packages/IPython/core/history.py", line 592, in reset
self.dir_hist[:] = [os.getcwd()]
FileNotFoundError: [Errno 2] No such file or directory
(pwd now: ~/Manga/mangadex-dl)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.