{"id":43,"date":"2015-01-08T21:03:50","date_gmt":"2015-01-08T21:03:50","guid":{"rendered":"http:\/\/ontsandquants.com\/wp\/?p=43"},"modified":"2015-04-03T16:31:44","modified_gmt":"2015-04-03T16:31:44","slug":"esoteric-python-filename","status":"publish","type":"post","link":"http:\/\/ontsandquants.com\/wp\/?p=43","title":{"rendered":"Esoteric Python Filename"},"content":{"rendered":"<p>I had a strange but minor problem with Python and iPython on my system. \u00a0I have a source directory for each of my projects. \u00a0Whenever I used the Terminal to launch iPython or Python from that directory I received this error message:<\/p>\n<p style=\"padding-left: 30px;\">Traceback (most recent call last):<\/p>\n<p style=\"padding-left: 30px;\">\u00a0 File &#8220;\/Applications\/Canopy.app\/appdata\/canopy-1.4.1.1975.macosx-x86_64\/Canopy.app\/Contents\/lib\/python2.7\/site.py&#8221;, line 75, in &lt;module&gt;<\/p>\n<p style=\"padding-left: 30px;\">\u00a0 \u00a0 import os<\/p>\n<p style=\"padding-left: 30px;\">\u00a0 File &#8220;\/Applications\/Canopy.app\/appdata\/canopy-1.4.1.1975.macosx-x86_64\/Canopy.app\/Contents\/lib\/python2.7\/os.py&#8221;, line 49, in &lt;module&gt;<\/p>\n<p style=\"padding-left: 30px;\">\u00a0 \u00a0 import posixpath as path<\/p>\n<p style=\"padding-left: 30px;\">\u00a0 File &#8220;\/Applications\/Canopy.app\/appdata\/canopy-1.4.1.1975.macosx-x86_64\/Canopy.app\/Contents\/lib\/python2.7\/posixpath.py&#8221;, line 17, in &lt;module&gt;<\/p>\n<p style=\"padding-left: 30px;\">\u00a0 \u00a0 import warnings<\/p>\n<p style=\"padding-left: 30px;\">\u00a0 File &#8220;warnings.py&#8221;, line 9, in &lt;module&gt;<\/p>\n<p style=\"padding-left: 30px;\">\u00a0 \u00a0 from osi import *<\/p>\n<p style=\"padding-left: 30px;\">\u00a0 File &#8220;osi.py&#8221;, line 7, in &lt;module&gt;<\/p>\n<p style=\"padding-left: 30px;\">\u00a0 \u00a0 import pandas as pd<\/p>\n<p style=\"padding-left: 30px;\">ImportError: No module named pandas<\/p>\n<p>This confused me, as I didn&#8217;t use a profile or startup script. \u00a0I designed a workaround where I launched iPython from another directory and did a cd from within iPython, but this was unsatisfying. \u00a0Today I decided to actually look at the error message in detail. \u00a0It turns out that I had a local script named &#8220;warnings.py&#8221; as part of my project which was clobbering the warnings module imported by the os module. \u00a0I renamed my local script and that fixed my problem. \u00a0I know it&#8217;s a bad idea to overload standard module names, I didn&#8217;t realize I was doing so.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had a strange but minor problem with Python and iPython on my system. \u00a0I have a source directory for each of my projects. \u00a0Whenever I used the Terminal to launch iPython or Python from that directory I received this error message: Traceback (most recent call last): \u00a0 File &#8220;\/Applications\/Canopy.app\/appdata\/canopy-1.4.1.1975.macosx-x86_64\/Canopy.app\/Contents\/lib\/python2.7\/site.py&#8221;, line 75, in &lt;module&gt; \u00a0 &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"http:\/\/ontsandquants.com\/wp\/?p=43\"> <span class=\"screen-reader-text\">Esoteric Python Filename<\/span>Read More &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[],"_links":{"self":[{"href":"http:\/\/ontsandquants.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/43"}],"collection":[{"href":"http:\/\/ontsandquants.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/ontsandquants.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/ontsandquants.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/ontsandquants.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=43"}],"version-history":[{"count":2,"href":"http:\/\/ontsandquants.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/43\/revisions"}],"predecessor-version":[{"id":50,"href":"http:\/\/ontsandquants.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/43\/revisions\/50"}],"wp:attachment":[{"href":"http:\/\/ontsandquants.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=43"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/ontsandquants.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=43"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/ontsandquants.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=43"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}