Re: [Tutor] Threading

2008-09-11 Thread Dick Moores
At 05:31 PM 9/11/2008, Kent Johnson wrote: On Thu, Sep 11, 2008 at 10:56 AM, Oleg Oltar <[EMAIL PROTECTED]> wrote: > Hi! > > I need to open about 1200 urls from my database. And to check that those > urls are really exists. > > I used urllib2.urlopen for it. But it's a little bit slow. I thought

Re: [Tutor] Threading

2008-09-11 Thread Dick Moores
At 05:31 PM 9/11/2008, Kent Johnson wrote: On Thu, Sep 11, 2008 at 10:56 AM, Oleg Oltar <[EMAIL PROTECTED]> wrote: > Hi! > > I need to open about 1200 urls from my database. And to check that those > urls are really exists. > > I used urllib2.urlopen for it. But it's a little bit slow. I thought

Re: [Tutor] Win32 extensions

2008-09-11 Thread Spencer Parker
That was what I was afraid of...I might have to go the virtualization route instead. PXE = pre-execution environment On Thu, Sep 11, 2008 at 5:31 PM, Alan Gauld <[EMAIL PROTECTED]>wrote: > > "Spencer Parker" <[EMAIL PROTECTED]> wrote > > 2003. I was wondering if it is possible to create a scri

Re: [Tutor] Releasing a File for Access

2008-09-11 Thread Wayne Watson
Title: Signature.html Thanks. So noted. I suspect I need to use something like sys.exit(). However, I'm in development mode right now with IDLE, and there's a small penalty for using it with IDLE. I think it's a dialog that asks if one wants to really exit. The files are maybe 70 characters pe

Re: [Tutor] Releasing a File for Access

2008-09-11 Thread bob gailer
Wayne Watson wrote: Enclosed is a segment of a program which copies a txt file, but replaces the first line with a new one. The new one has a suffix of tmp. After it executed the code and exited the program normally (running out of code), I couldn't access the new tmp file. It was listed by Win

Re: [Tutor] Threading

2008-09-11 Thread Kent Johnson
On Thu, Sep 11, 2008 at 10:56 AM, Oleg Oltar <[EMAIL PROTECTED]> wrote: > Hi! > > I need to open about 1200 urls from my database. And to check that those > urls are really exists. > > I used urllib2.urlopen for it. But it's a little bit slow. I thought that > it's might be a good idea to do it in

[Tutor] Releasing a File for Access

2008-09-11 Thread Wayne Watson
Title: Signature.html Enclosed is a segment of a program which copies a txt file, but replaces the first line with a new one. The new one has a suffix of tmp. After it executed the code and exited the program normally (running out of code), I couldn't access the new tmp file. It was listed by W

Re: [Tutor] No Blank Separator between Date and Time Valid?

2008-09-11 Thread Martin Walsh
Wayne Watson wrote: > This program segment allows an invalid date to go undetected. See below. > > def set_time_stamp(d1): > # /mm/dd hh:mm:ss in, vmmdd_hhmmss.27 out > formatin = '%Y/%m/%d %H:%M:%S' > d1 = d1.lstrip() > try: > date1 = dateti

Re: [Tutor] No Blank Separator between Date and Time Valid?

2008-09-11 Thread Johan Geldenhuys
It all depends how you specify the format of the time you want, look at the example. >>> time.strftime('%Y%M%D%H%M%S') '200820092030' >>> >>> >>> time.strftime('%Y%M%D %H%M%S') '200820 092055' >>> Notice in the second statement, I added the space separator between the %D and %H.

Re: [Tutor] Win32 extensions

2008-09-11 Thread Alan Gauld
"Spencer Parker" <[EMAIL PROTECTED]> wrote 2003. I was wondering if it is possible to create a script on a linux machine and use the Win32 extensions...since I need those to use WMI python module as well. Is this actually possible? Yes if you spend a lot of money. You can buy a set of libr

Re: [Tutor] How to create array of variants?

2008-09-11 Thread Alan Gauld
"Krasyn" <[EMAIL PROTECTED]> wrote I'm trying to translate the following VB code into Python and not sure how to create an array of variants. All variables in Python are effectively variants - variables that can store any type. So an array of variants equates to a Python list VB Code: Su

Re: [Tutor] Looking at a String as a Struct?

2008-09-11 Thread Alan Gauld
"Wayne Watson" <[EMAIL PROTECTED]> wrote lIs it possible in Python to look at a string as a "struct". I assume you mean you have a lot of data all stored in a single string? I also assume that either the string has a fixed delimiter - like a comma separated file? Or it has fixed length field

[Tutor] Win32 extensions

2008-09-11 Thread Spencer Parker
I am tasked with a project to use WMI to script something on Windows Server 2003. I was wondering if it is possible to create a script on a linux machine and use the Win32 extensions...since I need those to use WMI python module as well. Is this actually possible? Otherwise I would have to use a

Re: [Tutor] Threading

2008-09-11 Thread Jeff Younker
On Sep 11, 2008, at 7:56 AM, Oleg Oltar wrote: Hi! I need to open about 1200 urls from my database. And to check that those urls are really exists. I used urllib2.urlopen for it. But it's a little bit slow. I thought that it's might be a good idea to do it in a threads. So it can add so

Re: [Tutor] importing strings

2008-09-11 Thread Jeff Younker
On Sep 11, 2008, at 2:15 PM, Patrick wrote: I have been able to import a string from another module threw a dictionary but I can't seem to figure out how to do it so that I can insert a value into the %s placeholder afterwards. The % operator is probably what you are looking for. format = "th

[Tutor] importing strings

2008-09-11 Thread Patrick
I would like to import a string with a "placeholder" in it. for example "this is a %s" I would then like to insert the value into it after importation, "this is a %s" (test) I have been able to import a string from another module threw a dictionary but I can't seem to figure out how to do it so

Re: [Tutor] How to create array of variants?

2008-09-11 Thread Krasyn
Kelie-2 wrote: > > Hello group, > > I'm trying to translate the following VB code into Python and not sure how > to > create an array of variants. > > Thanks for your help! > > VB Code: > Sub SetXdata() > Dim lineObj As AcadLine > Set lineObj = ThisDrawing.ModelSpace.Item(0) > >

[Tutor] No Blank Separator between Date and Time Valid?

2008-09-11 Thread Wayne Watson
Title: Signature.html This program segment allows an invalid date to go undetected. See below. from datetime import datetime import time def set_time_stamp(d1):     # /mm/dd hh:mm:ss in, vmmdd_hhmmss.27 out     formatin = '%Y/%m/%d %H:%M:%S'     d1 = d1.lstrip()     try:     dat

Re: [Tutor] Looking at a String as a Struct?

2008-09-11 Thread Wayne Watson
Title: Signature.html Wayne Watson wrote: Thanks. I had a hunch that might be a good way to do it. I saw something like this in other s/w. Now I know what they were up to. Omer wrote: Class Person:     def __init__(str):         self.Firstname = str[0:4]         self.Surname =

Re: [Tutor] Looking at a String as a Struct?

2008-09-11 Thread Marc Tompkins
On Thu, Sep 11, 2008 at 3:58 AM, Wayne Watson <[EMAIL PROTECTED]>wrote: > Is it possible in Python to look at a string as a "struct". I don't think > a struct exists in python. Actually, is there something analogous to a > record. In the case of strings, suppose I have string that is composed of

Re: [Tutor] Fwd: Looking at a String as a Struct?

2008-09-11 Thread Wayne Watson
Title: Signature.html I've done far worse by hitting the wrong key! ;-) I see a post above gets into the class idea. Jaggo wrote: Silly google sent in the middle of my editing. Good thing it only sent to you then. Please, ignore these 2 messages. Sorry 'bout the mess. -- Forwa

Re: [Tutor] Looking at a String as a Struct?

2008-09-11 Thread Omer
Class Person: def __init__(str): self.Firstname = str[0:4] self.Surname = str[5:7] (...) If your string separates the values of each person using tags rather than fixed lengthes, build it like: or: self.Firstname = str[0:str.find("Last name:")]

Re: [Tutor] absolute beginner

