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(rege x)
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.framewor k/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.framewor k/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 3 1161
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(rege x) 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.framewor k/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
"Gabriel Genellina" <ga******@yahoo .com.arwrote in message
news:ma******** *************** *************** *@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
Paul McGuire wrote:
"Gabriel Genellina" <ga******@yahoo .com.arwrote in message
news:ma******** *************** *************** *@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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: marc |
last post by:
Hello all,
I run a web site via a hosting provider on Linux. The web site runs
php scripts and one of the scripts writes information to a log file
running on the same server as the php scripts. The directory where the
log file is has a chmod of 777.
Now as of about 48hrs ago everytime I attempt to execute the php script
(via a url call) that writes to a log file it reaches the following
line of code and the code seems to terminate...
|
by: Markus Franz |
last post by:
Hi.
Today I created a script called load.py for using at the command line
written in Python 2.3.
This script should load as many websites as given on the comand line and
print them with a seperation string to stdout. The loading was done in
parallel. (I used processes for this.)
The script was started by the following command:
|
by: Travis Oliphant |
last post by:
I have a normal looking setup.py file with a single extension module.
When distutils runs (python setup.py build), the module compiles fine,
but an error is issued that seems to indicate that gcc is being called
with a "blank" input file (and gives an error).
It appears that the spawn process inside of distutils is generating two
calls: one that succeeds in compiling the module (it takes a while to
compile) and another that is giving an...
|
by: nw_moriarty |
last post by:
Folks
I'm getting a very strange error when I'm using the SocketServer. Has
anybody got any ideas?
Nigel
File
"/scratch1/nigel/c6/phenix-1.08a/build/intel-linux/python/lib/python2.4/SocketServer.py",
line 468, in process_request_thread
|
by: Martin Joergensen |
last post by:
Hi,
I've encountered a really, *really*, REALLY strange error :-)
I have a for-loop and after 8 runs I get strange results...... I
mean: A really strange result....
I'm calculating temperatures. T = 20 degrees at all
times.... The 2D T-array looks like this:
| |
by: Flash Gordon |
last post by:
Reading the standard, va_list is an object type (, so I believe the
following should be possible:
#include <stdarg.h>
void foo(va_list *arg)
{
/* do some stuff which conditionally might read parameters off arg */
}
|
by: soeren |
last post by:
Hello,
two days ago I stumbled across a very strange problem that came up when
we were printing tiny double numbers as strings and trying to read them
on another place. This is part of an object serialisation framework
that cannot be done in binary format currently, so please no comments
about this ,-))
It took quite some time to shrink down the problem but it looks like
that C++ does not behave well in regards to very tiny numbers.
|
by: mooshak |
last post by:
Hi all,
I have been trying to set up replication using the Replication center. The replication center is installed on a windows box; the source and db targets are on Linux.
DAS is running on all 3 and all the nodes and DBs are cataloged on the Windows box, as well as linux box. I have defined the replication but when I start Capture, nothing happens. Starting the Apply is working fine but I can't get anything going for Capture from the...
|
by: Zbigniew |
last post by:
Hi,
Compiler: GCC 3.3.5
OS: SuSE Linux (Kernel: 2.6.11)
I reorganized my source code and now almost all my header files went
to "Include" folder.
Now when compiling with -I option I have plenty of problems with
system include files:
"conflict with previous declaration"
|
by: FBM |
last post by:
Hi there,
I am puzzled with the behavior of my code.. I am working on a
networking stuff, and debugging with eclipse (GNU gdb 6.6-debian)..
The problem I am experiencing is the following:
Whenever I declare the sockaddr_in structure inside the main, the
debugger crashes at line X*, not being able to access argv parameters
(see code below). It is very strange.. by only being there,
sockaddr_in does not allow me to question argc...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |