Python Weirdness on Terminal Open

python

When I open Terminal I see the following:

Last login: Wed Feb  8 18:30:05 on ttys029
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/handlers.py", line 75, in emit
    self.doRollover()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/handlers.py", line 132, in doRollover
    os.rename(self.baseFilename, dfn)
OSError: [Errno 2] No such file or directory
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py", line 1472, in shutdown
    h.flush()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py", line 740, in flush
    self.stream.flush()
ValueError: I/O operation on closed file
Error in sys.exitfunc:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py", line 1472, in shutdown
    h.flush()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py", line 740, in flush
    self.stream.flush()
ValueError: I/O operation on closed file

Everything seems to work but this is ugly and maybe warns of future trouble. I've installed Python 2.7 on this machine, then removed it to a virtualenv to restore 2.6 as the system default.

Any thoughts on how I can debug this?

EDIT:

My .profile has a call to virtualenvwrapper.sh — which, as I look it, is located under .../Versions/2.7 of Python. So maybe I should look for the problem there?

Best Answer

From comment:

Check your .bashrc or .profile for Python specific code -- if you find something there make sure it is pointing to the correct version, be it .../Versions/Current/..., .../Versions/2.7/..., or whatever.