Sendmail with many attach and recipients

2005-02-03 Thread Tim Williams
server.quit() except Exception, e: arq=open(dir_log,'a') print arq, Falha no envio da mensagem de email, não foi -- = Tim Williams -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie MySQLdb / MySQL version problem, I think

2004-11-29 Thread Tim Williams
Dave Merrill [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... Sorry for the newbness... Win2K, Python 2.3.3, MySQL 4.1.7. Downloaded and extracted MySQL-python-1.0.0.win32-py2.3.zip. Put the whole extracted directory into C:\Program Files\Python23\Lib\site-packages\ and renamed it

Re: SMTP help please

2005-06-07 Thread Tim Williams
- Original Message - From: Martin Franklin [EMAIL PROTECTED] server.sendmail(fromaddr, toaddrs, msg) You can use this if you don't need to worry about whether the email was successfully sent to all recipients. Otherwise, you need something like this (untested and partly copied from

Re: SMTP help please

2005-06-07 Thread Tim Williams
- Original Message - From: Tim Williams [EMAIL PROTECTED] try: s.close() except pass Typo!! That should be s.quit() not s.close() :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple SMTP server

2005-06-09 Thread Tim Williams
- Original Message - From: Jesse Noller [EMAIL PROTECTED] I am looking at implementing a simple SMTP server in python - I know about the smtpd module, but I am looking for code examples/snippets as the documentation is sparse. If anyone has any good examples/recipes I'd greatly

Re: help with sending mail in Program

2005-06-09 Thread Tim Williams
': sendToMe('test', 'test') It says it sends it but I get nothing in my inbox or anywhere! This is really frustrating me. _ [tim williams] No it definitely works, but Hotmail will blackhole your constructed email as it is obviously

Re: help with sending mail in Program

2005-06-09 Thread Tim Williams
it but I get nothing in my inbox or anywhere! This is really frustrating me. _ [tim williams] No it definitely works, but Hotmail will blackhole your constructed email as it is obviously fake. It has no headers, dates, msg-id

Re: smtpd module

2005-06-09 Thread Tim Williams
of minutes. If not post back and I'll knock something up :) - Original Message - From: Tim Williams [EMAIL PROTECTED] To: python-list@python.org Sent: Thursday, June 09, 2005 3:20 PM Subject: Re: Simple SMTP server - Original Message - From: Jesse Noller [EMAIL PROTECTED] I

SMTP Test Rig ( SMTPRIG.PY v1.0 )

2005-06-10 Thread Tim Williams
After a few posts recently, I have put together an SMTP test rig that will receive emails and either store them to a file, write them to a console, or both. Does anyone have any suggestions on where I can get it hosted as a utility for general public use? TIA Tim --

re: howto send html mails using smtplib

2005-06-10 Thread Tim Williams
:) -- = Tim Williams -- http://mail.python.org/mailman/listinfo/python-list

Re: help with sending mail in Program

2005-06-11 Thread Tim Williams
) s.sendmail(frm, to, msg) s.sendmail(frm, [to], msg) s.quit() if __name__ == '__main__': sendToMe('Testing', 'This is a test') From: Tim Williams [EMAIL PROTECTED] To: Ivan Shevanski [EMAIL PROTECTED] Subject: Re: help with sending mail in Program Date: Thu, 9

Re: help with sending mail in Program

2005-06-16 Thread Tim Williams
- Original Message - From: Ivan Shevanski [EMAIL PROTECTED] if __name__ == '__main__': body = 'x is',x,'y is',y,'.Lets hope that works!' subject = 'Neo' sendToMe(subject, body) I really have no idea whats going on. . .help? -Ivan Ivan, you need to pass the body as a

Python firewall control (Win32)

2005-06-16 Thread Tim Williams
Does anyone know of (personal/desktop) firewall that can be controlled via Python, or a Python Firewall package, or even something like DAXFi but not dormant ? The XP native firewall appears to have an API, but I'm not convinced I want to go that route unless it is relatively simple. Google

Re: Python firewall control (Win32)

2005-06-17 Thread Tim Williams
On Thu, 16 Jun 2005, Tim Williams wrote: Does anyone know of (personal/desktop) firewall that can be controlled via Python, or a Python Firewall package, or even something like DAXFi but not dormant ? http://wipfw.sourceforge.net/ import os def deny(src, dst, proto=all): cmd = ipfw add

Re: Python firewall control (Win32)

2005-06-17 Thread Tim Williams
- Original Message - From: Tom Anderson [EMAIL PROTECTED] AIUI, you won't be stopping and restarting ipfw - the ipfw command just modifies the ruleset being used by a continuously-running instance of the ipfw kernel module or daemon or whatever. How long it takes from starting

Re: smtplib and TLS

2005-06-18 Thread Tim Williams
- Original Message - From: Paul Rubin http://phr.cx@NOSPAM.invalid Matthias Kluwe [EMAIL PROTECTED] writes: Hmm. I tried server.sock.realsock.shutdown(2) before server.quit() with the result of I don't think that's exactly what you want. You need to send a specific TLS

Re: Loop until condition is true

2005-06-18 Thread Tim Williams
- Original Message - From: Remi Villatel [EMAIL PROTECTED] There is always a nice way to do things in Python but this time I can't find one. So far, all I got is: while True: some(code) if final_condition is True: break # # What I don't find so nice is to have to build an

Re: login website that using PHP

2005-06-20 Thread Tim Williams
- Original Message - From: frost [EMAIL PROTECTED] Hi, I am trying to login a website that using PHP and javascript. This is what happend if you browse that website using IE, after you login, you can go anywhere without enter your name and password again, as long as you keep that

Re: reading a list from a file

2005-06-20 Thread Tim Williams
- Original Message - From: David Bear [EMAIL PROTECTED] I have a file that contains lists -- python lists. sadly, these are not pickled. These are lists that were made using a simple print list statement. Is there an easy way to read this file into a list again? I'm thinking I

Re: smtplib and TLS

2005-06-21 Thread Tim Williams
- Original Message - From: Matthias Kluwe [EMAIL PROTECTED] Have you verified that its your end that is broken, not gmail's, do other servers give the same response ? No, I have not -- I should have, as I know now: Connecting, starttls, login and sending mail works fine without

Re: need to strip stuff off email

2005-06-22 Thread Tim Williams
nephish [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] hey there, i have a script that retrieves my email, but i need it to be able to strip all the stuff off except the body (the message itself) so i can later write it to a text file. anyone know how to accomplish this?

Re: need to strip stuff off email

2005-06-22 Thread Tim Williams
- Original Message - From: Tim Williams [EMAIL PROTECTED] To: python-list@python.org Sent: Wednesday, June 22, 2005 10:48 AM Subject: Re: need to strip stuff off email nephish [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] hey there, i have a script that retrieves

Re: Getting/Saving email attachments w/ poplib and email modules

2005-06-22 Thread Tim Williams
- Original Message - From: [EMAIL PROTECTED] Here's what I'm trying to do: I need to connect to a pop3 server, download all messages, and copy all of the attachments into a specific directory. The actual email message ## import email import poplib mimes =

Re: Loop until condition is true

2005-06-22 Thread Tim Williams
- Original Message - From: Greg Lindstrom [EMAIL PROTECTED] A bit off topic, but what does the expression Don't try to teach your grandfather how to suck eggs. mean? I've never heard it before and am curious to the story behind it. A relatively well know phrase, however as quoted

Re: Optimize a cache

2005-06-23 Thread Tim Williams
- Original Message - From: Florian Lindner [EMAIL PROTECTED] Hello, I am building a object cache in python, The cache has a maximum size and the items have expiration dates. At the moment I'm doing like that: What possible you see to optimize this lookup? Or anything else you see

smtplib STARTTLS problems

2005-04-12 Thread Tim Williams
I have a working SMTP client that I need to add TLS capability to,I absolutely need the client to timeout within a specified time, but when I use the sock.timeout() line it freezes the reading of chars from SSLFakeFile used during TLS instead of timing out the client connection.I am

Re: reg mail sending without smtp module

2005-05-11 Thread Tim Williams
- Original Message - From: John Abel [EMAIL PROTECTED] praba kar wrote: Dear All, Is it possible to send a message as a mail with out smtplib module? If you find out any module for mail sending(without smtplib) kindly mail me. regards Prabahar socket

Re: Regarding Mail sending smtplib Module

2005-05-11 Thread Tim Williams
praba kar [EMAIL PROTECTED] wrote: Here I want to avoid this line Received: from unknown (HELO prabahar.enmail.com) (59.92.13.47) by mailserver with SMTP; 11 May 2005 10:09:11 - How can I do this? . Why python give this line? . Mail sending Module in php will not give this type line.

Re: How return no return ?

2005-05-12 Thread Tim Williams
Ximo [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I want that the return sentence don't return anything, how can I do it?. If i do only return it returns None, and pass don't run too. Can anyone help me?, thanks. XIMO Just don't use a return statement at all, or do

Re: Copy List

2007-07-18 Thread Tim Williams
On 18/07/07, Robert Rawlins - Think Blue [EMAIL PROTECTED] wrote: What's the best way to create a copy of a list? I've seen several method and I'm not sure what to use. This will be in a class and one method creates a list which I then want to move to the self scope, like so: listB =

Re: Gmail Error using smtplib

2007-07-20 Thread Tim Williams
On 20/07/07, DJ Fadereu [EMAIL PROTECTED] wrote: Hello, can anyone help me with this? What am I doing wrong here? (I've changed private info to /xx) I'm getting an authentication error while using a standard script Gmail: --SCRIPT-

Re: From D

2007-07-26 Thread Tim Williams
but it doesn't if you use replace !! wink z = '123 456' int( z.replace( ' ' ,'' ) ) 123456 Propose: 123 456 789 = 123456789 123.456 789 = 123.456789 +1 for me too -- Tim Williams -- http://mail.python.org/mailman/listinfo/python-list

Re: beginner in python

2007-08-02 Thread Tim Williams
On 02/08/07, Beema shafreen [EMAIL PROTECTED] wrote: Hi everybody , I am a beginner in python, I have to fetch the redundant entries from a file, code: import re L = [] fh = open('ARCHITECTURE_MAIN.txt', 'r') for line in fh.readlines(): data =line.strip() #

Re: Problems with headers in email.message

2007-08-04 Thread Tim Williams
the capitalization), but that was all - originally it stopped the script dead, so it wasn't the cause of your problem. -- Tim Williams -- http://mail.python.org/mailman/listinfo/python-list

Re: clarification

2007-08-18 Thread Tim Williams
On 17/08/07, Beema shafreen [EMAIL PROTECTED] wrote: hi everybody, i have a file with data separated by tab mydata: fhl1fkh2 dfp1chk1 mal3alp14 mal3moe1 mal3spi1 mal3bub1 mal3bub3 mal3mph1 mal3mad3 hob1nak1 hob1wsp1 hob1rad3 cdr2

Re: smtplib problem, Unable to relay for

2007-12-21 Thread Tim Williams
On 21/12/2007, Benedict Verheyen [EMAIL PROTECTED] wrote: Hi, i get an Unable to relay for when trying to send an email from within my network to an email address not on my domain. I don't understand why it says relaying as i'm sending from an internal domain user to an external user. Email

Re: Finding Peoples' Names in Files

2007-10-11 Thread Tim Williams
On 11/10/2007, brad [EMAIL PROTECTED] wrote: Crazy question, but has anyone attempted this or seen Python code that does? For example, if a text file contained 'Guido' and or 'Robert' and or 'Susan', then we should return True, otherwise return False. --

Re: test if email

2007-10-12 Thread Tim Williams
valid. Invalid email doesn't always bounce, ( or the bounces may not always reach you ) :) -- Tim Williams -- http://mail.python.org/mailman/listinfo/python-list

Re: test if email

2007-10-12 Thread Tim Williams
On 12/10/2007, Florian Lindner [EMAIL PROTECTED] wrote: Hello, is there a function in the Python stdlib to test if a string is a valid email address? You mean a valid SMTP email address? In reality, there isn't a way of doing this. But a good rule of thumb is if it hasn't got at least one

Re: local variable referenced before assignment

2007-10-25 Thread Tim Williams
On 25/10/2007, A.T.Hofkamp [EMAIL PROTECTED] wrote: On 2007-10-25, Pete Bartonly [EMAIL PROTECTED] wrote: Also, brackets around conditions (in the if) are not needed, and comparing against None is usually done with 'is' or 'is not' instead of '==' or '!='. The result is then if logMsg is

Re: Pulling data from a .asps site

2007-11-27 Thread Tim Williams
On 27/11/2007, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: There's a government website which shows public data for banks. We'd like to pull the data down programmatically but the data is hidden behind .aspx... Is there anyway in Python to hook in directly to a browser (firefox or IE) to do

Re: find out all threads?

2007-05-12 Thread Tim Williams
On 11/05/07, Sven Rech [EMAIL PROTECTED] wrote: Hi, I have a written a C program which makes use of python embedding. I want to find out all threads that a loaded module has started. But I can't find anything about this in the docs. Is it possible? Without details of your module, its

Re: Automatic login to website (newbie)

2007-05-15 Thread Tim Williams
On 15 May 2007 06:38:45 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I'm trying to use PAMIE to login to a website: import cPAMIE # python.org - just a test, works fine ie = cPAMIE.PAMIE() website = http://www.python.org; ie.navigate(website) ie.textBoxSet('q', 'pamie')

Re: Printing dots in sequence ('...')

2007-05-22 Thread Tim Williams
in range(10): print '.\b', -- Tim Williams -- http://mail.python.org/mailman/listinfo/python-list

Re: smtp server simulation using Python

2007-06-18 Thread Tim Williams
On 17/06/07, William Gill [EMAIL PROTECTED] wrote: I have a (web) development computer w/o an SMTP server and want to test form generated e-mail using a dummy SMTP server that delivers the mail message to a file, or better yet, to a text editor instead of actually sending it. Is it possible

Re: avoid script running twice

2007-06-18 Thread Tim Williams
the script won't run, if the script finshes/crashes or the machine reboots the open file will close. In both cases if the script finishes normally or crashes, or the machine is restarted. The lock (ie socket or open file) is released. HTH :) -- Tim Williams -- http://mail.python.org/mailman

Re: avoid script running twice

2007-06-18 Thread Tim Williams
will still exist and future execution of the script will fail. :) -- Tim Williams -- http://mail.python.org/mailman/listinfo/python-list

