ANN: cssutils 0.9.5rc1

2008-07-09 Thread Christof Hoeke
what is it -- A Python package to parse and build CSS Cascading Style Sheets. (Not a renderer though!) As there have been quite a few bugfixes and also some minor changes this is a release candidate and not the final release yet. main changes 0.9.5rc1 080709 -

lxml 2.1 released

2008-07-09 Thread Stefan Behnel
Hi all, lxml 2.1 has been released to PyPI. This is the first official lxml release that builds and works on Python 2.3, 2.4, 2.5, 2.6 (beta) and 3.0 (beta). http://codespeak.net/lxml/dev/ http://pypi.python.org/pypi/lxml/2.1 Install with easy_install lxml==2.1 What is lxml? In short:

Announce: Linux Desktop Testing Project (LDTP) 1.2.0 released

2008-07-09 Thread Nagappan A
Hello all, We are proud to announce the release of LDTP 1.2.0. This release features number of important breakthroughs in LDTP as well as in the field of Test Automation. This release note covers a brief introduction on LDTP followed by the list of new features and major bug fixes which makes

Re: Returning the positions of a list that are non-zero

2008-07-09 Thread Ben Finney
Benjamin Goudey [EMAIL PROTECTED] writes: For example, if my original list is [0,0,1,2,1,0,0] I would like to produce the lists [1,2,1] (the non zero values) and [2,3,4] (indices of where the non-zero values used to be). Removing non-zero values is very easy but determining the indicies is

Re: re.search much slower then grep on some regular expressions

2008-07-09 Thread Henning Thornblad
On Jul 8, 2:48 am, John Machin [EMAIL PROTECTED] wrote: On Jul 8, 2:51 am, Henning Thornblad [EMAIL PROTECTED] wrote: When trying to find an alternative way of solving my problem i found that running this script: #!/usr/bin/env python import re row= for a in range(156000):

Re: (silly?) speed comparisons

2008-07-09 Thread Peter Otten
mk wrote: Now C++ version took over twice the time to execute in comparison to Python time! Am I comparing apples to oranges? Indeed. Where in Python you're passing references your C++ code produces copies of the vector. For starters you can change the function signature to void

Newbie question

2008-07-09 Thread |e0
Hi list, i'm running Ubuntu Hardy Desktop and i've installed Tim Golden WMI. However importing wmi module i have this error: import wmi Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python2.5/site-packages/wmi.py, line 141, in module from win32com.client

Re: how to remove oldest files up to a limit efficiently

2008-07-09 Thread Dan Stromberg
On Tue, 08 Jul 2008 15:18:23 -0700, [EMAIL PROTECTED] wrote: I need to mantain a filesystem where I'll keep only the most recently used (MRU) files; least recently used ones (LRU) have to be removed to leave space for newer ones. The filesystem in question is a clustered fs (glusterfs) which

Re: Cross Compiler for Python?

2008-07-09 Thread Hendrik van Rooyen
norseman nor...ghes.net wrote: 8 - dreaded Yep! I know the feeling. Got lots of those T-Shirts. ;) I re-read your original post. I got the feeling the eBox is running a stripped down Linux. Is that so? If it is, then:

Regular Expressions Quick Question

2008-07-09 Thread Lamonte Harris
Alright, basically I have a list of words in a file and I load each word from each line into the array. Then basically the question is how do I check if the input word matches multiple words in the list. Say someone input test, how could I check if that word matches these list of words: test

Re: Newbie question

2008-07-09 Thread |e0
So, i can't use wmi module on linux? On Wed, Jul 9, 2008 at 9:14 AM, Lamonte Harris [EMAIL PROTECTED] wrote: I think the win32 module is only for windows. -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular Expressions Quick Question

2008-07-09 Thread Rajanikanth Jammalamadaka
hi! Try this: lis=['t','tes','test','testing'] [elem for elem in lis if re.compile(^te).search(elem)] ['tes', 'test', 'testing'] Cheers, Raj On Wed, Jul 9, 2008 at 12:13 AM, Lamonte Harris [EMAIL PROTECTED] wrote: Alright, basically I have a list of words in a file and I load each word

Re: ActiveState Code: the new Python Cookbook site

