Re: Finding user's home dir

2005-02-02 Thread Timothy Grant
On Wed, 02 Feb 2005 11:30:34 -0800 (PST), Nemesis <[EMAIL PROTECTED]> wrote: > Hi all, I'm trying to write a multiplatform function that tries to > return the actual user home directory. I saw that > os.path.expanduser("~") works on Linux but on Windows2000 (at least on > the win I used) it returns

Python-libnjb on macosx

2005-02-10 Thread Timothy Grant
I was working on some things that use Glenn Strong's excellent libnjb wrapper on my Linux box. I have since bought a PowerBook and have been trying to get everything working correctly under OS/X. This morning I got Python-libnjb to build without errors using the following command: ld -dynamic -dy

More newbie macosx user questions

2005-02-24 Thread Timothy Grant
I think I'm mis-understanding something about how PYTHONPATH works (at least on OSX I didn't have this trouble on Linux). I have a directory where I store libraries that I'm playing around with. However, for some reason python can't find the library. Since I'm using PyQt, I use pythonw, but the re

Re: How to script DOS app that doesn't use stdout

2005-03-08 Thread Timothy Grant
On Sun, 06 Mar 2005 13:41:57 GMT, Gregor <[EMAIL PROTECTED]> wrote: > There's a DOS console application I am trying to script (in Python), but it > doesn't seem to use stdout or stderr... For example, if I redirect output > to a file ("cmd > file.txt"), the output still appears on screen. > Similar

Re: Regular Expression

2004-12-14 Thread Timothy Grant
On Tue, 14 Dec 2004 23:16:43 -0700, Michael McGarry <[EMAIL PROTECTED]> wrote: > Hi, > > I am horrible with Regular Expressions, can anyone recommend a book on it? > > Also I am trying to parse the following string to extract the number > after load average. > > " load average: 0.04, 0.02, 0

Re: A little request about spam

2005-04-14 Thread Timothy Grant
On 4/14/05, mark hellewell <[EMAIL PROTECTED]> wrote: > On 4/14/05, BJörn Lindqvist <[EMAIL PROTECTED]> wrote: > > Please do not reply to spam. Replying to spam makes it much harder for > > spam filters to catch all the spam or will produce very many false > > positives. Atleast that's how gmail's

Re: Newbie question - leading zeros

2006-10-13 Thread Timothy Grant
On 10/13/06, eldorado <[EMAIL PROTECTED]> wrote: > I have looked around and cannot seem to find a way to strip leading zeros > off of values in a dictionary. Basically, I am looking to do a for loop > and any value that has one or more leading zeros would be stripped. Any > pointers would be apprec

Re: Best Python Editor

2006-05-31 Thread Timothy Grant
On 5/31/06, Manoj Kumar P <[EMAIL PROTECTED]> wrote: > > Hi, > > Can anyone tell me a good python editor/IDE? > It would be great if you can provide the download link also. > > Thank You, > -Manoj- > > > "SASKEN RATED Among THE Top 3 BEST COMPANIES TO WORK FOR IN INDIA - SURVEY > 2005 conducted by

Re: what are you using python language for?

2006-06-06 Thread Timothy Grant
On 6/4/06, hacker1017 <[EMAIL PROTECTED]> wrote: > im just asking out of curiosity. My current gig is perl only, but I still use python for personal stuff 1) +Twisted for a couple of IRC Bots 2) an interface between TextMate and py.test 3) a soccer management game (wxPython + PyGame) -- Stand

ANN: DMetaph.py An implementation of the Double Metaphone algorithm

2006-08-25 Thread Timothy Grant
Hello everyone, I recently had a need to do some work with fuzzy matches, so I ported Lawrence Philips DMetaph class from C++ to Python. This is currently pretty much a line for line port of his his C++ code. It is not very pythonic at all. Because it is SO ugly, I'm not yet making it available

Re: Re: Leave the putdowns in the Perl community, the Python world does not need them

2006-09-25 Thread Timothy Grant
On 25 Sep 2006 07:35:45 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Metaperl, > > Steve makes a good point. Fredrik is one of the most important > contributors of Python code, tools, etc and as far as I am concerned, > that is so important that it gives him the right to be cranky from tie

