newbie: cannot import name error

Peter Hansen peter at engcorp.com
Fri Sep 7 10:08:54 EDT 2001


"rjberman at NOSPAMrodessaNOSPAM.com" wrote:
> 
> import distutils, os, sys, stat
> from distutils.core import setup, Extension
> 
> The error I get is:
> 
> 131> python test1.py
> 
> Traceback (most recent call last):
>   File "test1.py", line 7, in ?
>     from distutils.core import setup, Extension
> ImportError: cannot import name Extension

I don't know anything about distutils, but I can do
'from distutils import extension'.  Was that what you 
needed?  Python is case-sensitive.

> Can someone help me? I can't believe that on my second encounter
> with Python I've already been stumped! This is not a good first
> impression. Any help would be appreciated or even pointers to help!

On the other hand, you're trying to do something I've _never_ 
needed to do yet, after almost two years with Python.  Any time
(to date) I've needed to install an extension, I've been okay
with just copying it to the python/lib folder, or with adding
an entry to a .pth file (see the docs in site.py) to point it
to the folder in which I keep my own extensions.

By the way, why are you running (a) an old version, and (b) 
an _alpha_ version!

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com



More information about the Python-list mailing list