473,788 Members | 2,861 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Strange re problem on OSX but Not Linux

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

Nov 8 '06 #1
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
Nov 8 '06 #2
"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
Nov 8 '06 #3

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

Nov 9 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1864
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...
2
1441
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:
0
1111
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...
0
1064
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
11
2598
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:
7
2863
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 */ }
5
4078
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.
0
1162
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...
1
3482
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"
8
3222
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...
0
9656
marktang
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...
0
10364
Oralloy
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...
1
10110
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,...
0
9967
tracyyun
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...
0
8993
agi2029
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...
0
6750
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();...
0
5398
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...
1
4069
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
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.