problem with re module

Markus Jais info at mjais.de
Sun Oct 21 14:48:57 EDT 2001


hello
I have a strange problem
when I take the re example from the python org site
and put in my interactive python interpreter
everythings works fine:

Python 2.1 (#1, Jun  4 2001, 12:55:45)
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-81)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import re
>>> p = re.compile('ab*')
>>> print p
<SRE_Pattern object at 0x8131350>
>>>

but when I put it in a file:
#!/usr/local/bin/python
 
import re
p = re.compile('ab*')
print p

I get an error:
Traceback (most recent call last):
  File "re.py", line 3, in ?
    import re
  File "./re.py", line 4, in ?
    p = re.compile('ab*')
AttributeError: 're' module has no attribute 'compile'


this error first appeared today and it only happens with the re
module. I can also not use any DOM modoles for example because
the rely on the re module

but everything is intstalled unter
/usr/local/lib/python2.1

can anybody help me??

thanks
markus







More information about the Python-list mailing list