2008-09-11 Thread Richard Lovely
I'd absolutely recommend "Python for Dummies" published by Wileys. I've not used that actual book, but I've found other books in the series extremely helpful. http://www.amazon.com/Python-Dummies-Computer-Tech/dp/0471778648/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1221146720&sr=8-1 On Thu, Sep 11, 20

[Tutor] body extraction from mbox file - emails

2008-09-11 Thread grishma govani
The Code is take from the last example on the example page. When I run the command i see the msg lenght is 25 but it run through it only once, updates and counter and does not run through the rest of messages. I want to extract the body irrespective of whether there is an attachment or not.

[Tutor] Threading

2008-09-11 Thread Oleg Oltar
Hi! I need to open about 1200 urls from my database. And to check that those urls are really exists. I used urllib2.urlopen for it. But it's a little bit slow. I thought that it's might be a good idea to do it in a threads. So it can add some performance to my code. Unfortunately I can't get sta

Re: [Tutor] absolute beginner

2008-09-11 Thread Evans
I'd start by going through Alan's marvellous material. They are very good for beginners like yourself. If you run into any problems, just post a message here. http://www.freenetpages.co.uk/hp/alan.gauld Happy coding! -- Evans http://www.javawug.org - Original Message - From: Johnn

Re: [Tutor] Looking at a String as a Struct?

2008-09-11 Thread Wayne Watson
Title: Signature.html True enough, but that gets messy. I'd have to keep them perhaps as global variables or pass then around a lot from function to function as a collection.  I see WW posted above you about  dictionaries. Maybe that's the way to do it.  I'll look into it. Kent Johnson wrote:

Re: [Tutor] Looking at a String as a Struct?

2008-09-11 Thread Kent Johnson
On Thu, Sep 11, 2008 at 6:58 AM, Wayne Watson <[EMAIL PROTECTED]> wrote: > Is it possible in Python to look at a string as a "struct". I don't think a > struct exists in python. Actually, is there something analogous to a record. > In the case of strings, suppose I have string that is composed of >

Re: [Tutor] Looking at a String as a Struct?

2008-09-11 Thread W W
On Thu, Sep 11, 2008 at 5:58 AM, Wayne Watson <[EMAIL PROTECTED]>wrote: > Is it possible in Python to look at a string as a "struct". I don't think > a struct exists in python. Actually, is there something analogous to a > record. In the case of strings, suppose I have string that is composed of

Re: [Tutor] Email and MIME

2008-09-11 Thread Kent Johnson
On Wed, Sep 10, 2008 at 10:30 PM, grishma govani <[EMAIL PROTECTED]> wrote: > Yes, I used the part of the code from the second link. > I am using the mailbox modules too. > > I have the e-mails from gmail in a file on my computer. I have used the code > below extract all the headers. As you can see

[Tutor] Looking at a String as a Struct?

2008-09-11 Thread Wayne Watson
Title: Signature.html Is it possible in Python to look at a string as a "struct". I don't think a struct exists in python. Actually, is there something analogous to a record. In the case of strings, suppose I have string that is composed of sub-strings like, first_name, last-name, date_of birth

Re: [Tutor] Inserting an Indent in IDLE?

2008-09-11 Thread Jaggo
In Pywin, and so I assume IDLE follows, you can just select more than One line and press tab. On Sun, Sep 7, 2008 at 5:41 PM, Alan Gauld <[EMAIL PROTECTED]>wrote: > > "Wayne Watson" <[EMAIL PROTECTED]> wrote > > Signature.htmlOccasionally I would like to indent 20-30 lines of code. >> I don't se

Re: [Tutor] NetBeans IDE

2008-09-11 Thread Gmail
Hi Mike, I use Eclipse for Java development with a very nice plugin for Python programming. Check out the PyDev plugin I think its for eclipse only - not sure if there's something for Netbeans. http://pydev.sourceforge.net/ -- Evans http://www.javawug.com - Original Message - From:

[Tutor] Extracting body of all email messages from an mbox file on computer

2008-09-11 Thread grishma govani
Yes, I used the part of the code from the second link. I am using the mailbox modules too. I have the e-mails from gmail in a file on my computer. I have used the code below extract all the headers. As you can see for now I am using text stored in document as my body. I just want to extract t