Re: avoid script running twice

2007-06-18 Thread Tim Williams
On 18/06/07, Robin Becker [EMAIL PROTECTED] wrote: Wildemar Wildenburger wrote: Robin Becker wrote: . Well I can think of a dumb way: create a temporary file during the transaction and have your script check for that before running its main body. I think thats the most

Re: avoid script running twice

2007-06-18 Thread Tim Williams
On 18/06/07, Nick Craig-Wood [EMAIL PROTECTED] wrote: Tim Williams [EMAIL PROTECTED] wrote: You can also do this by holding a file open in write mode until the script has finished. try: open('lock.txt','w') my_script() except

Re: [*SPAM*] Python open proxy honeypot

2006-06-13 Thread Tim Williams
On 13/06/06, Alex Reinhart [EMAIL PROTECTED] wrote: Is running Python's built-in smtpd, pretending to accept and forward all messages, enough to get me noticed by a spammer, or do I have to do something else to advertise my script as an open proxy? This will get you noticed by crawlers that

Re: Search String for Word

2006-06-26 Thread Tim Williams
On 26 Jun 2006 08:24:54 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: And what if I want to search for an item in a tuple, is there a similarly easy method? Tim Chase wrote: What's the best way to search a string for a particular word and get a booleen value indicating whether it

Re: Looking for a high performance web server written in Python, and supports CGI/FastCGI

2006-07-07 Thread Tim Williams
On 07/07/06, Jack [EMAIL PROTECTED] wrote: I just did some testing between CherryPy's web server and lighttpd. My test was very simple and I used ab.exe for this purpose. CherryPy web server can serve about 140 simple request / second, while lighttpd can handle around 400 concurrent requests.

Re: Looking for a high performance web server written in Python, and supports CGI/FastCGI

2006-07-07 Thread Tim Williams
On 7 Jul 2006 06:27:43 -0700, Gerard Flanagan [EMAIL PROTECTED] wrote: Tim Williams wrote: On 07/07/06, Jack [EMAIL PROTECTED] wrote: I just did some testing between CherryPy's web server and lighttpd. My test was very simple and I used ab.exe for this purpose. CherryPy web server can

Re: Sending emails to 3 addresses....

2007-03-30 Thread Tim Williams
On 30/03/07, Boudreau, Emile [EMAIL PROTECTED] wrote: sendMail('this is the subject line', 'the results: 71 fails, 229 pass, 300 total.', '[EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]') def sendMail(subject, body, TO, FROM=[EMAIL PROTECTED]): print TO HOST =

Re: Sending emails to 3 addresses....

2007-03-30 Thread Tim Williams
On 30/03/07, Tim Williams [EMAIL PROTECTED] wrote: Emile, (slight change to my original reply) You are passing the TO addresses as 3 addresses in a single string. [TO] results in a list containing a single string - not a list containing 3 individual addresses. You need to either pass

Re: File deletion after 72 hours of creation

2007-03-30 Thread Tim Williams
On 29 Mar 2007 13:40:58 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Mar 29, 12:02 pm, [EMAIL PROTECTED] wrote: Alex I'm looking for a simple method to delete a folder after 72 Alex Business hours (saturday/sunday doesnt count) since its Alex creation. Note that This is

Re: Is any way to split zip archive to sections?

2007-03-31 Thread Tim Williams
On 30/03/07, Durumdara [EMAIL PROTECTED] wrote: Hi! I want to create some backup archives with python (I want to write a backup application in Python). Some package managers (7z, arj, winzip) can create splitted archives (1 mega, 650, 700 mega, etc). Because I want to ftp these results to

Re: Indentifying the LAST occurrence of an item in a list

2007-04-04 Thread Tim Williams
On 4 Apr 2007 08:58:49 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: For any list x, x.index(item) returns the index of the FIRST occurrence of the item in x. Is there a simple way to identify the LAST occurrence of an item in a list? My solution feels complex - reverse the list, look for

Re: way to extract only the message from pop3

2007-04-05 Thread Tim Williams
On 3 Apr 2007 12:36:10 -0700, flit [EMAIL PROTECTED] wrote: Hello All, Using poplib in python I can extract only the headers using the .top, there is a way to extract only the message text without the headers? for i in range( M.stat()[0] ): # M.stat returns msg-count and mbox size msg =

Re: way to extract only the message from pop3

2007-04-05 Thread Tim Williams
the retrieved message into a string. You can use \n but if you plan to push the text back out in an email '\r\n' is required for the SMTP sending part. Your client may or may not convert \n to \r\n at sending time :) HTH :) -- Tim Williams -- http://mail.python.org/mailman/listinfo/python-list

Re: way to extract only the message from pop3

2007-04-05 Thread Tim Williams
On 06/04/07, Tim Williams [EMAIL PROTECTED] wrote: Content: ['text/plain', 'text/html', 'message/delivery-status', 'text/plain', 'text/plain', 'text/plain', 'unknown', 'message/rfc822', 'text/plain', 'text/html'] I should explain that this was the content in a single email

Re: Can't Get Email Interface Working

2007-04-07 Thread Tim Williams
On 07/04/07, Eric Price [EMAIL PROTECTED] wrote: Good grief! And they call a 722-line program simple?! LOL! I did what I need to do with a __one_line_shell_script__ LOL! Naw, if I have to go through all that, I'll skip on python this time around, thank you very much! Eric Yup, its not so

Re: How to check if a string is empty in python?

2007-05-04 Thread Tim Williams
On 4 May 2007 03:02:37 -0700, Jaswant [EMAIL PROTECTED] wrote: This is a simple way to do it i think s=hello if(len(s)==0): print Empty else: print s hello Not as simple asIf not s: and nowhere near as simple asprint s or 'Empty' :) :) s =

Re: text representation of HTML

2006-07-20 Thread Tim Williams
On 20 Jul 2006 15:12:27 GMT, Duncan Booth [EMAIL PROTECTED] wrote: Ksenia Marasanova wrote: i want to send plain text alternative of html email, and would prefer to do it automatically from HTML source. Any hints? Use htmllib: import htmllib, formatter, StringIO def cleanup(s):

Re: format a number for output