Re: Re: Good script editor for Python on Mac OS 10.3

2006-11-29 Thread Timothy Grant
On 11/29/06, Lou Pecora <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > "Scott_Davies" <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > I have an old Mac with OS X Panther installed. I also have the Python > > language download file, but I haven't got a text/script editor to use > > fo

py.test munging strings in asserts?

2006-04-20 Thread Timothy Grant
I'm playing around with py.test and writing a parser for it's output for use in TextMate. I've run into what appears to be a strange phenomenon, but which is likely me doing something wrong. I'm writing a test to test some HTML output and the test fails for several reasons, all of which I underst

Re: Test professionalism (was: count items in generator)

2006-05-15 Thread Timothy Grant
On 5/15/06, Cameron Laird <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Delaney, Timothy (Tim) <[EMAIL PROTECTED]> wrote: > . > . > . > >That's exactly my point. Assuming your test coverage is good, such an > >

Re: how to set the time of a directory?

2008-10-10 Thread Timothy Grant
ath, (atime, mtime)) utime(path, None) Set the access and modified time of the file to the given values. If the second form is used, set the access and modified times to the current time. >>> os.utime('test', None) >>> ^D ([EMAIL PROTECTED]) ls

Re: Selecting random elements from a list.

2008-10-13 Thread Timothy Grant
gt; > -- > http://mail.python.org/mailman/listinfo/python-list > > I would start here http://docs.python.org/library/random.html you are likely interested in choice or sample. -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: chomp?

2008-10-17 Thread Timothy Grant
, right or wrong,' is a thing that no patriot would think of > saying. It is like saying, 'My mother, drunk or sober.'" > > -- G.K. Chesterton > -- > http://mail.python.org/mailman/listinfo/python-list > a ',' on the end of your print should suppress the newline. >>> def x(): ...print 'foo', ...print 'bar' ... >>> x() foo bar -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: best python unit testing framwork

2008-11-12 Thread Timothy Grant
tarted using py.test. I even wrote a plugin for TextMate to interface with py.test. If I had known about Nose I would likely have used it instead because it is built on top of the standard module. Now I have many thousands of lines of py.test code so am not likely to make the change. -- Stand Fa

Re: best python unit testing framwork

2008-11-12 Thread Timothy Grant
On Wed, Nov 12, 2008 at 5:16 PM, Roy Smith <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > "Timothy Grant" <[EMAIL PROTECTED]> wrote: > >> I wanted to like unittest but couldn't. So I started using py.test. I >> even wrote a p

Re: Q re documentation Python style

2008-06-08 Thread Timothy Grant
On Sun, Jun 8, 2008 at 2:17 PM, kj <[EMAIL PROTECTED]> wrote: > > > I'm a Perlhead trying to learn the Way of Python. I like Python > overall, but every once in a while I find myself trying to figure > out why Python does some things the way it does. At the moment > I'm scratching my head over P

Re: Write to file and see content on screen

2008-06-09 Thread Timothy Grant
On Mon, Jun 9, 2008 at 6:01 PM, <[EMAIL PROTECTED]> wrote: > Hello all, > > New user to python. I can write to a file, however, I would like to > do both...whatever I do on the screen, I'd like to write it to a file. > > any pointers on where I can find this info. > > thanks, > This code has on

Re: Creating a TCP/IP connection on already-networked computers

2008-06-14 Thread Timothy Grant
On Sat, Jun 14, 2008 at 11:54 AM, John Salerno <[EMAIL PROTECTED]> wrote: > John Salerno wrote: > > - >> #!/usr/bin/env python >> >> from socket import * >> from time import ctime >> >> HOST = '192.168.1.100' >> > > > - >> #!/usr/bin/env python >> >> from socket import * >> >> HOST = '19

Re: One step up from str.split()

2008-07-14 Thread Timothy Grant
ional feature > (keeping quoted names as a single entry) rather than going to a full-blown > command-line argument parsing tool? Even regular expressions seem like > they'd > probably be overkill here? Or no? > > Thanks, > ---Joel I've found that anytime I have m

