import fails

Jp Calderone exarkun at divmod.com
Sun Dec 5 20:07:09 CET 2004


On Sun, 5 Dec 2004 19:52:57 +0100, Laszlo Zsolt Nagy <gandalf at geochemsource.com> wrote:
>Hello all,
> 
> Can anyone explain this:
> 
> 
> C:\Python\Projects\DbDesigner>python
> Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from Db.FieldTypes import IdentifierFieldType
> >>> from Db.FieldTypes import *
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: attribute name must be string
> >>>
> 
> I can do anything except "import *" - in that case, I get this very
> strange exception. Do you have any idea?
> 

    exarkun at boson:~$ cat foo.py
    x = 10
    __all__ = [x]
    exarkun at boson:~$ cat bar.py 
    x = 20
    __all__ = ['x']
    exarkun at boson:~$ python -c "from foo import *; print x"
    Traceback (most recent call last):
      File "<string>", line 1, in ?
    TypeError: attribute name must be string
    exarkun at boson:~$ python -c "from bar import *; print x"
    20
    exarkun at boson:~$ 

  Hope this helps,

  Jp



More information about the Python-list mailing list