2006-08-07 Thread Tim Williams
On 7 Aug 2006 07:55:11 -0700, abcd [EMAIL PROTECTED] wrote: if i have a number, say the size of a file, is there an easy way to output it so that it includes commas? for example: 1890284 would be: 1,890,284 I was bored !! a = 1890284 ','.join([str(a)[::-1][x:x+3] for x in

Re: Getting previous file name

2006-08-07 Thread Tim Williams
On 7 Aug 2006 13:52:16 -0700, Hitesh [EMAIL PROTECTED] wrote: I have a small script here that goes to inside dir and sorts the file by create date. I can return the create date but I don't know how to find the name of that file... I need file that is not latest but was created before the last

Re: timeout calling local sendmail

2006-08-09 Thread Tim Williams
On 9 Aug 2006 08:22:03 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: that's timeout calling local sendmail not timeout calling local se [EMAIL PROTECTED] wrote: (Environment: RedHat Linux recent, Python 2.3.5) We have a batch processing script that on occasion needs to send out

Re: Read a file with open command

2006-08-11 Thread Tim Williams
On 11 Aug 2006 09:39:23 -0700, jean-jeanot [EMAIL PROTECTED] wrote: Anyway many thanks.Here is the program: file_obj= open (D:/Mes documents/ADB Anna.ods,'r') s = file_obj s.readlines() Please remember not to top-post :) Try this s = open (D:/Mes documents/ADB Anna.ods,'r')

Re: Nested if and expected an indent block

2006-08-13 Thread Tim Williams
On 13 Aug 2006 16:28:45 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Greetings: I'm brand new to Python and decided to write a syllogism solver for a class I'm taking. At the start of the program, I define a function that classifies the type of each statement in the syllogism. Python

Re: Beginner Textbook

2006-08-15 Thread Tim Williams
On 15/08/06, M_M [EMAIL PROTECTED] wrote: Hi, I am looking for a simple text book to introduce 13 to 18 year olds to python programming. Suggestion? You might consider Learn to programme using Python by Alan Gauld as a means to introduce both programming and python at the same time.

Re: Adding a char inside path string

2006-08-16 Thread Tim Williams
On 16/08/06, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On 16 Aug 2006 09:00:57 -0700, Hitesh [EMAIL PROTECTED] declaimed the following in comp.lang.python: Thank you Fredrik. That works for a string. But I am getting list of tuples from DB. rows =

Re: Adding a char inside path string

2006-08-16 Thread Tim Williams
On 16 Aug 2006 10:30:26 -0700, Hitesh [EMAIL PROTECTED] wrote: Thank you all it worked!. Tim, modRows = ['\\'+itm[0].replace(:, $) for itm in rows] What are those two forward slashes for? Hi Hitesh, \ is an escape character, it can give unexpected results depending on the character

Re: Anyone have a link handy to an RFC 821 compliant email address regex for Python?

2006-08-16 Thread Tim Williams
On 16 Aug 2006 15:23:06 -0700, fuzzylollipop [EMAIL PROTECTED] wrote: I want to do email address format validations, without turning to ANTLR or pyparsing, anyone know of a regex that is COMPLIANT with RFC 821. Most of the ones I have found from google searches are not really as robust as I

Re: Adding a char inside path string

2006-08-17 Thread Tim Williams
On 17/08/06, Sybren Stuvel [EMAIL PROTECTED] wrote: Dennis Lee Bieber enlightened us with: What happens when you get a pathname that looks like: \\who\cares\common.exe\program.exe Is that possible on Windows? At one point, I named a directory www.something.com and then it wouldn't

Re: Unclear on argument passing to sendmail'

2006-08-21 Thread Tim Williams
print x[0], x[1] server.quit() break except: #can't connect so continue to next MX server - don't fail !!! e_error = str(sys.exc_info()[0]) print e_error server.quit() continue for recip in failed: # some failed, some didn't print recip -- Tim Williams -- http

Re: Unclear on argument passing to sendmail'

2006-08-21 Thread Tim Williams
On 21/08/06, Tim Williams [EMAIL PROTECTED] wrote: On 21/08/06, John Draper [EMAIL PROTECTED] wrote: Sorry, there's an indentation error here except smtplib.SMTPRecipientsRefused, x : #all recips failed for recip in x.recipients: print recip server.quit() break

Re: Unclear on argument passing to sendmail'

2006-08-22 Thread Tim Williams
On 22/08/06, Tim Roberts [EMAIL PROTECTED] wrote: John Draper [EMAIL PROTECTED] wrote: Hi Tim :) Tim William's answer is not exactly correct. The host you specify in the smtplib.SMTP constructor should NOT be the MX record for any of the recipients. You should never have to look up MX