2008-07-09 Thread Stef Mientki
hi Mike, nice job, I just took a quick look, Trent Mick wrote: The Python Cookbook is by far the most popular of the ASPN Cookbooks, so I wanted to get the Python community's feedback on the new site. What do you think? What works? What doesn't? I'll try to answer feedback on python-list

Re: re.search much slower then grep on some regular expressions

2008-07-09 Thread John Machin
On Jul 9, 2:01 am, Kris Kennaway [EMAIL PROTECTED] wrote: samwyse wrote: On Jul 4, 6:43 am, Henning_Thornblad [EMAIL PROTECTED] wrote: What can be the cause of the large difference between re.search and grep? While doing a simple grep: grep '[^ =]*/' input                  (input

delete lines

2008-07-09 Thread antar2
I am new in python and I have the following problem: Suppose I have a list with words of which I want to remove each time the words in the lines below item1 and above item2: item1 a b item2 c d item3 e f item4 g h item1 i j item2 k l item3 m n item4 o p I did not find out how to do this: Part

Re: Newbie question

2008-07-09 Thread A.T.Hofkamp
On 2008-07-09, |e0 [EMAIL PROTECTED] wrote: So, i can't use wmi module on linux? On Wed, Jul 9, 2008 at 9:14 AM, Lamonte Harris [EMAIL PROTECTED] wrote: I think the win32 module is only for windows. Welcome to the world outside MS. Many python modules don't actually do anything than passing

Re: Regular Expressions Quick Question

2008-07-09 Thread Bruno Desthuilliers
Rajanikanth Jammalamadaka a écrit : (top-post corrected - Please, Rajanikanth, learn to trimquote properly, and by all means avoid top-posting) On Wed, Jul 9, 2008 at 12:13 AM, Lamonte Harris [EMAIL PROTECTED] wrote: Alright, basically I have a list of words in a file and I load each word

Re: Newbie question

2008-07-09 Thread Tim Golden
A.T.Hofkamp wrote: On 2008-07-09, |e0 [EMAIL PROTECTED] wrote: So, i can't use wmi module on linux? On Wed, Jul 9, 2008 at 9:14 AM, Lamonte Harris [EMAIL PROTECTED] wrote: I think the win32 module is only for windows. Welcome to the world outside MS. Many python modules don't actually do

Re: Returning the positions of a list that are non-zero

2008-07-09 Thread Luis Zarrabeitia
This could work: l = [0,0,1,2,1,0,0] indexes, values = zip(*((index,value) for index,value in enumerate(l) if value != 0)) But I guess it would be a little less cryptic (and maybe a lot more efficient) if there were an unzip function instead of using the zip(*sequence) trick. I think a more

Re: delete lines

2008-07-09 Thread Peter Otten
antar2 wrote: I am new in python and I have the following problem: Suppose I have a list with words of which I want to remove each time the words in the lines below item1 and above item2: f = re.compile(item\[1\]\:) g = re.compile(item\[2\]\:) for i, line in enumerate(list1):    

Opening Unicode files

2008-07-09 Thread Noorhan Abbas
Hello, I wonder if you don't mind helping me out in this problem. I have been developing a tool in python that opens some unicode files, reading them and processing the data. It is working fine. When I started to write a cgi module that does the same thing for google appengine(actually it is

Manipulating sys.path

2008-07-09 Thread Thomas
Hi all, I want to manipulate sys.path outside of PYTHONPATH (environment) and sys.path.append() (programmatically). A bit of background: We're maintaining a small application that includes a couple of Python scripts. Over time, a decent amount of code has been forked into modules, so the

Re: a simple 'for' question

2008-07-09 Thread Tim Cook
On Wed, 2008-07-09 at 00:00 -0400, Ben Keshet wrote: oops, my mistake, actually it didn't work... when I tried: for x in folders: print x # print the current folder filename='Folder/%s/myfile.txt' %x f=open(filename,'r') it says: IOError: [Errno 2] No such file or

start reading from certain line

2008-07-09 Thread antar2
I am a starter in python and would like to write a program that reads lines starting with a line that contains a certain word. For example the program starts reading the program when a line is encountered that contains 'item 1' The weather is nice Item 1 We will go to the seaside ... Only the

Re: (silly?) speed comparisons

2008-07-09 Thread mk
Rajanikanth Jammalamadaka wrote: Try using a list instead of a vector for the C++ version. Well, it's even slower: $ time slice4 real0m4.500s user0m0.015s sys 0m0.015s Time of execution of vector version (using reference to a vector): $ time slice2 real0m2.420s user

Re: start reading from certain line

2008-07-09 Thread Diez B. Roggisch
antar2 wrote: I am a starter in python and would like to write a program that reads lines starting with a line that contains a certain word. For example the program starts reading the program when a line is encountered that contains 'item 1' The weather is nice Item 1 We will go to the

mock with inheritance

2008-07-09 Thread lidiriel
Hello, i would like use a mock object for testing one class and its methods: Here my class : class Foo(Component): def __init__(self): self._db = self.env.get_db() def foomethod(self, arg): . But i don't know how to mock the class Component. Note that Component

Re: start reading from certain line

2008-07-09 Thread Tim Cook
On Wed, 2008-07-09 at 03:30 -0700, antar2 wrote: I am a starter in python and would like to write a program that reads lines starting with a line that contains a certain word. For example the program starts reading the program when a line is encountered that contains 'item 1' The weather

Re: start reading from certain line

2008-07-09 Thread Tim Cook
On Wed, 2008-07-09 at 03:30 -0700, antar2 wrote: I am a starter in python and would like to write a program that reads lines starting with a line that contains a certain word. For example the program starts reading the program when a line is encountered that contains 'item 1' The weather

Re: Impossible to change methods with special names of instances of new-style classes?

2008-07-09 Thread cokofreedom
My question is: did something about the way the special method names are implemented change for new-style classes? class old: pass class new(object): pass testone = old() testone.__call__ = lambda : 33 testone() 33 testtwo = new() testtwo.__call__ = lambda : 33

Re: start reading from certain line

2008-07-09 Thread A.T.Hofkamp
On 2008-07-09, antar2 [EMAIL PROTECTED] wrote: I am a starter in python and would like to write a program that reads lines starting with a line that contains a certain word. For example the program starts reading the program when a line is encountered that contains 'item 1' The weather is

Re: a simple 'for' question

2008-07-09 Thread cokofreedom
On Jul 9, 2:08 am, Ben Keshet [EMAIL PROTECTED] wrote: Hi fans, I want to use a 'for' iteration to manipulate files in a set of folders, something like: folders= ['1A28','1A6W','56Y7'] for x in folders: print x # print the current folder f = open('my/path/way/x/my_file.txt',

Re: mock with inheritance

2008-07-09 Thread Ben Finney
lidiriel [EMAIL PROTECTED] writes: But i don't know how to mock the class Component. Note that Component provide the attribut env. I prefer to use the MiniMock framework URL:http://cheeseshop.python.org/pypi/MiniMock. You don't need to specify what interface the mock object has. Its Mock

Doubts about how implementing asynchronous timeouts through a heap

2008-07-09 Thread Giampaolo Rodola'
Hi, I'm trying to implement an asynchronous scheduler for asyncore to call functions at a later time without blocking the main loop. The logic behind it consists in: - adding the scheduled functions into a heapified list - calling a scheduler function at every loop which checks the scheduled

Re: a simple 'for' question

2008-07-09 Thread Ben Keshet
it didn't help. it reads the pathway as is (see errors for both tries). It looks like it had the write pathway the first time, but could not find it because it searched in the path/way instead of in the path\way. thanks for trying. folders= ['1','2','3'] for x in folders: print x #

Re: GUI Programming by hand not code with Python Code

2008-07-09 Thread Nicola Musatti
On Jul 8, 10:09 pm, sturlamolden [EMAIL PROTECTED] wrote: [...] I use wxFormBuilder with wxPython. Works like a charm. Design the GUI graphically, export it like a wx XML resource (.xrc). All you nedd to code in Python is the event handlers and the code to bind/hook the events.

Re: How to make python scripts .py executable, not bring up editor

2008-07-09 Thread Gerry
And if you've gotten this far, why not take the next step: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/476204 and just type tryme (as opposed to tryme.py) Gerry -- http://mail.python.org/mailman/listinfo/python-list

Re: a simple 'for' question

2008-07-09 Thread Bruno Desthuilliers
Tim Cook a écrit : On Wed, 2008-07-09 at 00:00 -0400, Ben Keshet wrote: oops, my mistake, actually it didn't work... when I tried: for x in folders: print x # print the current folder filename='Folder/%s/myfile.txt' %x f=open(filename,'r') it says: IOError: [Errno 2] No such

Re: re.search much slower then grep on some regular expressions

2008-07-09 Thread Kris Kennaway
John Machin wrote: Hmm, unfortunately it's still orders of magnitude slower than grep in my own application that involves matching lots of strings and regexps against large files (I killed it after 400 seconds, compared to 1.5 for grep), and that's leaving aside the much longer compilation time

Re: re.search much slower then grep on some regular expressions

2008-07-09 Thread Jeroen Ruigrok van der Werven
-On [20080709 14:08], Kris Kennaway ([EMAIL PROTECTED]) wrote: It's compiler/build output. Sounds like the FreeBSD ports build cluster. :) Kris, have you tried a PGO build of Python with your specific usage? I cannot guarantee it will significantly speed things up though. Also, a while ago I

Re: re.search much slower then grep on some regular expressions

2008-07-09 Thread Kris Kennaway
Jeroen Ruigrok van der Werven wrote: -On [20080709 14:08], Kris Kennaway ([EMAIL PROTECTED]) wrote: It's compiler/build output. Sounds like the FreeBSD ports build cluster. :) Yes indeed! Kris, have you tried a PGO build of Python with your specific usage? I cannot guarantee

Re: (silly?) speed comparisons

2008-07-09 Thread Maric Michaud
Le Wednesday 09 July 2008 12:35:10 mk, vous avez écrit : vectorstring move_slice(vectorstring vec, int start, int stop, int dest) I guess the point is to make a vector of referene to string if you don't want to copy string objects all around but just a word for an address each time. The

Re: Newbie question

2008-07-09 Thread |e0
I did not mean to use WMI on linux, but query win machines *from* linux. Thank you for your clarifications - Leonardo On Wed, Jul 9, 2008 at 11:04 AM, A.T.Hofkamp [EMAIL PROTECTED] wrote: Welcome to the world outside MS. Many python modules don't actually do anything than passing on calls to

Re: Newbie question

2008-07-09 Thread Tim Golden
|e0 wrote: I did not mean to use WMI on linux, but query win machines *from* linux. Thank you for your clarifications In principle you ought to be able to use some kind of DCOM bridge (since WMI access if via COM/DCOM). I've no idea if anyone's attempted this or even if all the pieces are in

Re: Newbie question

2008-07-09 Thread Diez B. Roggisch
|e0 wrote: I did not mean to use WMI on linux, but query win machines *from* linux. What do you mean by query? Using the WMI module? No. It's Windows only. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Returning the positions of a list that are non-zero

2008-07-09 Thread Andrii V. Mishkovskyi
2008/7/9 Benjamin Goudey [EMAIL PROTECTED]: I have a very large list of integers representing data needed for a histogram that I'm going to plot using pylab. However, most of these values (85%-95%) are zero and I would like to remove them to reduce the amount of memory I'm using and save time

Re: Returning the positions of a list that are non-zero

2008-07-09 Thread Chris
On Jul 9, 7:48 am, Rajanikanth Jammalamadaka [EMAIL PROTECTED] wrote: Try this: li=[0,0,1,2,1,0,0] li [0, 0, 1, 2, 1, 0, 0] [i for i in range(len(li)) if li[i] != 0] [2, 3, 4] Cheers, Raj On Tue, Jul 8, 2008 at 10:26 PM, Benjamin Goudey [EMAIL PROTECTED] wrote: I have a very

Re: Returning the positions of a list that are non-zero

2008-07-09 Thread Chris
On Jul 9, 7:48 am, Rajanikanth Jammalamadaka [EMAIL PROTECTED] wrote: Try this: li=[0,0,1,2,1,0,0] li [0, 0, 1, 2, 1, 0, 0] [i for i in range(len(li)) if li[i] != 0] [2, 3, 4] Cheers, Raj On Tue, Jul 8, 2008 at 10:26 PM, Benjamin Goudey [EMAIL PROTECTED] wrote: I have a very

Python / Windows process control

2008-07-09 Thread Salim Fadhley
Does anybody know of a python module which can do process management on Windows? The sort of thing that we might usually do with taskmgr.exe or process explorer? For example: * Kill a process by ID * Find out which process ID is locking an object in the filesystem * Find out all the IDs of a

Doubts about how implementing asynchronous timeouts through a heap

2008-07-09 Thread Giampaolo Rodola'
Hi, I'm trying to implement an asynchronous scheduler for asyncore to call functions at a later time without blocking the main loop. The logic behind it consists in: - adding the scheduled functions into a heapified list - calling a scheduler function at every loop which checks the scheduled

Allow tab completion when inputing filepath?

2008-07-09 Thread Keith Hughitt
Hi all, I've been looking around on the web for a way to do this, but so far have not come across anything for this particular application. I have found some ways to enable tab completion for program-related commands, but not for system filepaths. This would be nice to have when prompting the

Re: Allow tab completion when inputing filepath?

2008-07-09 Thread Tim Golden
Keith Hughitt wrote: I've been looking around on the web for a way to do this, but so far have not come across anything for this particular application. I have found some ways to enable tab completion for program-related commands, but not for system filepaths. This would be nice to have when

Re: Relative Package Import

2008-07-09 Thread Thomas
Robert Hancock wrote: mypackage/ __init__.py push/ __init__.py dest.py feed/ __init__py subject.py In subject.py I have from ..push import dest There is no such thing as relative

Re: Returning the positions of a list that are non-zero

2008-07-09 Thread Paul McGuire
On Jul 9, 12:26 am, Benjamin Goudey [EMAIL PROTECTED] wrote: I have a very large list of integers representing data needed for a histogram that I'm going to plot using pylab. However, most of these values (85%-95%) are zero and I would like to remove them to reduce the amount of memory I'm

FOSS projects exhibiting clean/good OOP?

2008-07-09 Thread Phillip B Oldham
I'm wondering whether anyone can offer suggestions on FOSS projects/ apps which exhibit solid OO principles, clean code, good inline documentation, and sound design principles? I'm devoting some time to reviewing other people's code to advance my skills. Its good to review bad code (of which I

Re: Relative Package Import

2008-07-09 Thread Peter Otten
Thomas wrote: Robert Hancock wrote: mypackage/ __init__.py push/ __init__.py dest.py feed/ __init__py subject.py In subject.py I have from ..push import dest There is

Re: (silly?) speed comparisons

2008-07-09 Thread mk
Maric Michaud wrote: Le Wednesday 09 July 2008 12:35:10 mk, vous avez écrit : vectorstring move_slice(vectorstring vec, int start, int stop, int dest) I guess the point is to make a vector of referene to string if you don't want to copy string objects all around but just a word for an

You, spare time and SyntaxError

2008-07-09 Thread cokofreedom
def ine(you): yourself = what? go = list(something), list(anything) be = something please = be, yourself yourself = great for good in yourself: if you is good: good in you please.add(more, good) else: def inition(lacks, clarity):

Re: (silly?) speed comparisons

2008-07-09 Thread mk
P.S. Java 1.6 rocks - I wrote equivalent version using ArrayList and it executed in 0.7s. -- http://mail.python.org/mailman/listinfo/python-list

Re: FOSS projects exhibiting clean/good OOP?

2008-07-09 Thread Tim Cook
On Wed, 2008-07-09 at 07:38 -0700, Phillip B Oldham wrote: I'm wondering whether anyone can offer suggestions on FOSS projects/ apps which exhibit solid OO principles, clean code, good inline documentation, and sound design principles? I'm devoting some time to reviewing other people's code

Re: numeric emulation and __pos__

2008-07-09 Thread samwyse
On Jul 8, 12:34 pm, Ethan Furman [EMAIL PROTECTED] wrote: Anybody have an example of when the unary + actually does something? Besides the below Decimal example.  I'm curious under what circumstances it would be useful for more than just completeness (although completeness for it's own sake

Re: Logging to zero or more destinations

2008-07-09 Thread samwyse
On Jul 8, 3:01 pm, Rob Wolfe [EMAIL PROTECTED] wrote: samwyse [EMAIL PROTECTED] writes: P.S.  I tried researching this further by myself, but the logging module doesn't come with source (apparently it's written in C?) and I don't have the time to find and download the source to my laptop.

Re: Boost Python - C++ class' private static data blown away before accessing in Python?

2008-07-09 Thread Stodge
Thanks. Maybe it's a DLL boundary issue? I'll look into this too. On Jul 5, 11:14 pm, Giuseppe Ottaviano [EMAIL PROTECTED] wrote: In Python, I retrive an Entity from the EntityList: elist = EntityList() elist.append(Entity()) elist.append(Entity()) entity = elist.get_at(0)

Re: Opening Unicode files

2008-07-09 Thread Gary Herron
Noorhan Abbas wrote: Hello, I wonder if you don't mind helping me out in this problem. I have been developing a tool in python that opens some unicode files, reading them and processing the data. It is working fine. When I started to write a cgi module that does the same thing for google

Re: Boost Python - C++ class' private static data blown away before accessing in Python?

2008-07-09 Thread Stodge
I wonder if it's a DLL boundary problem. On Jul 5, 11:14 pm, Giuseppe Ottaviano [EMAIL PROTECTED] wrote: In Python, I retrive an Entity from the EntityList: elist = EntityList() elist.append(Entity()) elist.append(Entity()) entity = elist.get_at(0) entity.foo() But it crashes

Anyone happen to have optimization hints for this loop?

2008-07-09 Thread dp_pearce
I have some code that takes data from an Access database and processes it into text files for another application. At the moment, I am using a number of loops that are pretty slow. I am not a hugely experienced python user so I would like to know if I am doing anything particularly wrong or that

Re: Newbie question

2008-07-09 Thread Mike Driscoll
On Jul 9, 2:19 am, |e0 [EMAIL PROTECTED] wrote: So, i can't use wmi module on linux? On Wed, Jul 9, 2008 at 9:14 AM, Lamonte Harris [EMAIL PROTECTED] wrote: I think the win32 module is only for windows. WMI is a Windows thing. It stands for Windows Management Instrumentation. So it's not

Re: Anyone happen to have optimization hints for this loop?

2008-07-09 Thread Diez B. Roggisch
dp_pearce wrote: I have some code that takes data from an Access database and processes it into text files for another application. At the moment, I am using a number of loops that are pretty slow. I am not a hugely experienced python user so I would like to know if I am doing anything

Determining when a file has finished copying

2008-07-09 Thread writeson
Hi all, I'm writing some code that monitors a directory for the appearance of files from a workflow. When those files appear I write a command file to a device that tells the device how to process the file. The appearance of the command file triggers the device to grab the original file. My

Re: numeric emulation and __pos__

2008-07-09 Thread Sion Arrowsmith
Ethan Furman [EMAIL PROTECTED] wrote: Anybody have an example of when the unary + actually does something? I've seen it (jokingly) used to implement a prefix increment operator. I'm not going to repeat the details in case somebody decides it's serious code. -- \S -- [EMAIL PROTECTED] --

Re: Regular Expressions Quick Question

2008-07-09 Thread Paul McGuire
On Jul 9, 2:24 am, Rajanikanth Jammalamadaka [EMAIL PROTECTED] wrote: hi! Try this: lis=['t','tes','test','testing'] [elem for elem in lis if re.compile(^te).search(elem)] ['tes', 'test', 'testing'] Cheers, Raj On Wed, Jul 9, 2008 at 12:13 AM, Lamonte Harris [EMAIL PROTECTED]

Re: Boost Python - C++ class' private static data blown away before accessing in Python?

2008-07-09 Thread Stodge
Could it be a boundary problem? The static data is initialised by the application. The problem arises when the python module tries to access it. On Jul 5, 11:14 pm, Giuseppe Ottaviano [EMAIL PROTECTED] wrote: In Python, I retrive an Entity from the EntityList: elist = EntityList()

trouble building Python 2.5.1 on solaris 10

2008-07-09 Thread mg
When make gets to the _ctypes section, I am getting the following in my output: building '_ctypes' extension creating build/temp.solaris-2.10-i86pc-2.5/home/ecuser/Python-2.5.1/ Modules/_ctypes creating build/temp.solaris-2.10-i86pc-2.5/home/ecuser/Python-2.5.1/ Modules/_ctypes/libffi creating

Anyone happen to have optimization hints for this loop?

2008-07-09 Thread dp_pearce
I have some code that takes data from an Access database and processes it into text files for another application. At the moment, I am using a number of loops that are pretty slow. I am not a hugely experienced python user so I would like to know if I am doing anything particularly wrong or that

Re: FOSS projects exhibiting clean/good OOP?

2008-07-09 Thread Larry Bates
Phillip B Oldham wrote: I'm wondering whether anyone can offer suggestions on FOSS projects/ apps which exhibit solid OO principles, clean code, good inline documentation, and sound design principles? I'm devoting some time to reviewing other people's code to advance my skills. Its good to

Re: Determining when a file has finished copying

2008-07-09 Thread Manuel Vazquez Acosta
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 This seems a synchronization problem. A scenario description could clear things up so we can help: Program W (The workflow) copies file F to directory B Program D (the dog) polls directory B to find is there's any new file F In this scenario,

Re: Determining when a file has finished copying

2008-07-09 Thread Larry Bates
writeson wrote: Hi all, I'm writing some code that monitors a directory for the appearance of files from a workflow. When those files appear I write a command file to a device that tells the device how to process the file. The appearance of the command file triggers the device to grab the

Openine unicode files

2008-07-09 Thread Noorhan Abbas
Hello, I wonder if someone can advise me on how to open unicode utf-8 files without using the codecs library . I am trying to use the codecs.open() from within Google Appengine but it is not working.   Thank you very much in advance, Nora

