FAQ
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)

However, when I try to run it, I get this error:

Traceback (most recent call last):
File
"/Applications/Komodo.app/Contents/SharedSupport/dbgp/bin/pydbgp", line
66, in <module>
import dbgp.client
File
"/Applications/Komodo.app/Contents/SharedSupport/dbgp/pythonlib/dbgp/client.py",
line 44, in <module>
import traceback, 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'

-------------------------------------------------------------------------------
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.

Thanks,
Brian



From http Wed Nov 8 19:01:56 2006
From: http (Paul Rubin)
Date: 08 Nov 2006 10:01:56 -0800
Subject: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?
References: <eiddl5$qpn$1@news.albasani.net>
<1162947569.228388.16940@m7g2000cwm.googlegroups.com>
<eit1ab$q9j$1@news.albasani.net>
Message-ID: <7xy7qlom0b.fsf@ruckus.brouhaha.com>

robert <no-spam at no-spam-no-spam.invalid> writes:
what about speed. Is it true that IronPython is almost as fast as C-Python meanwhile?

When this all is really true, its probably a proof that putting out
LOCK-INC-lock's (on dicts, lists, mutables ...) in CPython to remove
the GIL in future should not be really so expensive as it was teached
in the past :-)
I don't think IronPython uses locks that way. AFAIK it doesn't use
reference counts, and relies on user-supplied synchronization to keep
stuff like dictionaries safe.

Search Discussions

  • Gabriel Genellina at Nov 8, 2006 at 9:04 pm

    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
  • Paul McGuire at Nov 8, 2006 at 9:11 pm
    "Gabriel Genellina" <gagsl-py at yahoo.com.ar> wrote in message
    news:mailman.1932.1163019917.11739.python-list at python.org...
    Dont use regex as a name. Also, do you have any script called "re.py"
    hidding that library module? or regex.py?
    My bet is that a local re.py is masking the lib module. (It's a shame this
    error is so easy to trip over.)

    -- Paul
  • Brian at Nov 9, 2006 at 4:06 am

    Paul McGuire wrote:
    "Gabriel Genellina" <gagsl-py at yahoo.com.ar> wrote in message
    news:mailman.1932.1163019917.11739.python-list at python.org...
    Dont use regex as a name. Also, do you have any script called "re.py"
    hidding that library module? or regex.py?
    My bet is that a local re.py is masking the lib module. (It's a shame this
    error is so easy to trip over.)

    -- Paul
    I figured that one out so I renamed the file. Unfortunately it took me
    a while to realize that I needed to delete re.pyc as well.

    Brian

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedNov 8, '06 at 6:01p
activeNov 9, '06 at 4:06a
posts4
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase