[Tutor] How to match strange characters

2008-09-07 Thread J. Van Brimmer
I have a legacy program at work that outputs a text file with this header: ÉÍÍ» º Radio Source Precession Program º º by John B. Doe º º 31 August 1992 º ÈÍÍÍ

Re: [Tutor] Formating from hhmms to hh:mm:ss

2008-09-07 Thread Wayne Watson
Title: Signature.html Well, maybe. Here's the file the change and results: # Using datetime to do date-time math on a file date-time stamp and # the creating the new stamp from datetime import datetime, timedelta format = '%Y%m%d_%H%M%S' #d=datetime.strptime('20080321_113405', format) d = da

Re: [Tutor] Formating from hhmms to hh:mm:ss

2008-09-07 Thread John Fouhy
2008/9/8 Wayne Watson <[EMAIL PROTECTED]>: > I'm sure you have the essence below, but I'm not familiar with the In/ Out > notation. Apparently, I need to scoop up the In lines into a file and add > some print stmts for the In[x] d lines. Kent uses IPython, which is an enhanced version of the stand

Re: [Tutor] Formating from hhmms to hh:mm:ss

2008-09-07 Thread Wayne Watson
Title: Signature.html Yep, I tried strptime and strftime but got stuck too often on something or other (mostly mixing time, datetime somehow), so simplified matters to make it clear what I was trying to do. I'm sure you have the essence below, but I'm not familiar with the In/ Out notation. Ap

Re: [Tutor] Formating from hhmms to hh:mm:ss

2008-09-07 Thread Kent Johnson
On Sun, Sep 7, 2008 at 9:33 PM, Wayne Watson <[EMAIL PROTECTED]> wrote: > Here's as far as I can go with this. The last line of output asks the > question I need an answer for. > (Once again my direct post to tutor@python.org has failed to appear here > (sent 5:42 PDT), as before.) It arrived late

Re: [Tutor] Formating from hhmms to hh:mm:ss

2008-09-07 Thread John Fouhy
2008/9/8 Wayne Watson <[EMAIL PROTECTED]>: > def adjust_ftime(atime, sec): > # mmdd_hhmmss, seconds in, new mmdd_hhmmss out > ts = atime[1:-7] # use time stamp portion > ayear = int(ts[0:4]) > amonth = int(ts[4:6]) > aday= int(ts[6:8]) > ahour = int(ts[

Re: [Tutor] Formating from hhmms to hh:mm:ss

2008-09-07 Thread Wayne Watson
Title: Signature.html Here's as far as I can go with this. The last line of output asks the question I need an answer for. (Once again my direct post to tutor@python.org has failed to appear here (sent 5:42 PDT), as before.) # Using datetime to do date-time math on a file date-time stamp and #

Re: [Tutor] Formating from hhmms to hh:mm:ss

2008-09-07 Thread Wayne Watson
Title: Signature.html Yes, my posting has become rather odd in that I don't see my own posts, except for the first one. It seems to have started about a week ago.  I asked the owner about that and haven't gotten a reply yet. I hit Reply, Reply to Sender or Reply to All on this message, I only s

Re: [Tutor] Sending email as html

2008-09-07 Thread Tim Johnson
On Sunday 07 September 2008, you wrote: > On Sun, Sep 7, 2008 at 11:27 AM, Tim Johnson <[EMAIL PROTECTED]> wrote: > > On Saturday 06 September 2008, Alan Gauld wrote: > >> There is an interersting looking link here: > >> > >> http://www.python.org/workshops/2002-02/papers/17/index.htm > > > > Yes!

Re: [Tutor] Support for datetime module

2008-09-07 Thread Kent Johnson
On Sun, Sep 7, 2008 at 3:48 PM, Johan Geldenhuys <[EMAIL PROTECTED]> wrote: > I can get the time up to the closest second with the time module, but not to > the millisecond. > When I use time.strftime, I don't know how many milliseconds are left over > to use them. OK. I guess you can use time.str

Re: [Tutor] Formating from hhmms to hh:mm:ss

