Search code examples
pythonubuntuanacondasudo

"PermissionError" thrown when typing "exit()" to leave the Python interpreter


When I enter the python interpreter as a regular user with python. I see this:

Python 3.5.2 |Anaconda 4.1.1 (64-bit)| (default, Jul  2 2016, 17:53:06) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.

I can immediately type exit() and this happens:

>>> exit()
Error in atexit._run_exitfuncs:
PermissionError: [Errno 13] Permission denied

I think it may be related to the fact that running sudo python3 gives:

Python 3.5.2 (default, Jul  5 2016, 12:43:10) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information. 
>>> 

This looks to be a different python 3.5 install.

If this is the issue I would like to have my anaconda python install run when I type sudo python3. How do I do this?


Solution

  • Having googled the error message, I found this issue: http://bugs.python.org/issue19891

    It seems that the problem often has to do with the current user not having a home directory (which I think is logical for a user called python) or not having the proper permissions on their home directory, but the issue is still open.