Fix Python segmentation fault on exit

To fix error

Error in atexit._run_exitfuncs: PermissionError: [Errno 13] Permission denied

look at the owner of ~/.python_history

ls -l ~/.python history

If it shows root instead of your username, that’s likely the problem. Fix by (inserting your username in place of “joe”)

chown joe:joe ~/.python_history


I haven’t tried these suggestions but they are a starting point for further reading e.g. if you want to disable Python command history