Strange re problem on OSX but Not Linux

Gabriel Genellina gagsl-py at yahoo.com.ar
Wed Nov 8 16:04:58 EST 2006


At Wednesday 8/11/2006 15:01, Brian wrote:

>I have a very small script:
>
>import re
>
>text = open('eq.txt','r').read()
>regex = '[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]'
>pattern = re.compile(regex)
>match = pattern.findall(text)
>
>print ''.join(match)
>
>-------------------------------------------------------------------------------
>Here is the error outside of Komodo:
>
>Traceback (most recent call last):
>   File "reg1.py", line 1, in <module>
>     import re
>   File
>"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/re.py",
>line 5, in <module>
>     #
>AttributeError: 'module' object has no attribute 'compile'
>------------------------------------------------------------------------------
>
>This is running 2.5 on my OSX box.  If I run it (again with 2.5) on my
>SUSE machine, I get no errors.
>
>I am sure that I have overlooked something trivial here - so please be
>gentle if it is on the stupid side of things.

Dont use regex as a name. Also, do you have any script called "re.py" 
hidding that library module? or regex.py?


-- 
Gabriel Genellina
Softlab SRL 

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar



More information about the Python-list mailing list