Re: Testing for connection to a website

2008-07-15 Thread Timothy Grant
.html > Sent from the Python - python-list mailing list archive at Nabble.com. > > -- > http://mail.python.org/mailman/listinfo/python-list > I'm glad to see you found the old post and implemented the code suggested there. -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: Change PC to Win or Windows

2008-07-18 Thread Timothy Grant
stinfo/python-list > Thank you for introducing me to a fabulous new word. Had to look it up, but I like it. -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: Function editing with Vim throws IndentError

2008-07-22 Thread Timothy Grant
> > The scripts I load are: qbuf, TagList, indent/python.vim and a reduced > version of the standard python.vim > > Could someone provide some pointers? > > Thanks, > > Pablo Torres N. > -- > http://mail.python.org/mailman/listinfo/python-list > Are you editing someone e

Re: How do I compare files?

2008-07-22 Thread Timothy Grant
> > -- Ratfink > > -- > http://mail.python.org/mailman/listinfo/python-list > I'd start with file sizes. If that's not enough you might look at the md5 library and check the md5 values for the files. -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: Function editing with Vim throws IndentError

2008-07-24 Thread Timothy Grant
ally been 8 spaces. Most terminals, printers and other devices understand the tab as 8 characters. Smart editors have made it easy to make tabs APPEAR as four spaces, but they are almost universally interpreted elsewhere as 8 characters. http://en.wikipedia.org/wiki/Tab_key -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: POP3 - Using poplib only shows the first few hundred messages in the mailbox

2008-07-25 Thread Timothy Grant
Wise popper where I work only allows access to the first 100 messages. To access the next 100 you have to retrieve the first 100. My guess is that gmail is doing something similar. If you retrieve the first 400, do you get a new list the next time? -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: Teething troubles with Python on a Mac

2008-08-03 Thread Timothy Grant
he two separate installations. OSX relies on the version of python they ship. While there are likely cases where it could be replaced completely safely the risks of having to re-install your OS at some point because it has the wrong version of python are not worth it. -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: Teething troubles with Python on a Mac

2008-08-03 Thread Timothy Grant
d and went from there. I honestly don't think it is a cause for concern though. The situation is very similar to on Linux (Red Hat has their version of python) you simply install what you want and use it. -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: [unittest] Run setUp only once

2008-08-04 Thread Timothy Grant
of_unit_testing_frameworks#Python > > /Jorgen > > -- > // Jorgen Grahn \X/ snipabacken.se> R'lyeh wgah'nagl fhtagn! > -- > http://mail.python.org/mailman/listinfo/python-list > py.test supports setup/teardown_module, setup/teardown_class and setup_teardown_method. I've never needed to use the first, the second comes in very handy especially when writing acceptance tests. -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie Python questions

2008-08-04 Thread Timothy Grant
ges. It doesn't sound like the > APIs are going to be too tough to grasp. And yes, I've about 10 years > work in Windows using an event-driven model (LabWindows). > -- > http://mail.python.org/mailman/listinfo/python-list > Make sure to subscribe to the wxPython list the people there have helped me immensely in the past. -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: Why doesn't import work?

2008-08-04 Thread Timothy Grant
them python-files. > > how would I import them? > -- > http://mail.python.org/mailman/listinfo/python-list > set your PYTHONPATH environment to include the directory where your module is. -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: Module re, extract on string match

2008-08-04 Thread Timothy Grant
tion. >>> import re >>> s = '/Users/sriram/folder1/folder2/folder3/folder4/folder5/file' >>> y = re.search('folder3.*', s) >>> y.group() 'folder3/folder4/folder5/file' >>> -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: Print statement isn't showing up?

2008-08-05 Thread Timothy Grant
ment before these are executed, but I do not. > Instead it shows up *after* the last 2 lines of code have completed. Is > there something broken about this? My guess is that the output is getting buffered and the buffer doesn't get flushed until sometime after the function executes. -

Re: Finding IP address of localhost via socket API (or other API)

