[lug] SOLVED: silly python import problem

Andrew Diederich andrew at NETdelivery.com
Mon Feb 26 15:09:47 MST 2001

I started writing for help, but since I've solved my own
problem I thought I'd put it to the list so I could search
for it later.  *grin*

I was trying out the python ldap module, but kept runing into
AttributeError problems like: AttributeError: open

Turns out you _really_ shouldn't name python scripts like the
module you're going to import (like ldap.py matching 
/usr/lib/python1.5/site-packages/ldapmodule.so).  I'm sure it's
in the Learning Python O'Reilly book on my desk, or in a
python faq somewhere, but I wound up figuring it out myself.

(You wind up in the land of grand recursion by doing a 
"import ldap" in a file called "ldap.py".)

Just a little hint for python newbies like myself.

Andrew Diederich
andrew at netdelivery.com

More information about the LUG mailing list