2008-09-07 Thread greg whittier
On Sun, Sep 7, 2008 at 1:36 PM, Wayne Watson <[EMAIL PROTECTED]>wrote: > Yes, cut and paste directly from the code. Positively a import as seen. > Here's the full set of code: > > # The effect of adding seconds to date-time to see if day gets changed > import datetime > dt1 = datetime.datetime(20

Re: [Tutor] Support for datetime module

2008-09-07 Thread Johan Geldenhuys
I can get the time up to the closest second with the time module, but not to the millisecond. When I use time.strftime, I don't know how many milliseconds are left over to use them. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kent Johnson Sent: Sunda

Re: [Tutor] Formating from hhmms to hh:mm:ss

2008-09-07 Thread Kent Johnson
On Sun, Sep 7, 2008 at 1:17 PM, greg whittier <[EMAIL PROTECTED]> wrote: >> # program to test str... functions >> import datetime > > Are you sure you didn't do "from datetime import datetime"? or "import time" ? >> ... >> # format conversion of date+time >> dt1 = datetime.strptime("20080421_101

Re: [Tutor] Sending email as html

2008-09-07 Thread Kent Johnson
On Sun, Sep 7, 2008 at 11:27 AM, Tim Johnson <[EMAIL PROTECTED]> wrote: > On Saturday 06 September 2008, Alan Gauld wrote: >> There is an interersting looking link here: >> >> http://www.python.org/workshops/2002-02/papers/17/index.htm > Yes! Did you find the code to go with the article? My goog

Re: [Tutor] Need help with using methods in a base class

2008-09-07 Thread Kent Johnson
On Sun, Sep 7, 2008 at 11:07 AM, Roy Khristopher Bayot <[EMAIL PROTECTED]> wrote: > Hi. I added self to parts of the code. But after making an instance and > using the setData method it gave out an AttributeError. > from parallel import Parallel class LightsHandle(Parallel): > ... def

Re: [Tutor] Formating from hhmms to hh:mm:ss

2008-09-07 Thread greg whittier
Is this an actual cut and paste of your code? The problem seems to be that you're getting a time.struct_time object instead of a datetime object. See below On Sun, Sep 7, 2008 at 12:52 PM, Wayne Watson <[EMAIL PROTECTED]>wrote: > Yes, that's correct., but that reference isn't doing it for me p

Re: [Tutor] Formating from hhmms to hh:mm:ss

2008-09-07 Thread greg whittier
I'm not clear on exactly what you're looking to do, but I think you want the strftime and strptime methods. See http://docs.python.org/lib/datetime-datetime.html On Sun, Sep 7, 2008 at 11:24 AM, Wayne Watson <[EMAIL PROTECTED]>wrote: > I've been writing various functions with datetime to change

Re: [Tutor] Sending email as html

2008-09-07 Thread Tim Johnson
On Saturday 06 September 2008, Alan Gauld wrote: > "Tim Johnson" <[EMAIL PROTECTED]> wrote > > >> since PDF files are not very hard to edit with a simple text > >> editor. > >> (Never have really.) > > > > Looks like I could make up a PDF template and then put substitutions > > You could although t

[Tutor] Formating from hhmms to hh:mm:ss

2008-09-07 Thread Wayne Watson
Title: Signature.html I've been writing various functions with datetime to change date-time formats from one to another. For example, my file names have a time stamp of mmdd_hhmmss in their names. When I need to convert, say, time by adding seconds to the hhmmss part of the file name, I hav

Re: [Tutor] Need help with using methods in a base class

2008-09-07 Thread Roy Khristopher Bayot
Hi. I added self to parts of the code. But after making an instance and using the setData method it gave out an AttributeError. >>> from parallel import Parallel >>> class LightsHandle(Parallel): ... def __init__(self): ... pass ... def setData(self, data): ... Para

Re: [Tutor] Inserting an Indent in IDLE?

2008-09-07 Thread Alan Gauld
"Wayne Watson" <[EMAIL PROTECTED]> wrote Signature.htmlOccasionally I would like to indent 20-30 lines of code. I don't see a way to do this in IDLE other than brute force. Format->Indent region? Ctrl-] Format Dedent region Ctrl-[ Seems to work for me. Alan G ___

Re: [Tutor] ftplib.storbinary and using a progress bar

2008-09-07 Thread Alan Gauld
"Kent Johnson" <[EMAIL PROTECTED]> wrote I don't think threading will help here, the problem is that the progress information is not available. If you are transferring from A to B and can find the size of the file at A and poll the size at B you can display progress. OTOH if that is not avail

[Tutor] Inserting an Indent in IDLE?

2008-09-07 Thread Wayne Watson
Title: Signature.html Occasionally I would like to indent 20-30 lines of code. I don't see a way to do this in IDLE other than brute force. The Replace dialog doesn't seem to offer a way. Does it by any chance use regular expressions to do this? -- Wayne Watson (Watson Adventures,

Re: [Tutor] ftplib.storbinary and using a progress bar

2008-09-07 Thread johnf
On Saturday 06 September 2008 06:49:39 pm johnf wrote: > Hi, > I'm currently using ftplib.storbinary() to upload a file to a FTP server. > However, I would like to inform the user of the progress being made during > the file transfer (it could be a very long transfer). But > ftplib.storbinary() ha

Re: [Tutor] ftplib.storbinary and using a progress bar

2008-09-07 Thread Kent Johnson
On Sun, Sep 7, 2008 at 4:13 AM, Alan Gauld <[EMAIL PROTECTED]> wrote: > "johnf" <[EMAIL PROTECTED]> wrote > >> the file transfer (it could be a very long transfer). But >> ftplib.storbinary() has no callback like retrbinary() so does anyone have >> a >> thought on how I can update my user on the p

Re: [Tutor] Support for datetime module

2008-09-07 Thread Kent Johnson
On Sun, Sep 7, 2008 at 6:17 AM, Johan Geldenhuys <[EMAIL PROTECTED]> wrote: > Thanks Kent, > > Let me explain what I need it for. > > I have a systemUpTime is seconds that I got from a SNMP agent. > > I want to work out when the system uptime began and want to put that in ISO > format time to the m

Re: [Tutor] Online Scripting

2008-09-07 Thread Kent Johnson
On Sun, Sep 7, 2008 at 5:25 AM, Omer <[EMAIL PROTECTED]> wrote: > Has anyone a clue as to where might I host my script, so's A: the host > "runs" my script periodical (Once every Two hours? If I can configure it to > only run during the day than that's even better), and B: The host lets my > scrip

Re: [Tutor] ftplib.storbinary and using a progress bar

2008-09-07 Thread Kent Johnson
On Sat, Sep 6, 2008 at 9:49 PM, johnf <[EMAIL PROTECTED]> wrote: > Hi, > I'm currently using ftplib.storbinary() to upload a file to a FTP server. > However, I would like to inform the user of the progress being made during > the file transfer (it could be a very long transfer). But > ftplib.storb

Re: [Tutor] Support for datetime module

2008-09-07 Thread Johan Geldenhuys
Thanks Kent, Let me explain what I need it for. I have a systemUpTime is seconds that I got from a SNMP agent. I want to work out when the system uptime began and want to put that in ISO format time to the millisecond. So my idea is to take a timestamp in seconds when I get the systemUpTime. I

[Tutor] Online Scripting

2008-09-07 Thread Omer
Hello. I started a project with a goal: To have a script "read" an entire message board, dedicated to various events, process this information into an iCalendar file, and finally- base a Google Calendar on the iCal file. Now, The script is done and it works great on my desktop. The problem is, se

Re: [Tutor] ftplib.storbinary and using a progress bar

2008-09-07 Thread Alan Gauld
"johnf" <[EMAIL PROTECTED]> wrote the file transfer (it could be a very long transfer). But ftplib.storbinary() has no callback like retrbinary() so does anyone have a thought on how I can update my user on the progress of the transfer. If you don't fancy getting the 2.6 source as Terry sug