Decorator behavior

2011-07-22 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
I am just trying to wrap my head around decorators in Python, and I'm confused about some behavior I'm seeing. Run the code below (slightly adapted from a Bruce Eckel article), and I get the following output: inside myDecorator.__init__() inside aFunction() Finished decorating aFunction() inside

returning all matching groups with re.search()

2011-02-03 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
Here's a scenario: import re m = re.search('e','fredbarneybettywilma') Now, here's a stupid question: why doesn't m.groups() return ('e','e','e'). I'm trying to figure out how to match ALL of the instances of a pattern in one call - the group() and groups() return subgroups... how do I get my

Appending to sys.path

2009-03-24 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
I have an application where I would like to append to the python path dynamically. Below is a test script I wrote. Here's what I thought would happen: 1) I run this script in a folder that is NOT already in PYTHONPATH 2) The script creates a subfolder called foo. 3) The script creates a file

Problems building zlib module on RHEL

2008-03-18 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
I can't seem to get the zlib module to build on an RHEL box. I did the following: 1) Download zlib 1.2.3 2) configure;make;make install 3) Download python 2.5.2 4) configure;make;make install 5) import zlib = ImportError: No module named zlib In the make install step for python, I notice there

Re: Problems building zlib module on RHEL

2008-03-18 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
On Mar 18, 8:42 am, mhearne808[insert-at-sign-here]gmail[insert-dot- here]com [EMAIL PROTECTED] wrote: I can't seem to get the zlib module to build on an RHEL box. I did the following: 1) Download zlib 1.2.3 2) configure;make;make install 3) Download python 2.5.2 4) configure;make;make

Re: compiling python 2.5, missing zlib

2007-11-21 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
On Nov 19, 8:22 pm, Martin v. Löwis [EMAIL PROTECTED] wrote: Those headers are already installed, according to up2date. Is there a way to specify the header files used? It will automatically use them if they are good. What's the value of ZLIB_VERSION in /usr/include/zlib.h? Regards,

compiling python 2.5, missing zlib

2007-11-19 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
I'm trying to compile Python 2.5 on a RHEL system, using ./ configure;make;make install. The build seems to go alright, but the zlib module is missing. I've tried the following: 1) Download and build the zlib libraries myself 2) Specify '--without-system-zlib' to ./configure Neither seems to

Re: compiling python 2.5, missing zlib

2007-11-19 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
On Nov 19, 2:19 pm, Martin v. Löwis [EMAIL PROTECTED] wrote: Neither seems to work. What am I missing here? You forgot to install the zlib header files, which come in an RPM provided by Redhat (probably called zlib-dev or some such). Regards, Martin Those headers are already installed,

Getting file timestamp from url

2007-11-16 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
Is is possible to get the timestamp of a file on a web server if it has a URL? For example, let's say that I want to know when the following file was created: http://www.w3schools.com/xml/note.xml I can get an HTTPMessage object using urllib2, like this:

Creating installer with external extension modules

2007-11-09 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
I'm creating a piece of software which will be used by in-house users. My code will all be written in pure Python; however, it depends heavily on a number of third-party Python modules, many of which have C/C++ dependencies (numpy, scipy, etc.) Installing these packages on my machine involved a

Re: PYTHONPATH on OS X

2007-10-11 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
On Oct 10, 4:59 pm, Graham Dumpleton [EMAIL PROTECTED] wrote: On Oct 11, 8:00 am, mhearne808[insert-at-sign-here]gmail[insert-dot- here]com [EMAIL PROTECTED] wrote: I'm missing something major here. I'm trying to add a directory to my python path using the PYTHONPATH environment variable

PYTHONPATH on OS X

2007-10-10 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
I'm missing something major here. I'm trying to add a directory to my python path using the PYTHONPATH environment variable, and it's being ignored by the Python interactive shell. Below is a capture of what I did. Note that my newfolder appears nowhere on the list of directories in sys.path.

Don't understand module search path...

2007-10-04 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
I think I don't understand how the module search path works... Let's say I have a folders called 'test'. Underneath it, I create two more folders called 'foo' and 'bar'. In 'foo', I create an empty '__init__.py' file, indicating that this folder is a package 'foo'. I then create a simple

Re: fcntl problems

2007-08-31 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
On Aug 31, 12:23 am, Miles [EMAIL PROTECTED] wrote: Sorry, that last quote-only reply was accidental. :) On 8/30/07, mhearne808 wrote: I've been doing some experiments, and here are some specific examples to try. [snipped examples] From these last two experiments I can only conclude

Re: fcntl problems

2007-08-31 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
On Aug 31, 8:42 am, Miles [EMAIL PROTECTED] wrote: On 8/31/07, mhearne808 wrote: I have a script that will be run from a cron job once a minute. One of the things this script will do is open a file to stash some temporary results. I expect that this script will always finish its work in

fcntl problems

2007-08-30 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
I'm having a number of problems with the fcntl module. First off, my system info: Mac OS X Darwin igskcicglthearn.cr.usgs.gov 8.10.1 Darwin Kernel Version 8.10.1: Wed May 23 16:33:00 PDT 2007; root:xnu-792.22.5~1/RELEASE_I386 i386 i386 Python 2.5.1 (built from source) OK, the weirdness: First

Re: fcntl problems

2007-08-30 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
On Aug 30, 4:19 pm, mhearne808[insert-at-sign-here]gmail[insert-dot- here]com [EMAIL PROTECTED] wrote: I'm having a number of problems with the fcntl module. First off, my system info: Mac OS X Darwin igskcicglthearn.cr.usgs.gov 8.10.1 Darwin Kernel Version 8.10.1: Wed May 23 16:33:00 PDT

Re: accessing parts of large files with File.seek()

2007-08-09 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
On Aug 8, 7:37 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Aug 8, 11:46 am, mhearne808[insert-at-sign-here]gmail[insert-dot- here]com [EMAIL PROTECTED] wrote: I'm having a problem with the File object's seek() method. Specifically, I cannot use it to seek to a location in a binary

accessing parts of large files with File.seek()

2007-08-08 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
I'm having a problem with the File object's seek() method. Specifically, I cannot use it to seek to a location in a binary file that is greater than 2^31 (2147483648). This seems unnecessarily limiting, as it is common these days to have files larger than 2 GB. Is there some LargeFile object out