calling loaded DLL function expecting POINT * argument

2012-08-24 Thread Tim Williams
Hello all, I'm trying to use the ctypes module to call functions in a DLL. I've figured out how to modify my path so the library is found, and I can call LoadLibrary on it, but one of the functions expects an array of POINTS. Here is the prototype from the .h file: TRACKER_API HRESULT Initial

Re: calling loaded DLL function expecting POINT * argument

2012-09-04 Thread Tim Williams
On Sunday, August 26, 2012 9:23:49 PM UTC-4, Tim Roberts wrote: > Tim Williams wrote: > > > > >Hello all, > > > > > >I'm trying to use the ctypes module to call functions in a DLL. I've > > >figured out how to modify my path so the li

Re: calling loaded DLL function expecting POINT * argument

2012-09-04 Thread Tim Williams
On Tuesday, September 4, 2012 8:16:33 AM UTC-4, Tim Williams wrote: > On Sunday, August 26, 2012 9:23:49 PM UTC-4, Tim Roberts wrote: > > > Tim Williams wrote: > > > > > > > > > > > > >Hello all, > > > > > > > &g

Re: Accessing dll

2012-09-06 Thread Tim Williams
On Thursday, September 6, 2012 11:07:07 AM UTC-4, Helpful person wrote: > I am a complete novice to Python. I wish to access a dll that has > > been written to be compatible with C and VB6. I have been told that > > after running Python I should enter "from ctypes import *" which > > allows P

Re: Accessing dll

2012-09-06 Thread Tim Williams
On Thursday, September 6, 2012 4:21:56 PM UTC-4, Tim Williams wrote: > On Thursday, September 6, 2012 11:07:07 AM UTC-4, Helpful person wrote: > > > I am a complete novice to Python. I wish to access a dll that has > > > > > > been written to be compatible wit

Re: numpy array operation

2013-01-29 Thread Tim Williams
On Tuesday, January 29, 2013 3:41:54 AM UTC-5, C. Ng wrote: > Is there a numpy operation that does the following to the array? > > > > 1 2 ==> 4 3 > > 3 4 2 1 > > > > Thanks in advance. >>> import numpy as np >>> a=np.array([[1,2],[3,4]]) >>> a array([[1, 2], [3, 4]]) >>> np.

Re: Accessing the files by last modified time