Re: Python web service ...

2006-08-26 Thread Tim Williams
At this time right now I prefer to do something that works the quickest possible... I never had any experience with CGI, do I need to set up a web server for that ? can you point me some usefull reading material so I can get a start ? I will post for a comment at Zope , I had installed once

Re: reading a line in file

2007-08-20 Thread Tim Williams
On 20/08/07, Brian McCann [EMAIL PROTECTED] wrote: Hi, I can read in the whole file build.number which has the following lines how do I just capture the value of build.number and assign it to a variable Thanks, Brian contents of file build.number: #Build Number for ANT. Do not edit!

Re: reading a line in file

2007-08-20 Thread Tim Williams
On 20/08/07, Brian McCann [EMAIL PROTECTED] wrote: From: [EMAIL PROTECTED] on behalf of Tim Williams Sent: Mon 8/20/2007 2:59 PM To: Brian McCann Cc: python-list@python.org Subject: Re: reading a line in file On 20/08/07, Brian McCann [EMAIL PROTECTED

Re: reading a line in file

2007-08-20 Thread Tim Williams
On 20/08/07, Shawn Milochik [EMAIL PROTECTED] wrote: Hopefully this will help (using your input file) #!/usr/bin/env python import re buildinfo = input.txt input = open(buildinfo, 'r') regex = re.compile(r^\s*build.number=(\d+)\s*$) for line in input: if re.search(regex, line):

Re: reading a line in file

2007-08-20 Thread Tim Williams
On 20/08/07, Brian McCann [EMAIL PROTECTED] wrote: Shawn, Tim ,Jay many thanks, It looks like there are many ways this problem can be approached either by using regex or a tokens Tim I'm not familiar with your solution, but will learn about that method also Hi Brian, buildNum =

Re: Using Regular Expresions to change .htm to .php in files

2007-08-23 Thread Tim Williams
On 23/08/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I have a bunch of files that have changed from standard htm files to php files but all the links inside the site are now broken because they point to the .htm files while they are now .php files. Does anyone have an idea about how

Re: Using Regular Expresions to change .htm to .php in files

2007-08-23 Thread Tim Williams
On 23/08/07, Tim Williams [EMAIL PROTECTED] wrote: On 23/08/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I have a bunch of files that have changed from standard htm files to php files but all the links inside the site are now broken because they point to the .htm files while

Re: Using Regular Expresions to change .htm to .php in files

2007-08-24 Thread Tim Williams
On 24/08/07, J. Cliff Dyer [EMAIL PROTECTED] wrote: Tim Williams wrote: On 23/08/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I have a bunch of files that have changed from standard htm files to php files but all the links inside the site are now broken because they point

Re: Image.open( C:\test.jpg) is this wrong ?

2007-08-27 Thread Tim Williams
On 27/08/07, Simon Brunning [EMAIL PROTECTED] wrote: On 8/27/07, Carnell, James E [EMAIL PROTECTED] wrote: Image.open(C:\test.jpg) Try: Image.open(rC:\test.jpg) See http://docs.python.org/ref/strings.html rC:\test.jpg also C:\\test.jpg or 'C:/test.jpg' --

Re: startswith( prefix[, start[, end]]) Query

2007-09-06 Thread Tim Williams
On 06/09/07, Bruno Desthuilliers [EMAIL PROTECTED] wrote: You may want to try with a regexp, but I'm not sure it's worth it (hint: the timeit module is great for quick small benchmarks). Else, you could as well write your own testing function: def str_starts_with(astring, *prefixes):

Re: why should I learn python

2007-09-07 Thread Tim Williams
On 07/09/07, Tom Brown [EMAIL PROTECTED] wrote: On Thursday 06 September 2007 16:01, windandwaves wrote: Hmmm, thank you all for your replies. I will do some research on the net (i did some already, but because I am really not much of a programmer, it is often too detailed for me). I have

Re: extract text from log file using re

2007-09-13 Thread Tim Williams
On 13/09/2007, Fabian Braennstroem [EMAIL PROTECTED] wrote: me again... I should describe it better: the result should be an array with just: 498 1.0086e-03 2.4608e-04 9.8589e-05 1.4908e-04 8.3956e-04 3.8560e-03 4.8384e-02 11:40:01 499 499 1.0086e-03 2.4608e-04 9.8589e-05 1.4908e-04

Re: smtp debugging methods

2007-09-14 Thread Tim Williams
On 14/09/2007, Sean Nakasone [EMAIL PROTECTED] wrote: I'm having trouble with sending smtp mail. It's hanging after the smtplib.SMTP() line. It doesn't works from home but not from work. What's the best way to debug this? # Here's my script import smtplib msg = Subject: Hello\n\nThis is

Re: trim start and trailing space chars from string

2007-09-15 Thread Tim Williams
On 15/09/2007, Konstantinos Pachopoulos [EMAIL PROTECTED] wrote: Hi, is there something corresponding to the java String.trim() method, ie trim start and trailing space/tab chars from string? say convert asdf to asdf? ' asdf '.strip() 'asdf' ' asdf '.rstrip() ' asdf' ' asdf '.lstrip()

Re: I could use some help making this Python code run faster using only Python code.

2007-09-20 Thread Tim Williams
On 21/09/2007, Tim Williams [EMAIL PROTECTED] wrote: On 20/09/2007, Python Maniac [EMAIL PROTECTED] wrote: I am new to Python however I would like some feedback from those who know more about Python than I do at this time. def scrambleLine(line): s = '' for c in line: s

Re: I could use some help making this Python code run faster using only Python code.

2007-09-20 Thread Tim Williams
On 20/09/2007, Python Maniac [EMAIL PROTECTED] wrote: I am new to Python however I would like some feedback from those who know more about Python than I do at this time. def scrambleLine(line): s = '' for c in line: s += chr(ord(c) | 0x80) return s def

Re: recipient validation with smtplib

2007-09-28 Thread Tim Williams
On 28/09/2007, Robin Becker [EMAIL PROTECTED] wrote: Tim Williams wrote: On 28/09/2007, Robin Becker [EMAIL PROTECTED] wrote: Is there a way to use smtplib to get recipient validation. I can use smtplib quite happily to send emails using the locahost's sendmail, but sendmail is just

Re: recipient validation with smtplib

2007-09-28 Thread Tim Williams
On 28/09/2007, Robin Becker [EMAIL PROTECTED] wrote: Is there a way to use smtplib to get recipient validation. I can use smtplib quite happily to send emails using the locahost's sendmail, but sendmail is just fire and forget, so some bad addresses eg [EMAIL PROTECTED] don't cause any

Re: List search

2007-09-28 Thread Tim Williams
one 'x11' in the list you could also consider print mylist.index('x11') and print mylist[mylist.index('x11')] Also, before iterating the whole list check that 'x11' exists if 'x11' in mylist: do stuff and list comprehesions print [x for x in mylist if x == 'x11'] HTH :) Tim Williams

