RSS Feed!

Recent Posts

Recent Comments




Archive for the ‘Python’ Category

Esoteric Python Filename

Thursday, January 8th, 2015

I had a strange but minor problem with Python and iPython on my system.  I have a source directory for each of my projects.  Whenever I used the Terminal to launch iPython or Python from that directory I received this error message:

Traceback (most recent call last):

  File “/Applications/”, line 75, in <module>

    import os

  File “/Applications/”, line 49, in <module>

    import posixpath as path

  File “/Applications/”, line 17, in <module>

    import warnings

  File “”, line 9, in <module>

    from osi import *

  File “”, line 7, in <module>

    import pandas as pd

ImportError: No module named pandas

This confused me, as I didn’t use a profile or startup script.  I designed a workaround where I launched iPython from another directory and did a cd from within iPython, but this was unsatisfying.  Today I decided to actually look at the error message in detail.  It turns out that I had a local script named “” as part of my project which was clobbering the warnings module imported by the os module.  I renamed my local script and that fixed my problem.  I know it’s a bad idea to overload standard module names, I didn’t realize I was doing so.