Re: Anyone happen to have optimization hints for this loop?

2008-07-09 Thread writeson
On Jul 9, 12:04 pm, dp_pearce [EMAIL PROTECTED] wrote: I have some code that takes data from an Access database and processes it into text files for another application. At the moment, I am using a number of loops that are pretty slow. I am not a hugely experienced python user so I would like

Re: start reading from certain line

2008-07-09 Thread norseman
Tim Cook wrote: On Wed, 2008-07-09 at 03:30 -0700, antar2 wrote: I am a starter in python and would like to write a program that reads lines starting with a line that contains a certain word. For example the program starts reading the program when a line is encountered that contains 'item 1'

Re: Determining when a file has finished copying

2008-07-09 Thread norseman
Also available: pgm-W copies/creates-fills whatever B/dummy when done, pgm-W renames B/dummy to B/F pgm-D only scouts for B/F and does it thing when found Steve [EMAIL PROTECTED] Manuel Vazquez Acosta wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 This seems a synchronization

Re: how to remove oldest files up to a limit efficiently

2008-07-09 Thread Terry Reedy
Dan Stromberg wrote: On Tue, 08 Jul 2008 15:18:23 -0700, [EMAIL PROTECTED] wrote: I need to mantain a filesystem where I'll keep only the most recently used (MRU) files; least recently used ones (LRU) have to be removed to leave space for newer ones. The filesystem in question is a clustered

Re: Anyone happen to have optimization hints for this loop?

2008-07-09 Thread Casey
On Jul 9, 12:04 pm, dp_pearce [EMAIL PROTECTED] wrote: I have some code that takes data from an Access database and processes it into text files for another application. At the moment, I am using a number of loops that are pretty slow. I am not a hugely experienced python user so I would like

Re: inconsistency?

2008-07-09 Thread David C. Ullrich
In article [EMAIL PROTECTED], Terry Reedy [EMAIL PROTECTED] wrote: David C. Ullrich wrote: In article [EMAIL PROTECTED], Terry Reedy [EMAIL PROTECTED] wrote: Is there a reason for the inconsistency? I would have thought in would check for elements of a sequence, regardless of what

User-defined exception: global name 'TestRunError' is not defined

2008-07-09 Thread jmike
I'm using some legacy code that has a user-defined exception in it. The top level program includes this line from TestRunError import * It also imports several other modules. These other modules do not explicitly import TestRunError. TestRunError is raised in various places throughout the

Re: Anyone happen to have optimization hints for this loop?

2008-07-09 Thread Terry Reedy
Diez B. Roggisch wrote: dp_pearce wrote: count = 0 dmntString = for z in range(0, Z): for y in range(0, Y): for x in range(0, X): fraction = domainVa[count] dmntString += dmntString += fraction Minor point, just construct

Re: sage vs enthought for sci computing

2008-07-09 Thread Ken Starks
sturlamolden wrote: On 7 Jul, 22:35, [EMAIL PROTECTED] wrote: Hello, I have recently become interested in using python for scientific computing, and came across both sage and enthought. I am curious if anyone can tell me what the differences are between the two, since there seems to be a lot of

Re: Openine unicode files

2008-07-09 Thread Terry Reedy
Noorhan Abbas wrote: Hello, I wonder if someone can advise me on how to open unicode utf-8 files without using the codecs library . I am trying to use the codecs.open() from within Google Appengine but it is not working. When posting about something 'not working', post at least a line of

