newbie: cannot import name error

rjberman at NOSPAMrodessaNOSPAM.com rjberman at NOSPAMrodessaNOSPAM.com
Fri Sep 7 09:28:58 EDT 2001


I am brand new to Python, but have been writing Perl scripts for
the last 10 yrs. or so. I want to see how Python compares to Perl
and if it lives up to its hype.

Anyway, I installed Python version "1.6a2 (#1, Jun  1 2000, 13:24:17)
[GCC 2.96 20000306 (experimental)] on sunos5" on Sparc Solaris 8. It
installed fine, and for my first contact with Python I wrote the
requisite "Hello World" script. That too ran fine. Then I got adventurous
and tried to install an extension. That didn't work at all. I narrowed
down the problem as best I could.

Here is my stripped down script:

#!/usr/bin/env python
# To use:
#       python setup.py install
#

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 tried reinstalling distutils just in case that was the problem.
No luck. I grepped through distutils/* and distutils/core/* for
Extension and couldn't find Extension. I have no idea where it
should be anyway. I searched Google and couldn't find this error.
It seems like the module distutils.core is found, just not the
name "Extension".

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!



More information about the Python-list mailing list