PyQt QCalendarWidget events question

2012-07-16 Thread tinnews
I am trying to use the PyQt4 calendar widget to perform some different actions on specific dates. There are three events available:- selectionChanged() activated(QDate) clicked(QDate) On trying all these out it would appear that the event handlers get called as follows:- The cli

Re: PyQt QCalendarWidget events question

2012-07-16 Thread tinnews
tinn...@isbd.co.uk wrote: > I am trying to use the PyQt4 calendar widget to perform some different > actions on specific dates. There are three events available:- > > selectionChanged() > activated(QDate) > clicked(QDate) > > On trying all these out it would appear that the event han

Re: PyQt QCalendarWidget events question

2012-07-17 Thread tinnews
John Posner wrote: > On 7/16/2012 12:28 PM, tinn...@isbd.co.uk wrote: > > tinn...@isbd.co.uk wrote: > >> I am trying to use the PyQt4 calendar widget to perform some different > >> actions on specific dates. There are three events available:- > >> > >> selectionChanged() > >> activated(QD

How to print something only if it exists?

2012-09-06 Thread tinnews
I want to print a series of list elements some of which may not exist, e.g. I have a line:- print day, fld[1], balance, fld[2] fld[2] doesn't always exist (fld is the result of a split) so the print fails when it isn't set. I know I could simply use an if but ultimately there may be more el

Re: How to print something only if it exists?

2012-09-08 Thread tinnews
Dave Angel wrote: > Would you like to define "exists" ? A list is not sparse, so all items > exist if their subscript is less than the length of the list. So all > you need to do is compare 2 to len(fld). > Yes, a I said a simple len(fld) will tell me if fld[2] 'exists' but it gets messy if I h

A dateutil error has appeared, due to updates? How to fix?

2012-09-23 Thread tinnews
I have a python script which uses the dateutil module with the following:- import sys import datetime import icalendar from dateutil.relativedelta import relativedelta The section of code which uses relativedelta is as follows:- # # # If the event is a rep

Re: A dateutil error has appeared, due to updates? How to fix?

2012-09-23 Thread tinnews
Peter Otten <__pete...@web.de> wrote: > tinn...@isbd.co.uk wrote: > [snip description of problem] > > Have I lost a module somewhere in the updates or has something in > > python changed such that my code no longer works as it used to? > > > > Can anyone help diagnose this please. > > You proba

What's the tidy/elegant way to protect this against null/empty parameters?

2012-10-15 Thread tinnews
I want to fix an error in some code I have installed, however I don't really want to just bodge it. The function producing the error is:- def get_text(self, idx): # override ! node = self.items[idx] a= [ ", ".join(node.tags), node.comment

Re: What's the tidy/elegant way to protect this against null/empty parameters?

2012-10-16 Thread tinnews
Marco Nawijn wrote: > On Monday, October 15, 2012 1:33:02 PM UTC+2, (unknown) wrote: > > I want to fix an error in some code I have installed, however I don't > > > > really want to just bodge it. > > > > > > > > The function producing the error is:- > > > > > > > > def get_text(self, i

Question about email.message_from_string() and Message objects

2012-11-11 Thread tinnews
I'm a little confused about the relationship between the Python email.parser convenience function email.message_from_string() and the mailbox.Message objects. If I want an mailbox.mboxMessage given the message as a stream of text is the right way to do it as follows (or at least a reasonable way t

Re: Question about email.message_from_string() and Message objects

2012-11-11 Thread tinnews
tinn...@isbd.co.uk wrote: > I'm a little confused about the relationship between the Python > email.parser convenience function email.message_from_string() and the > mailbox.Message objects. > > If I want an mailbox.mboxMessage given the message as a stream of text > is the right way to do it as f

logging, can one get it to email messages over a certain level?

2012-11-11 Thread tinnews
I'm sure this must be possible but at the moment I can't see how to do it. I want to send an E-Mail when the logging module logs a message above a certain level (probably for ERROR and CRITICAL messages only). I.e. I want some sort of hook that will be called when these messages are logged (I can

Re: logging, can one get it to email messages over a certain level?

2012-11-12 Thread tinnews
Steve Howell wrote: > On Nov 11, 9:48 am, tinn...@isbd.co.uk wrote: > > I'm sure this must be possible but at the moment I can't see how to do it. > > > > I want to send an E-Mail when the logging module logs a message above > > a certain level (probably for ERROR and CRITICAL messages only). > >

Re: logging, can one get it to email messages over a certain level?

2012-11-12 Thread tinnews
Peter Otten <__pete...@web.de> wrote: > tinn...@isbd.co.uk wrote: > > > Steve Howell wrote: > >> On Nov 11, 9:48 am, tinn...@isbd.co.uk wrote: > >> > I'm sure this must be possible but at the moment I can't see how to do > >> > it. > >> > > >> > I want to send an E-Mail when the logging module lo

How to work around a unicode problem?

2012-01-24 Thread tinnews
I have a small python program that uses the pyexiv2 package to view exif data in image files. I've hit a problem because I have a filename with accented characters in its path and the pyexiv2 code traps as follows:- Traceback (most recent call last): File "/home/chris/bin/eview.py", lin

Re: How to work around a unicode problem?

2012-01-24 Thread tinnews
Peter Otten <__pete...@web.de> wrote: > tinn...@isbd.co.uk wrote: > > > I have a small python program that uses the pyexiv2 package to view > > exif data in image files. > > > > I've hit a problem because I have a filename with accented characters > > in its path and the pyexiv2 code traps as fol

Re: How to work around a unicode problem?

2012-01-24 Thread tinnews
Chris Rebert wrote: > On Tue, Jan 24, 2012 at 3:57 AM, wrote: > > I have a small python program that uses the pyexiv2 package to view > > exif data in image files. > > > > I've hit a problem because I have a filename with accented characters > > in its path and the pyexiv2 code traps as follows:

Re: Suggest design to accomodate non-unix platforms ?

2012-04-18 Thread tinnews
Richard Shea wrote: > On a *nix box this is a reasonable bit of Python : > > cmd = "ssh -o StrictHostKeyChecking=no -i %s %s@%s '%s' > %s" % (key, > user, dns, "echo CONNECTION READY", tmp_file) > result = os.system(cmd) > > ... on a Windows box it will fail because 'ssh' isn't part of Windows.

Re: Smallest/cheapest possible Python platform?

2012-05-26 Thread tinnews
Roy Smith wrote: > What's the smallest/cheapest/lowest-power hardware platform I can run > Python on today? I'm looking for something to use as a hardware > controller in a battery-powered device and want to avoid writing in C > for this project. > > Performance requirements are minimal. I n

Re: Functions vs OOP

2011-09-04 Thread tinnews
Ian Kelly wrote: > On Sat, Sep 3, 2011 at 10:15 AM, William Gill wrote: > > During some recent research, and re-familiarization with Python, I came > > across documentation that suggests that programming using functions, and > > programming using objects were somehow opposing techniques. > > > >

Contacts/Addressbook application - any good Python ones out there?

2011-12-09 Thread tinnews
I'm after an application for managing Contacts (i.e. an Address Book) and as I suspect I will want to 'tune' it a bit Python would be my preferred language. So far I have found :- pycocuma - reasonable but rather old and a bit clunky (uses TCL/Tk) pyaddressbook - newer but very minimal D

Re: Contacts/Addressbook application - any good Python ones out there?

2011-12-09 Thread tinnews
Alec Taylor wrote: > Wammu? > I hadn't really considered gammu/wammu as I saw it as a mobile phone synchrinsation tool, but I've looked a bit harder and it might very well be what I need - thank you! > On Sat, Dec 10, 2011 at 1:41 AM, wrote: > > I'm after an application for managing Contacts (

Re: Contacts/Addressbook application - any good Python ones out there?

2011-12-09 Thread tinnews
tinn...@isbd.co.uk wrote: > Alec Taylor wrote: > > Wammu? > > > I hadn't really considered gammu/wammu as I saw it as a mobile phone > synchrinsation tool, but I've looked a bit harder and it might very > well be what I need - thank you! > Well one problem with wammu is that you can't do anythin

Documentation for python-evolution - where?

2011-12-11 Thread tinnews
I'm trying to use the python evolution (as in Gnome Evolution) module but I can't find any documetation beyond the odd trivial example and the API documentation at http://doc.conduit-project.org/evolution-python/ (or similar places presumably). The trouble with the API documentation is that it te

Re: Documentation for python-evolution - where?

2011-12-12 Thread tinnews
Chris Angelico wrote: > On Mon, Dec 12, 2011 at 9:28 AM, wrote: > > I'm trying to use the python evolution (as in Gnome Evolution) module > > but I can't find any documetation beyond the odd trivial example and > > the API documentation at http://doc.conduit-project.org/evolution-python/ > > (or

Using methodcaller in a list sort - any examples anywhere?

2011-12-13 Thread tinnews
I want to sort a list of 'things' (they're fairly complex objects) by the contents of one of the fields I can extract from the 'things' using a Python function. So I have a list L which is a list of objects of some sort. I can output the contents of a field in the list as follows:- for k in

Re: Using methodcaller in a list sort - any examples anywhere?

2011-12-13 Thread tinnews
Peter Otten <__pete...@web.de> wrote: > tinn...@isbd.co.uk wrote: > > > I want to sort a list of 'things' (they're fairly complex objects) by > > the contents of one of the fields I can extract from the 'things' > > using a Python function. > > > > So I have a list L which is a list of objects of

How to check for single character change in a string?

2011-12-24 Thread tinnews
Can anyone suggest a simple/easy way to count how many characters have changed in a string? E.g. giving results as follows:- abcdefg abcdefh 1 abcdefg abcdekk 2 abcdefg gfedcba 6 Note that position is significant, a character in a different positi

Re: How to check for single character change in a string?

2011-12-26 Thread tinnews
Roy Smith wrote: > In article , > Roy Smith wrote: > > > >>> len([x for x in zip(s1, s2) if x[0] != x[1]]) > > Heh, Ian Kelly's version: > > > sum(a == b for a, b in zip(str1, str2)) > > is cleaner than mine. Except that Ian's counts matches and the OP asked > for non-matches, but that's a

Python app installs itself in two places - why?

2011-12-28 Thread tinnews
I have installed an application called pycocuma on my xubuntu 11.10 system. It works OK and I'm aiming to develop it a little as its 'owner' has long since stopped work on it. However I'm a little puzzled by the way it has installed itself (it's a standard package from the Ubuntu repositories), a

Where does this readOne() method come from?

2011-12-28 Thread tinnews
In the (rather sparse) documentation for the vobject package it has, in the section about parsing iCalendar objects, the following:- Parsing iCalendar objects = To parse one top level component from an existing iCalendar stream or string, use the readOne fu

Re: Where does this readOne() method come from?

2011-12-29 Thread tinnews
Chris Angelico wrote: > On Thu, Dec 29, 2011 at 6:04 AM, wrote: > > In the (rather sparse) documentation for the vobject package it has, > > in the section about parsing iCalendar objects, the following:- > > > >    >>> parsedCal = vobject.readOne(icalstream) > > Presumably you have this vobjec

What's the very simplest way to run some Python from a button on a web page?

2012-01-21 Thread tinnews
I want to run a server side python script when a button on a web page is clicked. This is on a LAMP server - apache2 on xubuntu 11.10. I know I *could* run it as a CGI script but I don't want to change the web page at all when the button is clicked (I'll see the effect elsewhere on the screen any

Re: What's the very simplest way to run some Python from a button on a web page?

2012-01-22 Thread tinnews
Tim Roberts wrote: > tinn...@isbd.co.uk wrote: > > > >I want to run a server side python script when a button on a web page > >is clicked. This is on a LAMP server - apache2 on xubuntu 11.10. > > > >I know I *could* run it as a CGI script but I don't want to change the > >web page at all when the

Re: What's the very simplest way to run some Python from a button on a web page?

2012-01-22 Thread tinnews
Chris Angelico wrote: > On Sun, Jan 22, 2012 at 3:36 PM, Tim Roberts wrote: > > It seems what you're after is AJAX.  If you are using a Javascript > > framework like jQuery, it's easy to fire off an asynchronous request back > > to your server that leaves the existing page alone. > > If you aren

Can't get any output from python-sqlkit, how to diagnose?

2013-03-11 Thread tinnews
I am trying to use python-sqlkit (https://pypi.python.org/pypi/sqlkit/0.9.5.1) but I'm not really getting over the first hurdle. If I run sqledit (the ready made executable that needs no programming) on my data then it works fine and displays my table data. However if I enter the minimal example

What's the easiest Python datagrid GUI (preferably with easy database hooks as well)?

2013-03-13 Thread tinnews
I want to write a fairly trivial database driven application, it will basically present a few columns from a database, allow the user to add and/or edit rows, recalculate the values in one column and write the data back to the database. I want to show the data and allow editing of the data in a da

Re: What's the easiest Python datagrid GUI (preferably with easy database hooks as well)?

2013-03-13 Thread tinnews
Walter Hurry wrote: > On Wed, 13 Mar 2013 18:40:07 +0000, tinnews wrote: > > > I want to write a fairly trivial database driven application, it will > > basically present a few columns from a database, allow the user to add > > and/or edit rows, recalculate the values in

wxgrid - is there an easy way to set alignment of a column?

2013-03-15 Thread tinnews
I'm using wxGrid and finding it fairly straightforward but I can't see an easy way to set the alignment (left, centre, right) for a whole column. There's SetDefaultCellAlignment() which sets the default for the whole grid and there's SetCellAlignment() which sets it for a specific cell but there

Re: wxgrid - is there an easy way to set alignment of a column?

2013-03-15 Thread tinnews
Ian Kelly wrote: > On Fri, Mar 15, 2013 at 5:50 AM, wrote: > > I'm using wxGrid and finding it fairly straightforward but I can't see > > an easy way to set the alignment (left, centre, right) for a whole > > column. > > > > There's SetDefaultCellAlignment() which sets the default for the whole

mailbox.Maildir question/problem

2007-12-11 Thread tinnews
I am trying to write a utility to remove empty maildir mailboxes. It sounds like this should be very simple but it's proving really difficult. I'm doing this on a Fedora 7 system with python 2.5. The first question is how to detect whether a directory is a maildir mailbox. The following code sn

Re: mailbox.Maildir question/problem

2007-12-14 Thread tinnews
Ross Ridge <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> wrote: > >Is there *any* way I can get python to access maildirs > >which are not named using this (IMHO stupid) convention? > > Well, the mailbox module doesn't support deleting mailboxes, so I'm not > sure why you want to use it. I was

Re: Best way to protect my new commercial software.

2007-12-14 Thread tinnews
Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2007-12-14, farsheed <[EMAIL PROTECTED]> wrote: > > > Let me be clear for you: there are someone in my company who > > love to use my software in other companies that she works > > there also. and because it is an inhouse tool, my CEO wanted > > me to

Re: Best way to protect my new commercial software.

2007-12-18 Thread tinnews
Jan Claeys <[EMAIL PROTECTED]> wrote: > Op Fri, 14 Dec 2007 16:54:35 +, schreef Grant Edwards: > > > Uh what? I don't know what country you're in, but in the US, it doesn't > > take any time at all to copyright something. The mere act of writing > > something copyrights it. I thought it was

Where best to put local modules?

2007-12-19 Thread tinnews
I'm just beginning to create some python modules for my own use and I'm wondering where to put them. Initially I have put them in $HOME/bin and I have set PYTHONPATH to point to them there. It all seems to be OK but I was wondering if I might be storing up problems for the future by putting pytho

Re: Where best to put local modules?

2007-12-20 Thread tinnews
Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Wed, 19 Dec 2007 14:02:20 -0300, <[EMAIL PROTECTED]> escribi?: > > > I'm just beginning to create some python modules for my own use and > > I'm wondering where to put them. Initially I have put them in > > $HOME/bin and I have set PYTHONPATH to p

Re: Where best to put local modules?

2007-12-20 Thread tinnews
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] a écrit : > > I'm just beginning to create some python modules for my own use and > > I'm wondering where to put them. Initially I have put them in > > $HOME/bin and I have set PYTHONPATH to point to them there. It all > > seems t

Re: Question about email-handling modules

2007-12-20 Thread tinnews
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Thu, 20 Dec 2007 09:31:10 +, Robert Latest wrote: > [snip most of question and helpful answer] > > But note that message.get_payload() will return either a string (for > single part emails) or a list of Messages (for multi-part messages). > No

Re: Where best to put local modules?

2007-12-20 Thread tinnews
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] a écrit : > > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] a écrit : > >>> I'm just beginning to create some python modules for my own use and > >>> I'm wondering where to put them. Initially I have put the

Very strange caching problem with python script run from apache

2007-12-28 Thread tinnews
I'm running a python script via the apache ExtFilterDefine directive, it works basically as expected *except* that when I change the script apache/firefox continue to run the old version of the python script until I remove the script completely and then replace it. I.e. my script is called tl2html

Re: Very strange caching problem with python script run from apache

2007-12-28 Thread tinnews
[EMAIL PROTECTED] wrote: > I'm running a python script via the apache ExtFilterDefine directive, > it works basically as expected *except* that when I change the script > apache/firefox continue to run the old version of the python script > until I remove the script completely and then replace it.

Re: how to use bool

2008-01-03 Thread tinnews
[EMAIL PROTECTED] wrote: > hi, i have some code where i set a bool type variable and if the value > is false i would like to return from the method with an error msg.. > being a beginner I wd like some help here > > class myclass: > . > def mymethod(self): > success=

Re: how to use bool

2008-01-04 Thread tinnews
Chris Mellon <[EMAIL PROTECTED]> wrote: > On 03 Jan 2008 16:09:53 GMT, <[EMAIL PROTECTED]> wrote: > > > > [EMAIL PROTECTED] wrote: > > > hi, i have some code where i set a bool type variable and if the value > > > is false i would like to return from the method with an error msg.. > > > being a be

Re: Globals or objects?

2008-02-21 Thread tinnews
Steve Holden <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I had a global variable holding a count. One source Google found > > suggested that I wouldn't need the global if I used an object. So I > > created a Singleton class that now holds the former global as an > > instance attribute

Re: Globals or objects?

2008-02-21 Thread tinnews
Aahz <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > <[EMAIL PROTECTED]> wrote: > > > >I had a global variable holding a count. One source Google found > >suggested that I wouldn't need the global if I used an object. So I > >created a Singleton class that now holds the former globa

Re: Globals or objects?

2008-02-21 Thread tinnews
Aahz <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > <[EMAIL PROTECTED]> wrote: > >Aahz <[EMAIL PROTECTED]> wrote: > >> In article <[EMAIL PROTECTED]>, > >> <[EMAIL PROTECTED]> wrote: > >>> > >>>I had a global variable holding a count. One source Google found > >>>suggested that I

Re: Globals or objects?

2008-02-22 Thread tinnews
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >> > but you do keep having to use a longer reference to the value so > >> >what have you won? > >> > >> Clarity, simplicity, robustness > > > > Clarity - why is it clearer? > > Consider two function calls: > > > x = ham(arg, counter) > y = spam

Re: Globals or objects?

2008-02-22 Thread tinnews
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 22 Feb 2008 12:01:20 +, tinnews wrote: > > > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >> >> > but you do keep having to use a longer reference to the value > >> &

Re: Globals or objects?

2008-02-23 Thread tinnews
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 22 Feb 2008 18:53:54 +, tinnews wrote: > > >> > But you're not comparing what the OP posted. He was comparing a > >> > global with an object with a single variable inside it. Either would &g

mailbox.mbox.add() appears to set both access and modification times

2008-12-19 Thread tinnews
I'm using mailbox in Python 2.5.2 to filter incoming mail into separate mailboxes. I prefer mbox for various reasons and so I have used that format. It would appear then when I do:- dest = mailbox.mbox(destDir, factory=None) dest.add(m) it sets both the access and modification times of

How to find "in" in the documentation

2009-03-13 Thread tinnews
I've had this trouble before, how do I find the details of how "in" works in the documentation. E.g. the details of:- if string in bigstring: It gets a mention in the "if" section but not a lot. -- Chris Green -- http://mail.python.org/mailman/listinfo/python-list

Neatest way to do a case insensitive "in"?

2009-03-13 Thread tinnews
What's the neatest way to do the following in case insensitive fashion:- if stringA in stringB: bla bla bla I know I can just do:- if stringA.lower() in stringB.lower(): bla bla bla But I was wondering if there's a neater/easier way? -- Chris Green -- http://mail.pytho

Re: How to find "in" in the documentation

2009-03-13 Thread tinnews
Albert Hopkins wrote: > On Fri, 2009-03-13 at 21:01 +, tinn...@isbd.co.uk wrote: > > I've had this trouble before, how do I find the details of how "in" > > works in the documentation. E.g. the details of:- > > > > if string in bigstring: > > > > It gets a mention in the "if" section bu

Re: Neatest way to do a case insensitive "in"?

2009-03-13 Thread tinnews
Albert Hopkins wrote: > On Fri, 2009-03-13 at 21:04 +, tinn...@isbd.co.uk wrote: > > What's the neatest way to do the following in case insensitive fashion:- > > > > if stringA in stringB: > > bla bla bla > > > > I know I can just do:- > > > > if stringA.lower() in stringB.l

Python package for .ics (iCalendar) files

2009-03-13 Thread tinnews
Is there an 'offical' Python package for handling .ics files or is the follwing the best there is:- http://codespeak.net/icalendar/ It seems rather old but Google didn't pop anything else up. -- Chris Green -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find "in" in the documentation

2009-03-14 Thread tinnews
Colin J. Williams wrote: > Piet van Oostrum wrote: > >> tinn...@isbd.co.uk (t) wrote: > > > >> t> I've had this trouble before, how do I find the details of how "in" > >> t> works in the documentation. E.g. the details of:- > > > >> t> if string in bigstring: > > > >> t> It gets a ment

How to add months to a date (datetime object)?

2009-03-15 Thread tinnews
I have a date in the form of a datetime object and I want to add (for example) three months to it. At the moment I can't see any very obvious way of doing this. I need something like:- myDate = datetime.date.today() inc = datetime.timedelta(months=3) myDate += inc but, of course, ti

Re: How to add months to a date (datetime object)?

2009-03-15 Thread tinnews
Roy Smith wrote: > In article <49bd3ab8$0$510$bed64...@news.gradwell.net>, tinn...@isbd.co.uk > wrote: > > > I have a date in the form of a datetime object and I want to add (for > > example) three months to it. At the moment I can't see any very > > obvious way of doing this. I need something

Re: How to add months to a date (datetime object)?

2009-03-15 Thread tinnews
Chris Rebert wrote: > On Sun, Mar 15, 2009 at 10:28 AM, wrote: > > I have a date in the form of a datetime object and I want to add (for > > example) three months to it.  At the moment I can't see any very > > obvious way of doing this.  I need something like:- > > > >    myDate = datetime.date.

Re: How to add months to a date (datetime object)?

2009-03-16 Thread tinnews
Ned Deily wrote: > In article <49bd42ac$0$512$bed64...@news.gradwell.net>, > tinn...@isbd.co.uk wrote: > > I was just hoping there was some calendar object in Python which could > > do all that for me (I need the handling of 31st and February etc.) > > Whatever your requirement, chances are date

mailbox.mbox.add() sets access time as well as modification time

2009-04-23 Thread tinnews
It seems to me that mailbox.mbox.add() sets the access time of a mbox file as well as the modification time. This is not good for MUAs that detect new mail by looking to see if the access time is before the modification time. Have I done something wrong somewhere or is mailbox.mbox.add() really a

Re: mailbox.mbox.add() sets access time as well as modification time

2009-04-25 Thread tinnews
MRAB wrote: > tinn...@isbd.co.uk wrote: > > It seems to me that mailbox.mbox.add() sets the access time of a mbox > > file as well as the modification time. This is not good for MUAs that > > detect new mail by looking to see if the access time is before the > > modification time. > > > > Have I

Re: mailbox.mbox.add() sets access time as well as modification time

2009-04-25 Thread tinnews
Grant Edwards wrote: > On 2009-04-24, Grant Edwards wrote: > > > Anybody writing to an mbox mailbox has to follow the rules if > > they expect to interoperate with other mail applications. If > > mailbox.mbox.add() doesn't preserve the atime when writing to > > an mbox, then mailbox.mbox.add is

Re: mailbox.mbox.add() sets access time as well as modification time

2009-04-25 Thread tinnews
Grant Edwards wrote: > On 2009-04-24, Lawrence D'Oliveiro wrote: > > In message , Grant Edwards > > wrote: > > > >> AFAIK, atime >> when an mbox contains new mail for at least 20 years. > > > > Doesn't apply to maildir though, does it? > > Nope. With maildir, there's a completely separate dire

mailbox.mbox.add() also seems to set file permissions

2009-04-25 Thread tinnews
mailbox.mbox.add() has *another* 'quirk'. When it adds a message to an mbox file it seems to set the permissions to 0755 which is quite wrong for mbox files. I get the feeling that the mbox versions of the functions are just bodged maildir ones. If one was creating a maildir it *might* make some

Re: mailbox.mbox.add() sets access time as well as modification time

2009-04-26 Thread tinnews
Lawrence D'Oliveiro wrote: > In message <49f33d8d$0$516$bed64...@news.gradwell.net>, tinn...@isbd.co.uk > wrote: > > > mbox has several advantages over maildir (for me anyway):- > > > > It allows easy removal of empty mailboxes (in my case by the MUA) > > Really? I just created a "junk" ma

Re: mailbox.mbox.add() sets access time as well as modification time

2009-04-26 Thread tinnews
Grant Edwards wrote: > > I suppose I could do the following:- > > > > lock the mbox > > get the atime > > add the new message with mailbox.mbox.add() > > restore the atime > > unlock the mbox > > You could fix mbox.add(). ;) > Yes, but I'm not sure that I'm that competant!

Re: mailbox.mbox.add() also seems to set file permissions

2009-04-27 Thread tinnews
Aahz wrote: > In article , > Grant Edwards wrote: > >On 2009-04-25, tinn...@isbd.co.uk wrote: > >> > >> Where should one report bugs/errors in python library classes? > > > >http://docs.python.org/bugs.html > > That's for doc bugs; regular bugs go to bugs.python.org (which is > currently down

Re: mailbox.mbox.add() sets access time as well as modification time

2009-04-28 Thread tinnews
Lawrence D'Oliveiro wrote: > In message , Grant > Edwards wrote: > > > On 2009-04-26, Lawrence D'Oliveiro > > wrote: > > > >> In message <_vqdnf6pny1gymzunz2dnuvz_qcdn...@posted.visi>, Grant Edwards > >> wrote: > >> > >>> ... if one didn't care about backwards-compatiblity with old e-mail > >>>

How to retry something with a timeout in Python?

2009-04-28 Thread tinnews
This feels like it should be simple but I can't see a clean way of doing it at the moment. I want to retry locking a file for a number of times and then give up, in pseudo-code it would be something like:- for N times try to lock file if successful break out of for loop

Re: How to retry something with a timeout in Python?

2009-04-29 Thread tinnews
Scott David Daniels wrote: > tinn...@isbd.co.uk wrote: > > This feels like it should be simple but I can't see a clean way of > > doing it at the moment. > > > > I want to retry locking a file for a number of times and then give up, > > in pseudo-code it would be something like:- > > > > > >

Python libraries for iCalendar, which one to use?

2008-05-14 Thread tinnews
I am about to try writing a little Python utility to extract some data from an iCalendar file. A quick Google search turns up two possible libraries to use - vobject and "iCalendar package for Python". First question - have I missed any other (better?) ones? Second question - how do I choose whi

Re: python newbie: some surprises

2008-05-15 Thread tinnews
Kees Bakker <[EMAIL PROTECTED]> wrote: > > So far, I have seen only one editor that understands the difference between > TABs and indentation, and that is Emacs. Most vi clones (and the original vi) do too! :-) E.g. in the clone I use (vile) there are independent settings for tabstop and shiftw

Python database 'frontends', what's available?

2008-05-23 Thread tinnews
I'm desperately trying to move a Microsoft Access database application (a simple accounts system I wrote myself) to Linux. Python is one of my preferred programming laguages so I wonder if there are any good Python 'frameworks' for writing database applications, in particular I need good reporting

Re: Python database 'frontends', what's available?

2008-05-25 Thread tinnews
Mike Driscoll <[EMAIL PROTECTED]> wrote: > On May 23, 1:59 pm, [EMAIL PROTECTED] wrote: > > I'm desperately trying to move a Microsoft Access database application > > (a simple accounts system I wrote myself) to Linux.  Python is one of > > my preferred programming laguages so I wonder if there are

Efficient way of testing for substring being one of a set?

2008-04-03 Thread tinnews
What's the neatest and/or most efficient way of testing if one of a set of strings (contained in a dictionary, list or similar) is a sub-string of a given string? I.e. I have a string delivered into my program and I want to see if any of a set of strings is a substring of the string I have been gi

Re: Efficient way of testing for substring being one of a set?

2008-04-03 Thread tinnews
Paul Hankin <[EMAIL PROTECTED]> wrote: > On Apr 3, 12:37 pm, [EMAIL PROTECTED] wrote: > > What's the neatest and/or most efficient way of testing if one of a > > set of strings (contained in a dictionary, list or similar) is a > > sub-string of a given string? > > > > I.e. I have a string delivered

Re: Efficient way of testing for substring being one of a set?

2008-04-03 Thread tinnews
Jeff <[EMAIL PROTECTED]> wrote: > def foo(sample, strings): > for s in strings: > if sample in s: > return True > return False > > This was an order of magnitude faster for me than using str.find or > str.index. That was finding rare words i

A question about creating Maildir mailboxes with mailbox.Maildir

2008-04-03 Thread tinnews
I have mail delivered into Maildirs which live in a directory hierarchy as follows:- /home/isbd/Mail/Li/ /home/isbd/Mail/In/ Note that neither /home/isbd/Mail/Li nor /home/isbd/Mail/In are Maildir mailboxes. How do I create a new Maildir mailbox in either Li or In with mailbox.Maildir.ad

How easy is it to install python as non-root user?

2008-04-03 Thread tinnews
Does python install fairly easily for a non-root user? I have an ssh login account onto a Linux system that currently provides Python 2.4.3 and I'd really like to use some of the improvements in Python 2.5.x. So, if I download the Python-2.5.2.tgz file is it just the standard:- ./configure -

Re: How easy is it to install python as non-root user?

2008-04-03 Thread tinnews
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] a écrit : > > Does python install fairly easily for a non-root user? > > > > I have an ssh login account onto a Linux system that currently > > provides Python 2.4.3 and I'd really like to use some of the > > improvements in Python

mailbox.Maildir(), confusing documentation

2008-04-03 Thread tinnews
Having got my Python 2.5.2 installed I'm trying some things out with the mailbox.Maildir() class. If I do the following:- import maibox mailbox.Maildir("/home/isbd/Mail/Li/pytest") then the pytest Maildir mailbox is created - which is great but isn't documented. If the above creates the

Is there any way to say ignore case with "in"?

2008-04-04 Thread tinnews
Is there any way in python to say if string1 in string2: ignoring the case of string1 and string2? I know I could use:- if lower(string1) in lower(string2): but it somehow feels there ought to be an easier (tidier?) way. -- Chris Green -- http://mail.python.org/m

Re: mailbox.Maildir(), confusing documentation

2008-04-06 Thread tinnews
Peter Otten <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > > Having got my Python 2.5.2 installed I'm trying some things out with > > the mailbox.Maildir() class. > > > > If I do the following:- > > > > import maibox > > mailbox.Maildir("/home/isbd/Mail/Li/pytest") > > > > th

Presumably an import is no faster or slower than opening a file?

2008-04-06 Thread tinnews
I'm trying to minimise the overheads of a small Python utility, I'm not really too fussed about how fast it is but I would like to minimise its loading effect on the system as it could be called lots of times (and, no, I don't think there's an easy way of keeping it running and using the same copy

A file iteration question/problem

2008-04-06 Thread tinnews
I want to iterate through the lines of a file in a recursive function so I can't use:- f = open(listfile, 'r') for ln in f: because when the function calls itself it won't see any more lines in the file. E.g. more fully I want to do somthing like:- def recfun(f) while True:

Re: Presumably an import is no faster or slower than opening a file?

2008-04-06 Thread tinnews
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On 6 avr, 15:41, [EMAIL PROTECTED] wrote: > > I'm trying to minimise the overheads of a small Python utility, I'm > > not really too fussed about how fast it is but I would like to > > minimise its loading effect on the system as it could be called lot

Re: Presumably an import is no faster or slower than opening a file?

2008-04-07 Thread tinnews
Paul McGuire <[EMAIL PROTECTED]> wrote: > On Apr 6, 8:41 am, [EMAIL PROTECTED] wrote: > > I'm trying to minimise the overheads of a small Python utility, I'm > > not really too fussed about how fast it is but I would like to > > minimise its loading effect on the system as it could be called lots >

Re: A file iteration question/problem

2008-04-07 Thread tinnews
Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > On Apr 6, 4:40 pm, [EMAIL PROTECTED] wrote: > > I want to iterate through the lines of a file in a recursive function > > so I can't use:- > > > >     f = open(listfile, 'r') > >     for ln in f: > > > > because when the function calls itself it won't s

How to find documentation about methods etc. for iterators

2008-04-09 Thread tinnews
I'm not sure if I have even phrased that right but anyway How does one find (in the standard Python documentation) information about things like the iteritems() method and the enumerate() function. They are mentioned in the tutorial as ways of getting more information as you loop through an o

  1   2   >