Importing the re module fails
Diez B. Roggisch
deets at nospam.web.de
Sun Dec 7 14:36:58 EST 2008
Andreas Waldenburger schrieb:
> This is a little puzzling.
>
>
> Using ipython:
>
> [wildemar at localhost Logstuff]$ ipython
> Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38)
> Type "copyright", "credits" or "license" for more information.
>
> [snip ipython help message]
>
> In [1]: import re
>
>
> This works fine. But with the regular python interpreter I get this:
>
> [wildemar at localhost Logstuff]$ python
> Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38)
> [GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2
> Type "help", "copyright", "credits" or "license" for more
> information.
> >>> import re
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib/python2.5/re.py", line 10, in <module>
> # AB (info at pythonware.com).
> AttributeError: 'module' object has no attribute 'compile'
>
>
> What gives? Has Fedora-10 botched python or does anybody else have that
> problem es well?
In my re.py module on line 10, there is no import - it has way to much
comments on the module beginning.
So - how does your /usr/lib/python2.5/re.py look like? And what about
some modules lying around (potentially *pycs) that mask system modules?
Diez
More information about the Python-list
mailing list