2008-08-05 Thread Timothy Grant
68.x.x number. However, I know that that is not the IP that the world sees when my packets finally leave the building. What if your machine has multiple interface cards in it? What are you trying to accomplish? -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding IP address of localhost via socket API (or other API)

2008-08-05 Thread Timothy Grant
On Tue, Aug 5, 2008 at 4:39 PM, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > Sorry for replying to the replier (Timothy) instead of the OP (David), > but the original post seems to have been eaten by my ISP. > > On Tue, 05 Aug 2008 15:48:26 -0700, Timothy Grant wrote: > &

Re: Access individual fields in csv using python

2008-08-07 Thread Timothy Grant
-list > I'd likely use the csv module. http://docs.python.org/lib/module-csv.html -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython pop--up ("could not retrieve information...")

2008-08-07 Thread Timothy Grant
listview object? > > Thanks in advance, > sulu I haven't done any threaded apps, but my understanding is that the you should not manipulate the GUI outside of the main application thread. -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: A question about string and float number

2008-08-07 Thread Timothy Grant
ar from the original message. >>> >>> >>> Wei Guo wrote: >>>> >>>> #this is a better way of testing a string for float >>>> def isFloat(s): >>>>try: >>>>s = float(s) >>>>except: >>>>return False >>>>return True >>> >>> >>> -- >>> http://mail.python.org/mailman/listinfo/python-list >> > > > -- > http://mail.python.org/mailman/listinfo/python-list > -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: some kind of trace facility ?

2008-08-09 Thread Timothy Grant
estigate a logging decorator. Python's Decorator module has a decorator factory that should allow you to log at least the calls. I'm not sure it would help you much with the time the method took, but I could very well be wrong about that. -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: Python for Blackberry mobile phones

2008-08-11 Thread Timothy Grant
B's run Java, so there *may* be some chance that it might be possible to get Jython running on it. -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: Wildcards for regexps?

2008-08-11 Thread Timothy Grant
needed something like this so did a straight port of the double-metaphone code to python. It's horrible, it's ugly, it's non-pythonic in ways that make me cringe, it has no unit tests, but it does work. -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: dynamically creating html code with python...

2008-08-11 Thread Timothy Grant
b/module-StringIO.html >> File objects - http://docs.python.org/lib/bltin-file-objects.html >> >> -- >> Jerry It looks to me like you are opening the url, but never retrieving the content of the url. I think you may have better luck with urllib2 which has a read() method. http://docs.python.org/lib/urllib2-examples.html -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: for x,y in word1, word2 ?

2008-08-11 Thread Timothy Grant
do the same here. I have a horribly ugly version of the double-metaphone algorithm in python that does work, and may be of some use in solving this problem. -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: for x,y in word1, word2 ?

2008-08-11 Thread Timothy Grant
tion. I have a fairly elegant version of the > original > metaphone algorithm I wrote myself (in PERL, many years ago) but I've > never found > the time to reverse-engineer the original C++ code for double-metaphone and > "pythonize" it. > > On Mon, Aug 11, 2008 at 2

Re: Python Query: Related to locking a resource in a multithreaded environment

2008-08-18 Thread Timothy Grant
tp://mail.python.org/mailman/listinfo/python-list > Does making it a class level instead of instance level variable not work? -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: Could anyone point me to a good site for pearl compiler download

2008-08-21 Thread Timothy Grant
; read the dubious Wikipedia article: > > http://en.wikipedia.org/wiki/Pearl > > Mike > -- > http://mail.python.org/mailman/listinfo/python-list > Maybe he meant Pearl Jam compilation download. -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting references to obect instances into a list

2008-08-27 Thread Timothy Grant
x27;, 'b', 'c']] >>>> > > > How come q is not updated after I deleted p? > > This is my point. > -- > http://mail.python.org/mailman/listinfo/python-list > Because the list still has a reference to the object formerly known as p. -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: Syntax error in ".py" file and globals variable values not available.

2008-08-27 Thread Timothy Grant
n me this behaviour ? > > > Thanks. > -- > Boutillier Alexis > Methodology engineer > > Arteris SA > The Network-on-Chip Company TM > www.arteris.net > > 6 par Ariane Immeuble Mercure > 78284 Guyancourt Cedex > France > Office: (+33) 1 61 37 38 71 >