Re: Putting a line from a text file into a variable, then moving to next line

2007-10-07 Thread Tim Williams
On 07/10/2007, Tim Chase [EMAIL PROTECTED] wrote: I'm not really sure how readline() works. Is there a way to iterate through a file with multiple lines and then putting each line in a variable in a loop? You can use readlines() to get the whole line (including the newline): lines =

Re: Editing particular lines of a text file.

2007-10-09 Thread Tim Williams
') new_file = [] for line in infile: if 'msgid' in line: # transform line # make sure the line ending is intact new_file.append(line) outfile.write(''.join(new_file) infile.close() outfile.close() -- Tim Williams -- http://mail.python.org/mailman/listinfo/python

Re: block a network port

2006-08-30 Thread Tim Williams
On 29 Aug 2006 20:43:49 -0700, alex23 [EMAIL PROTECTED] wrote: abcd wrote: ok, no of any python solutions? or command-line firewalls? You did try searching Google for python firewall, right? http://www.google.com.au/search?q=python+firewall The very first entry is a pointer to a solution

Re: Adding sender name to email

2006-09-01 Thread Tim Williams
On 1 Sep 2006 03:26:12 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: How do I add a Sender name to the emails sent by the following script: writer = MimeWriter.MimeWriter(out) # set up some basic headers... we put subject here # because smtplib.sendmail expects

  1   2   3   >