2012-03-22 Thread Tim Williams
On Mar 22, 7:33 am, Sangeet wrote: > Hi > > I am new to the python programming language. > > I've been trying to write a script that would access the last modified file > in one of my directories. I'm using Win XP. > > I saw a similar topic, on the forum before, however the reply using > (os.pop

Re: problem loading matlab data with ompc and python

2012-05-24 Thread Tim Williams
On May 23, 5:10 pm, no1 wrote: > Hi, we're investigating transitioning our company from matlab to python. We > found OMPC as a MATLAB m-file-to Python translator, but we're encountering a > problem using the translated code to import MATLAB data structures into > Python. For example, when we sa

Re: matplot plot hangs

2017-11-02 Thread Tim Williams
On Wednesday, November 1, 2017 at 6:30:27 PM UTC-4, Andrew Z wrote: > nope. it doesnt: > > I added print-s after each line and that produced: > [az@hp src]$ cat ./main1.py > import matplotlib.pyplot as plt > print("imported") > plt.plot([1,2,4,1]) > print("plot is done") > plt.show() > print("show

Re: Problem with assignment. Python error or mine?

2017-12-22 Thread Tim Williams
On Thursday, December 21, 2017 at 12:18:11 PM UTC-5, MarkA wrote: > On Thu, 21 Dec 2017 07:05:33 -0800, rafaeltfreire wrote: > From docs.python.org: > > 8.10. copy — Shallow and deep copy operations > > Source code: Lib/copy.py > > Assignment statements in Python do not copy objects, they create

Re: Problem with assignment. Python error or mine?

2017-12-22 Thread Tim Williams
On Friday, December 22, 2017 at 8:41:29 AM UTC-5, Tim Williams wrote: > On Thursday, December 21, 2017 at 12:18:11 PM UTC-5, MarkA wrote: > > On Thu, 21 Dec 2017 07:05:33 -0800, rafaeltfreire wrote: > > From docs.python.org: > > > > 8.10. copy — Shallow and deep copy

Re: Is there a Python module to parse a date like the 'date' command in Linux?

2023-05-22 Thread Tim Williams
On Mon, May 22, 2023 at 12:41 PM Mats Wichmann wrote: > On 5/20/23 13:53, Chris Green wrote: > > I'm converting a bash script to python as it has become rather clumsy > > in bash. > > > > However I have hit a problem with converting dates, the bash script > > has:- > > > > dat=$(date --date

Re: How to store the result of df.count() as a new dataframe in Pandas?

2021-10-27 Thread Tim Williams
On Tue, Oct 26, 2021 at 6:36 PM Shaozhong SHI wrote: > Hello, > > The result of df.count() appears to be a series object. How to store the > result of df.count() as a new dataframe in Pandas? > > That is data anyhow. > > Regards, > > David > -- > https://mail.python.org/mailman/listinfo/python-l

Re: Is there a nice way to switch between 2 different packages providing the same APIs?

2018-07-05 Thread Tim Williams
On Thu, Jul 5, 2018 at 9:02 AM Mark Summerfield via Python-list < python-list@python.org> wrote: > For GUI programming I often use Python bindings for Qt. > > There are two competing bindings, PySide and PyQt. > > Ideally I like to have applications that can use either. This way, if I > get a prob

Re: conda/anaconda and pip3 (pip)

2018-12-09 Thread Tim Williams
On Saturday, December 8, 2018 at 10:13:14 PM UTC-5, Monte Milanuk wrote: > Did you find any solution(s)? I usually just lurk and read on this list. I don't reply since there's usually more competent people that regularly post helpful answers. (I lurk to learn from them!) If no one's replied yet

Re: Python Pandas split Date in day month year and hour

2020-08-19 Thread Tim Williams
etter place to ask a pandas question is StackOverflow. Here's a link that may answer your question. Convert timestamp to day, month, year and hour <https://stackoverflow.com/questions/57515291/convert-timestamp-to-day-month-year-and-hour> Tim Williams -- https://mail.python.org/mailman/listinfo/python-list

Re: ValueError: arrays must all be same length

2020-10-04 Thread Tim Williams
On Fri, Oct 2, 2020 at 11:00 AM Shaozhong SHI wrote: > Hello, > > I got a json response from an API and tried to use pandas to put data into > a dataframe. > > However, I kept getting this ValueError: arrays must all be same length. > > Can anyone help? > > The following is the json text. Regard

Re: ValueError: arrays must all be same length

2020-10-04 Thread Tim Williams
On Sun, Oct 4, 2020 at 8:39 AM Tim Williams wrote: > > > On Fri, Oct 2, 2020 at 11:00 AM Shaozhong SHI > wrote: > >> Hello, >> >> I got a json response from an API and tried to use pandas to put data into >> a dataframe. >> >> However, I ke

Re: ValueError: arrays must all be same length

2020-10-05 Thread Tim Williams
data is another table. > > Regards, > > Shao > > > I'm fairly new to pandas myself. Can't help there. You may want to post this on Stackoverflow, or look for a similar issue on github. https://stackoverflow.com/questions/tagged/pandas+json https://github.com/pandas-de

Sendmail with many attach and recipients

2005-02-03 Thread Tim Williams
do something finally 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: 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

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 thin

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 fin

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

Re: need to strip stuff off email

2005-06-22 Thread Tim Williams
- Original Message - From: "Tim Williams" <[EMAIL PROTECTED]> To: 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] >

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 = ["im

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

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

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 rena

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 worki

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 > >>> de

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] f

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 th

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 n

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 Ann

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. Pyth

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 = [('\\serverName\C:

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 t

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

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

2006-08-16 Thread Tim Williams
On 17/08/06, Tim Williams <[EMAIL PROTECTED]> wrote: > 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

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

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://mail.python.org/mailman/listinfo/python-list

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.qui

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

Re: Cannot import a module from a variable

2006-10-17 Thread Tim Williams
On 16/10/06, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Jia Lu wrote: > > Hi all: > > > > I try to do things below: > import sys > for i in sys.modules.keys(): > > import i > > Traceback (most recent call last): > > File "", line 2, in > > import i > > ImportError: No m

Re: help using smtplib to work ..

2006-11-08 Thread Tim Williams
On 8 Nov 2006 15:31:27 -0800, NicolasG <[EMAIL PROTECTED]> wrote: > > > > > > > Under outgoing mail smtp server, use smtp.gmail.com. Since it requires SMTP > > authorization, use your Gmail account as username (e.g. [EMAIL PROTECTED]) > > and > > your Gmail password as password. You can turn TSL

Re: Python to tell what is the IP of my PC .

2006-11-08 Thread Tim Williams
On 8 Nov 2006 15:35:31 -0800, NicolasG <[EMAIL PROTECTED]> wrote: > How can I use python to get the real IP address of my DSL router (when > my PC is part of the local home LAN) ? The router will the PC's default gateway IP address, if you are on a windows platform, you can view it by typing IPC

Re: Python to tell what is the IP of my PC .

2006-11-08 Thread Tim Williams
On 09/11/06, Nicolas G <[EMAIL PROTECTED]> wrote: > > > On 11/9/06, Tim Williams <[EMAIL PROTECTED]> wrote: > > On 8 Nov 2006 15:35:31 -0800, NicolasG <[EMAIL PROTECTED]> wrote: > > > How can I use python to get the real IP address of my DSL router (when

Re: help using smtplib to work ..

2006-11-08 Thread Tim Williams
On 09/11/06, Nicolas G <[EMAIL PROTECTED]> wrote: > > > > > > Usually when sending/relaying without authentication, the From is > > irrelevant, only the To is taken into account. Maybe, GMAIL do > > something different because they have to put the mail in the sender's > > mailbox as well as the r

Re: help using smtplib to work ..

2006-11-09 Thread Tim Williams
On 8 Nov 2006 19:45:00 -0800, Jordan <[EMAIL PROTECTED]> wrote: > For some reason, > smtp for gmail seems to require that you call server.ehlo() a second > time, after having called server.starttls(), otherwise, the server > won't accept authorization. Thanks. Not just GMAIL, all (RFC Complian

Re: extract text from a string

2006-11-09 Thread Tim Williams
On 9 Nov 2006 07:45:25 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I have a string containing: "+abc_cde.fgh_jkl\n" and what I need to > become is "abc_cde.fgh_jkl". Could anybody be so kind and write me a > code of how to extract this text from that string? > for that particular str

Re: Getting externally-facing IP address?

2006-11-10 Thread Tim Williams
On 10/11/06, Michael B. Trausch <[EMAIL PROTECTED]> wrote: Every programming example that I have seen thus far shows simple server code and how to bind to a socket--however, every example binds to the localhost address.  What I am wondering is this:  Is there a clean way to get the netw

Re: Getting externally-facing IP address?

2006-11-10 Thread Tim Williams
On 10/11/06, Tim Williams <[EMAIL PROTECTED]> wrote: > > > On 10/11/06, Michael B. Trausch <[EMAIL PROTECTED]> wrote: > > > > > > > > Every programming example that I have seen thus far shows simple server > code and how to bind to a socket--however

Re: string to list of numbers conversion

2006-11-10 Thread Tim Williams
On 5 Nov 2006 04:34:32 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > I have a string '((1,2), (3,4))' and I want to convert this into a > python tuple of numbers. But I do not want to use eval() because I do > not want to execute any code in that string and limit it to list of > num

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

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 whe

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 reque

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

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

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 t

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 ex

Re: Adding sender name to email

2006-09-01 Thread Tim Williams
On 01/09/06, Tim Williams <[EMAIL PROTECTED]> wrote: > 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: > > > add the line > > writer.addheader("From

Re: Test for number?

2006-09-04 Thread Tim Williams
On 04/09/06, Dr. Pastor <[EMAIL PROTECTED]> wrote: > In the following code I would like to ascertain > that x has/is a number. What the simplest TEST should be? > (Could not find good example yet.) > --- > x=raw_input('\nType a number from 1 to 20') > if TEST : > Do_A > else: >

Re: Removing from a List in Place

2006-09-05 Thread Tim Williams
On 05/09/06, Gregory Piñero <[EMAIL PROTECTED]> wrote:> I'm going to assume that it's supposed to work like this, but could > someone tell me the reasoning behind it? I.E. why is 3 skipped? > > >>> alist=[1,2,3] > >>> for item in alist: > print item > if item==2: >

Re: Removing from a List in Place

2006-09-05 Thread Tim Williams
On 05/09/06, Tim Williams <[EMAIL PROTECTED]> wrote: > On 05/09/06, Gregory Piñero <[EMAIL PROTECTED]> wrote:> I'm going > to assume that it's supposed to work like this, but could > > someone tell me the reasoning behind it? I.E. why is 3 skipped? > >

Re: Removing from a List in Place

2006-09-05 Thread Tim Williams
On 05/09/06, Gregory Piñero <[EMAIL PROTECTED]> wrote: > On 9/5/06, Tim Williams <[EMAIL PROTECTED]> wrote: > > > It does already, you just haven't grasped list fully yet :):) > > > > > > when you remove 2 from alist, the list becomes length 2, the

Re: Removing from a List in Place

2006-09-05 Thread Tim Williams
L.remove(value) -- remove first occurrence of value you were possibly thinking of alist.pop(2), which removes the item alist[2] from alist HTH :) -- Tim Williams -- http://mail.python.org/mailman/listinfo/python-list

Re: sending emails using python

2006-09-07 Thread Tim Williams
On 07/09/06, Sybren Stuvel <[EMAIL PROTECTED]> wrote: > sridhar enlightened us with: > > iam having user account on an exchangeserver. > > with that can i send an email using python? > > > > if iam using the following code iam getting error > > > > Traceback (most recent call last): > > File > >

Re: sending emails using python

2006-09-07 Thread Tim Williams
On 07/09/06, Sybren Stuvel <[EMAIL PROTECTED]> wrote: > Tim Williams enlightened us with: > > Can you send email via it using outlook express or a similar > > POP3/IMAP mail client? > > Wouldn't you use a SMTP client to send email? Outlook Express *is* a mail clien

Re: sending emails using python

2006-09-07 Thread Tim Williams
On 07/09/06, Hari Sekhon <[EMAIL PROTECTED]> wrote: > > Grant Edwards wrote: > On 2006-09-07, Sybren Stuvel > <[EMAIL PROTECTED]> wrote: > > > Tim Williams enlightened us with: > > > Can you send email via it using outlook express or a similar > P

Re: Using Beautiful Soup to entangle bookmarks.html

2006-09-07 Thread Tim Williams
On 7 Sep 2006 14:30:25 -0700, Adam Jones <[EMAIL PROTECTED]> wrote: > > Francach wrote: > > Hi, > > > > I'm trying to use the Beautiful Soup package to parse through the > > "bookmarks.html" file which Firefox exports all your bookmarks into. > > I've been struggling with the documentation trying t

Re: Extracting text from a string

2006-09-07 Thread Tim Williams
On 07/09/06, Anthra Norell <[EMAIL PROTECTED]> wrote: > s = ''' > $14.99 > , > $27.99 > , > $66.99 > , > $129.99 > , > $254.99 >''' > > >>> for line in [l.strip () for l in s.splitlines ()]: > if line [0] == '$': print line > > $14.99 > $27

Re: Extracting text from a string

2006-09-07 Thread Tim Williams
On 08/09/06, Tim Williams <[EMAIL PROTECTED]> wrote: > >>> print '\n'.join([i for i in s.splitlines() if i[0] == '$']) > $14.99 > $27.99 > $66.99 > $129.99 > $254.99 > or even more terse, >>> print '\n'.join([i for

Re: extracting substrings from a file

2006-09-11 Thread Tim Williams
On 11 Sep 2006 05:29:17 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > > I have a file with several entries in the form: > > AFFX-BioB-5_at E. coli /GEN=bioB /gb:J04423.1 NOTE=SIF > corresponding to nucleotides 2032-2305 of /gb:J04423.1 DEF=E.coli > 7,8-diamino-pelargonic acid (b

Re: best way of testing a program exists before using it?

2006-09-11 Thread Tim Williams
On 11/09/06, Hari Sekhon <[EMAIL PROTECTED]> wrote: > > Steve Holden wrote: > Hari Sekhon wrote: > > > The easiest way to test whether the command will run is to try and run > it. If the program doesn't exist then you'll get an exception, which you > can catch. Otherwise you'll be stuck with non

Re: best way of testing a program exists before using it?

2006-09-11 Thread Tim Williams
On 11/09/06, Hari Sekhon <[EMAIL PROTECTED]> wrote: > Tim Williams wrote: > > On 11/09/06, Hari Sekhon <[EMAIL PROTECTED]> wrote: > >> > >> Steve Holden wrote: > >> Hari Sekhon wrote: > >> > >> > >> The easiest way to

Re: sending emails using python

2006-09-14 Thread Tim Williams
On 14 Sep 2006 00:11:05 -0700, sridhar <[EMAIL PROTECTED]> wrote: > > Tim Williams wrote: > > Have you verified that you are allowed to use SMTP on this server ? > > Can you send email via it using outlook express or a similar POP3/IMAP > > mail client? > > &

Re: Limitate speed of a socket-based data transferring

2006-09-14 Thread Tim Williams
On 14/09/06, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > billie schrieb: > > Hi all. I'm writing a TCP-based application that I will use to trasfer > > binary files through the network. This piece of code represents how do > > I get a file from a remote peer and save it on my local hard drive: >

Re: something for itertools

2006-09-15 Thread Tim Williams
:5] (1, 2, 3, None, None) >>> pad_to = 5 >>> (a + pad_to*(None,))[:pad_to] (1, 2, 3, None, None) >>> (b + pad_to*(None,))[:pad_to] (10, 20, None, None, None) >>> (c + pad_to*(None,))[:pad_to] ('x', 'y', 'z', 'e', 'f') >>> -- Tim Williams -- http://mail.python.org/mailman/listinfo/python-list

Re: something for itertools

2006-09-15 Thread Tim Williams
On 15/09/06, Daniel Nogradi <[EMAIL PROTECTED]> wrote: > > or maybe a one liner :) > > > > >>> (a + 5*(None,))[:5] > > (1, 2, 3, None, None) > > > > Well, something like this is what I actually do. But for this first I > have to loop over all tuples and pick out the maximal length, so over > all

Re: mp3 libs and programs

2006-09-15 Thread Tim Williams
On 15 Sep 2006 18:16:41 -0700, Jay <[EMAIL PROTECTED]> wrote: > I'm writing a python script that involves playing mp3 files. The first > approach I had was sending commands to unix command-line programs in > order to play them. I tired mpg123 and moosic, but there was a key > feature to my progra

Re: Limitate speed of a socket-based data transferring

2006-09-17 Thread Tim Williams
On 15/09/06, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2006-09-15, Steve Holden <[EMAIL PROTECTED]> wrote: > > > > Of course this depends crucially on the window size. Since the > > addition of the window scaling TCP option it's been possible > > to specify very large windows, which are useful

Re: Don't use regular expressions to "validate" email addresses

2006-09-22 Thread Tim Williams
> > > Just as a matter of interest, are you expecting that you'll find out > about the undeliverable ones? Because in many cases nowadays you wont, > since so many domains are filtering out "undeliverable mail" messages as > an anti-spam defence. > ...and then there is the problem of validating th

Re: Verify an e-mail-adress - syntax and dns

2006-09-24 Thread Tim Williams
On 24/09/06, Ingo Linkweiler <[EMAIL PROTECTED]> wrote: > Has anyone a function/script to verify an e-mail-address? > > It should: > a) check the syntax > b) verify an existing mailserver or DNS/MX records > b) is problematical. A domain with MX records may not really have a mail server at all.

Re: concat next line with previous

2006-09-26 Thread Tim Williams
On 26 Sep 2006 03:16:25 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > hi > what is the python way to concat 2 lines eg > > line 1 with some text > line 2 with some text > > i want to bring line 2 up , such that i get one whole string. > > line 1 with some text line 2 with some text > als

Re: using the email module

2006-09-28 Thread Tim Williams
On 28/09/06, Erik Johnson wellkeeper dot <"com>"@bag.python.org> wrote: > #!/usr/bin/env python > > import smtplib > from email.MIMEText import MIMEText > from email.MIMEMultipart import MIMEMultipart > > > # GLOBAL DATA > #= > MAIL_SERVER = 'your_server.com' > MAIL_SUBJECT = "Python.

Re: Making sure script only runs once instance at a time.

2006-09-29 Thread Tim Williams
On 29/09/06, Matthew Warren <[EMAIL PROTECTED]> wrote: > I have > found that in real usage of other programs within the company that use > lockfiles, it sometimes causes a bit of troubleshooting time when it stops > working due to a stale lockfile.. This especially happens when the program > is ki

Re: Making sure script only runs once instance at a time.

2006-09-29 Thread Tim Williams
On 29/09/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Tim Williams wrote: > > > def check_lock(): > > import os, sys > > try: > > os.remove({filename}) > > except: > > if "Permission denied" in sys.exc_info()[

Re: Making sure script only runs once instance at a time.

2006-09-29 Thread Tim Williams
On 29/09/06, Sybren Stuvel <[EMAIL PROTECTED]> wrote: > Checking for a lock, and later acquiring the lock, seems non-atomic to > me. It's easier to simply create a lock directory. If it fails, the > dir already exists and someone else holds the lock. If it succeeds, > the lock is immediately yours,

Re: Making sure script only runs once instance at a time.

2006-09-29 Thread Tim Williams
On 29 Sep 2006 09:47:12 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > "Tim Williams" <[EMAIL PROTECTED]> writes: > > My reply was in response to a post that mentioned a known problem with > > this, what happens when the previously r

Re: Making sure script only runs once instance at a time.

2006-09-29 Thread Tim Williams
On 29 Sep 2006 10:04:15 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > "Tim Williams" <[EMAIL PROTECTED]> writes: > > That's the same kind of principle as my posted snippet, it doesn't > > rely on the file's presence or

Re: Making sure script only runs once instance at a time.

2006-09-29 Thread Tim Williams
On 29/09/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Tim Williams wrote: > > > So that I know my mistake, which bit fails (the text from > > sys.exc_info()[1]?? ) , or is it all complete rubbish - and not > > do-able - on a *nix system ? > > opening a file

Re: changing numbers to spellings

2006-10-01 Thread Tim Williams
On 1 Oct 2006 14:08:24 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I guess I'm just looking for a small code sample hooked up to the code > I gave, that would collect the input, compare it to code such as: > > if x==5 > print "Five" > elif x==6 > print "Six" > elif x==7 > p

Re: Looping over a list question

2006-10-03 Thread Tim Williams
On 3 Oct 2006 10:50:04 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I found myself writing: > > for f in [i for i in datafiles if '.txt' in i]: > print 'Processing datafile %s' % f > > but I was wishing that I could have instead written: > > for f in in datafiles if '.txt' in f: >

Re: "10, 20, 30" to [10, 20, 30]

2006-11-23 Thread Tim Williams
On 23 Nov 2006 03:13:10 -0800, Daniel Austria <[EMAIL PROTECTED]> wrote: > Sorry, > > how can i convert a string like "10, 20, 30" to a list [10, 20, 30] > > what i can do is: > > s = "10, 20, 30" > tmp = '[' + s + ']' > l = eval(tmp) > > but in my opinion this is not a nice solution > Not nice, e

Re: "10, 20, 30" to [10, 20, 30]

2006-11-23 Thread Tim Williams
On 23/11/06, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Thu, 23 Nov 2006 03:13:10 -0800, Daniel Austria wrote: > > > Sorry, > > > > how can i convert a string like "10, 20, 30" to a list [10, 20, 30] > > > > what i can do is: > > > > s = "10, 20, 30" > > tmp = '[' + s + ']' > > l = eval(tmp) >

Re: socket.error connection refused

2006-11-23 Thread Tim Williams
On 23 Nov 2006 04:09:18 -0800, Vania <[EMAIL PROTECTED]> wrote: > Hi, I'm not sure this is the proper forum but I try nevertheless. > The problem I'am facing is that the socket library always fail to > connect to an URL. The net effect is that I can not use setuptools. > I'm using Python2.4 on a wi

Re: "10, 20, 30" to [10, 20, 30]

2006-11-23 Thread Tim Williams
On 23/11/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Tim Williams wrote: > >>>> > > and the use of a list comprehension is pretty silly to, given that you want > to apply the same *function* to all items, and don't really need to look > it up

Re: parsing a dictionary from a string

2006-12-15 Thread Tim Williams
On 15/12/06, Benjamin Georgi <[EMAIL PROTECTED]> wrote: > Hello list, > > I could use some help extracting the keys/values of a list of > dictionaries from a string that is just the str() representation of the > list (the problem is related to some flat file format I'm using for file > IO). > > Exa

  1   2   3   >