Re: no string.downer() ?

2008-08-27 Thread Timothy Grant
x27;m > going with the third. > > -- > http://mail.python.org/mailman/listinfo/python-list > I was going to go with not particularly strong in English. To someone not familiar with English, downer() could very well be the obvious converse of upper(). I'm usually quick to think "troll" but this time I didn't. Maybe I'm just naive. -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: Wild Card String Comparison

2008-08-27 Thread Timothy Grant
", "copyright", "credits" or "license" for more information. >>> x = 'the quick brown fox' >>> 'the' in x True >>> 'qui' in x True >>> 'jumped' in x False >>> If that doesn't meet your needs you may want to look at the re module. But if you can avoid re's your likely better off. -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: Wild Card String Comparison

2008-08-27 Thread Timothy Grant
On Wed, Aug 27, 2008 at 10:00 PM, W. eWatson <[EMAIL PROTECTED]> wrote: > Timothy Grant wrote: >> >> On Wed, Aug 27, 2008 at 8:49 PM, W. eWatson <[EMAIL PROTECTED]> >> wrote: >>> >>> Is it possible to do a search for a wild card string in anoth

Re: Syntax error in ".py" file and globals variable values not available.

2008-08-28 Thread Timothy Grant
On Thu, Aug 28, 2008 at 1:40 AM, Alexis Boutillier <[EMAIL PROTECTED]> wrote: > Timothy Grant a écrit : >> >> On Wed, Aug 27, 2008 at 2:49 AM, Alexis Boutillier >> <[EMAIL PROTECTED]> wrote: >>> >>> Hi, >>> >>> I have a stran

Re: Syntax error in ".py" file and globals variable values not available.

2008-08-29 Thread Timothy Grant
On Fri, Aug 29, 2008 at 12:48 AM, Alexis Boutillier <[EMAIL PROTECTED]> wrote: > Timothy Grant a écrit : >> >> On Thu, Aug 28, 2008 at 1:40 AM, Alexis Boutillier >> <[EMAIL PROTECTED]> wrote: >>> >>> Timothy Grant a écrit : >>>> >&

Re: Ensure only single application instance.

2008-08-29 Thread Timothy Grant
> http://mail.python.org/mailman/listinfo/python-list > Why not look at the process list, and if you find two entries kill the one that is just starting? -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: Command lime code

2008-08-29 Thread Timothy Grant
ing us to divine what you're looking for based on next-to-no content in your question is a bit much. -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: Understanding the pythonic way: why a.x = 1 is better than a.setX(1) ?

2008-09-04 Thread Timothy Grant
very interested in reading past > discussion on it, if they are available. > > Regards > Marco I think the most obvious solution to the problem is effective unit tests. If you type "a.y =1" and have a test that asserts a.x == 1 then you would quite quickly discover that you made a typo. -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: PLEASE HELP ME WITH THIS ASSIGNMENT...PLEASE....

2008-09-11 Thread Timothy Grant
epress.com/putitdown > -- > http://mail.python.org/mailman/listinfo/python-list > I find it impossible to take anyone asking others to do their school work for them seriously no matter how or what they are willing to pay. -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: how to find the directory where python is installed ?

2008-10-02 Thread Timothy Grant
.5/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload', '/Library/Python/2.5/site-packages', '/usr/local/lib/wxPython-unicode-2.8.8.0/lib/python2.5', '/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/PyObjC'] >>> -- Stand Fast, tjg. [Timothy Grant] -- http://mail.python.org/mailman/listinfo/python-list

Re: smtplib "authentication required" error

2006-03-31 Thread Timothy Grant
On 31 Mar 2006 18:20:27 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > In using a simple smtp routine: > > # begin example > >>> import smtplib > >>> server = smtplib.SMTP('outgoing.verizon.net') > >>> server.sendmail('[EMAIL PROTECTED]', '[EMAIL PROTECTED]', > """To: [EMAIL PROTECTED] > Fro