Skip to content

Instantly share code, notes, and snippets.

@olemb
Created August 25, 2011 18:36
Show Gist options
  • Select an option

  • Save olemb/1171411 to your computer and use it in GitHub Desktop.

Select an option

Save olemb/1171411 to your computer and use it in GitHub Desktop.

Revisions

  1. olemb revised this gist Aug 25, 2011. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@
    Today's lesson: Never call your module types.py if you plan to run Python from when standing in the same directory. It took me some time to figure out what was going on:
    Today's lesson: Never call your module types.py if you plan to run
    Python from when standing in the same directory. It took me some
    time to figure out what was going on:

    $ touch types.py # empty file
    $ python
  2. olemb created this gist Aug 25, 2011.
    18 changes: 18 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    Today's lesson: Never call your module types.py if you plan to run Python from when standing in the same directory. It took me some time to figure out what was going on:

    $ touch types.py # empty file
    $ python
    Traceback (most recent call last):
    File "/usr/lib/python2.7/site.py", line 68, in <module>
    import os
    File "/usr/lib/python2.7/os.py", line 398, in <module>
    import UserDict
    File "/usr/lib/python2.7/UserDict.py", line 83, in <module>
    import _abcoll
    File "/usr/lib/python2.7/_abcoll.py", line 70, in <module>
    Iterable.register(str)
    File "/usr/lib/python2.7/abc.py", line 107, in register
    if not isinstance(subclass, (type, types.ClassType)):
    AttributeError: 'module' object has no attribute 'ClassType'

    "Weeeaaht?"