Re: Impossible to change methods with special names of instances of new-style classes?

2008-07-09 Thread samwyse
On Jul 8, 4:56 pm, Joseph Barillari [EMAIL PROTECTED] wrote: My question is: did something about the way the special method names are implemented change for new-style classes? Just off the top of my head, I'd guess that it's due to classes already having a default __call__ method, used when

socket-module: different behaviour on windows / unix when a timeout is set

2008-07-09 Thread Mirko Vogt
Hey, it seems that the socket-module behaves differently on unix / windows when a timeout is set. Here an example: # test.py import socket sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM) print 'trying to connect...' sock.connect(('127.0.0.1',)) print 'connected!' # executed on

Re: Determining when a file has finished copying

2008-07-09 Thread writeson
Guys, Thanks for your replies, they are helpful. I should have included in my initial question that I don't have as much control over the program that writes (pgm-W) as I'd like. Otherwise, the write to a different filename and then rename solution would work great. There's no way to tell from

Re: Boost Python - C++ class' private static data blown away before accessing in Python?

2008-07-09 Thread Stodge
Oops - I didn't see my post so I thought something had gone wrong and reposted. Apologies for the multiple posts. On Jul 9, 11:57 am, Stodge [EMAIL PROTECTED] wrote: Could it be a boundary problem? The static data is initialised by the application. The problem arises when the python module

About Google App Engine

2008-07-09 Thread Francisco Perez
Hello every body: Recently the Google boy's announce their last toy: Google App Engine, a really great idea. Although the GAE site have documentations and guides, i think it not covers the some of the best practices when we really build a web site. I mean layers, design patterns, etc. In the link

formatting list - comma separated

2008-07-09 Thread Robert
given d: d = [soep, reeds, ook] I want it to print like soep, reeds, ook I've come up with : print (%s+, %s*(len(d)-1)) % tuple(d) but this fails for d = [] any (pythonic) options for this? Robert -- http://mail.python.org/mailman/listinfo/python-list

Re: re.search much slower then grep on some regular expressions

2008-07-09 Thread samwyse
On Jul 8, 11:01 am, Kris Kennaway [EMAIL PROTECTED] wrote: samwyse wrote: You might want to look at Plex. http://www.cosc.canterbury.ac.nz/greg.ewing/python/Plex/ Another advantage of Plex is that it compiles all of the regular expressions into a single DFA. Once that's done, the input

Re: formatting list - comma separated

2008-07-09 Thread Jerry Hill
On Wed, Jul 9, 2008 at 3:23 PM, Robert [EMAIL PROTECTED] wrote: given d: d = [soep, reeds, ook] I want it to print like soep, reeds, ook use the join() method of strings, like this: d = [soep, reeds, ook] ', '.join(d) 'soep, reeds, ook' d = [] ', '.join(d) '' -- Jerry --

Re: formatting list - comma separated

2008-07-09 Thread Paul Hankin
On Jul 9, 8:23 pm, Robert [EMAIL PROTECTED] wrote: given d: d = [soep, reeds, ook] I want it to print like soep, reeds, ook I've come up with : print (%s+, %s*(len(d)-1)) % tuple(d) but this fails for d = [] any (pythonic) options for this? print ', '.join(d) -- Paul Hankin --

Re: Impossible to change methods with special names of instances of new-style classes?

2008-07-09 Thread Terry Reedy
samwyse wrote: On Jul 8, 4:56 pm, Joseph Barillari [EMAIL PROTECTED] wrote: My question is: did something about the way the special method names are implemented change for new-style classes? I believe the difference is that for new-style classes, when special methods are called 'behind

variable question

2008-07-09 Thread Support Desk
I am trying to assign a variable using an if / else statement like so: If condition1: Variable = something If condition2: Variable = something else Do stuff with variable. But the variable assignment doesn't survive outside the if statement. Is there any better

Re: a simple 'for' question

2008-07-09 Thread Ethan Furman
Ben Keshet wrote: it didn't help. it reads the pathway as is (see errors for both tries). It looks like it had the write pathway the first time, but could not find it because it searched in the path/way instead of in the path\way. thanks for trying. The form of slash ('\' vs '/') is

  1   2   >