Re: What's "the standard" for code docs?

2008-02-19 Thread Tim Chase
HTML. Text-only docs are so last-cen. >>> My sarcasometer is broken today... are you being serious? >> man serious > > As opposed to woman serious? [EMAIL PROTECTED]:~$ man -k serious serious: nothing appropriate. -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: Threads vs. continuations

2008-02-19 Thread Tim Daneliuk
ight here, I'm just curious about the current state of that art. It is the case today that all modern language threading is realized over a kernel implementation of threading that behaves as you suggest? -- Tim Daneli

Re: Article of interest: Python pros/cons for the enterprise

2008-02-20 Thread Tim Chase
> You Used Python to Write WHAT? > http://www.cio.com/article/185350 """ Furthermore, the power and expressivity that Python offers means that it may require more skilled developers. [...down to the summary...] Python may not be an appropriate choice if you: [...] * Rely on teams of less-experie

Re: packing things back to regular expression

2008-02-20 Thread Tim Chase
> mytable = {"a" : "myname"} >>> re.SomeNewFunc(compilexp, mytable) > "myname" how does SomeNewFunc know to pull "a" as opposed to any other key? >>> mytable = {"a" : "1"} >>> re.SomeNewFunc(compileexp, mytable) > ERROR You could do something like one of the following 3 functions: import re

Re: syntax error in python

2008-02-20 Thread Tim Roberts
> if (os.path.isfile('c:\\src\\kasjdfl.txt')) >SyntaxError: invalid syntax > >any idea what is incorrect in my syntax You know that this is not C, and that the parentheses are not needed in the "if" statement? In my opinion, they interfere with readability. -

Re: Is there a sort-of "clear" function in Pythonwin now?

2008-02-20 Thread Tim Roberts
es. The same kind of issue occurs with mod_python and the multitude Python web frameworks, and many of them detect changed files and automatically restart. If you really need a clean environment, then you need a new interpreter. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. --

Re: Article of interest: Python pros/cons for the enterprise

2008-02-21 Thread Tim Chase
> Newbies learn, and the fundamental C++ lessons are usually > learnt quite easily. Ah yes...that would be why Scott Meyers has written three volumes[1] cataloging the gotchas that even experienced C++ programmers can make... And the 1030 page Stroustrup C++ reference is easily comprehended by

Re: Script Running Time

2008-02-21 Thread Tim Chase
> I am trying to find a way to output how long a script took to run. > > Obviously the print would go at the end of the script, so it would be > the time up till that point. I also run a PostgreSQL query inside the > script and would like to separately show how long the query took to > run. > > I

Re: how can i profile every line of code

2008-02-21 Thread Tim Lesher
On Feb 21, 10:06 am, scsoce <[EMAIL PROTECTED]> wrote: > I want to profile a function which has some lines of statement. It seem > that profile module only report function's stats instead of every line > of code, how can i profile every line of code? > thanks. Use the hotshot profiler, and when c

Re: how can i profile every line of code

2008-02-21 Thread Tim Lesher
On Feb 21, 3:27 pm, Tim Lesher <[EMAIL PROTECTED]> wrote: > On Feb 21, 10:06 am, scsoce <[EMAIL PROTECTED]> wrote: > > > I want to profile a function which has some lines of statement. It seem > > that profile module only report function's stats instead of

Re: Order in which modules are imported

2008-02-22 Thread Tim Chase
import random from pylab import * x = random.uniform(0,1) > > Traceback (most recent call last): I suspect that >>> 'random' in dir(pylab) returns True...this would be one of those reasons that "from import *" is scowled upon. You have to know what is dumping into your names

Re: Return value of an assignment statement?

2008-02-23 Thread Tim Roberts
"credits" or "license" for more information. >>> L = [1,2,3] >>> id(L) 10351000 >>> L += [4] >>> id(L) 10351000 >>> -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: most loved template engine on python is?

2008-02-24 Thread Tim Chase
> AFAIK, there is no single blessed template system. If you're up to web > development then your choice of framework will limit the choices for > template engines. For example if you choose Django I guess you'll have > to stick with its built-in template system (I might be wrong on this) Django's

Re: Last 4 Letters of String

2008-02-25 Thread Tim Chase
> How would you get the last 4 items of a list? Did you try the same "get the last 4 items" solution that worked for a string? lst[-4:] -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: Python for web...

2008-02-25 Thread Tim Chase
> I didn't have any trouble setting up mod_python & Django. However, I > am my own hosting provider. That may make a difference. ;-) > > I can install fastcgi if it's a big win. From my understanding, the python-code under mod_python runs as whatever Apaches runs as ("www", "wwwdata", whateve

Re: String compare question

2008-02-25 Thread Tim Chase
>> ignored_dirs = ( >>r".\boost\include", # It's that comma that makes this a tuple. >> ) >> > > Thanks for reminding me of this. I always forget that! > > Now that it is correctly doing *only* whole string matches, what if I want > to make it do a substring compare to each string in my

Re: bin2chr("01110011") # = 15 function ?

2008-02-25 Thread Tim Chase
> I'm searching for a simple > bin2chr("01110011") function that can convert all my 8bit data to a > chr so I can use something like this: > print ord("s") # = 115 > print bin(ord("s")) # = 01110011 > > test= open('output.ext,'wb') > test.write(bin2chr("01110011")) > test.write(bin2chr("0011"

Re: Order of evaluation in conditionals

2008-02-25 Thread Tim Chase
> if () and () and (): > do_something() > > Is there a guarantee that Python will evaluate those conditions in order (1, > 2, 3)? I know I can write that as a nested if, and avoid the problem > altogether, but now I'm curious about this ;). Yes, Python does short-circuit evaluation, from left-t

Re: Break lines?

2008-02-26 Thread Tim Chase
> I have made this string: > > TITLE = 'Efficiency of set operations: sort model, >(cphstl::set::insert(p,e)^n cphstl::set::insert(e)), integer' > > But I am not allowed to break the line like that: > > IndentationError: unexpected indent > > How do I break a line? Dep

Re: Break lines?

2008-02-26 Thread Tim Chase
> Ok thanks! Btw why double quotes " instead of single ' ? Either one will do...there's not much difference. I try to use double-quotes most of the time, just so when I include an apostrophe in-line (which I do more often than I include a double-quote in-line), I don't have to think. strin

Making string-formatting smarter by handling generators?

2008-02-27 Thread Tim Chase
Is there an easy way to make string-formatting smart enough to gracefully handle iterators/generators? E.g. transform = lambda s: s.upper() pair = ('hello', 'world') print "%s, %s" % pair # works print "%s, %s" % map(transform, pair) # fails with a """ TypeError: not enough argumen

Re: Making string-formatting smarter by handling generators?

2008-02-27 Thread Tim Chase
>> Is there an easy way to make string-formatting smart enough to >> gracefully handle iterators/generators? E.g. >> >>transform = lambda s: s.upper() >>pair = ('hello', 'world') >>print "%s, %s" % pair # works >>print "%s, %s" % map(transform, pair) # fails >> >> with a """ >> Typ

Re: Making string-formatting smarter by handling generators?

2008-02-27 Thread Tim Chase
>> Note that your problem has nothing to do with map itself. >> String interpolation using % requires either many individual >> arguments, or a single *tuple* argument. A list is printed >> as itself. Just as an exercise to understand this better, I've been trying to figure out what allows for th

Re: joining strings question

2008-02-29 Thread Tim Chase
> I have some data with some categories, titles, subtitles, and a link > to their pdf and I need to join the title and the subtitle for every > file and divide them into their separate groups. > > So the data comes in like this: > > data = ['RULES', 'title','subtitle','pdf', > 'title1','subtitle1

Re: joining strings question

2008-02-29 Thread Tim Chase
I V wrote: > On Fri, 29 Feb 2008 08:18:54 -0800, baku wrote: >> return s == s.upper() > > A couple of people in this thread have used this to test for an upper > case string. Is there a reason to prefer it to s.isupper() ? For my part? forgetfulness brought on by underuse of .isupper() -tk

Re: rstrip error python2.4.3 not in 2.5.1?

2008-02-29 Thread Tim Roberts
_extract_bookmarks_from_url_history >timestamp = datetime.datetime.strptime(month_string, '%b ‘ >%y') >AttributeError: type object 'datetime.datetime' has no attribute >'strptime' I suppose it is cruel of me, but I find it hilarious that you looked at t

Re: pySQLite Insert speed

2008-02-29 Thread Tim Roberts
gt;(B) > pf= '?, ?, ?, ?' >sqlxb= 'INSERT INTO DTABLE2 VALUES ( %s ) ' % pf >curs.execute( sqlxb, values ) > >Any intution on why (A) is slower? I think you misunderstood. (B) is *ALWAYS* the proper way of doing parameterized SQL queries. Unconditiona

Re: Getting a free TCP port & blocking it

2008-02-29 Thread Tim Roberts
he port >3). Free the port before external program execution. What's the point? Why can't the actual user of the port create the port, and then notify the other side of the port number? And why don't you just specify a port number of 0 and let the system assign you a free po

Re: Where's GUI for Python?

2008-03-01 Thread Tim Chase
> I'm certain there is an API for creating > GUI's but as far i can find it in the > http://docs.python.org/tut/tut.html > the only "gui" is in "Guido". > > What do i miss? The batteries-included GUI: import tkininter Add-on solutions include wxPython, PythonCard and many others. GIYF:

Re: A python STUN client is ready on Google Code.

2008-03-01 Thread Tim Chase
> |I upload a new version. Add more print log into my code to help people > | understand my program > > Announcements should include a short paragraph explaining what the > announcement is about for those of us not in the know. IE, what is > STUN? -- and therefore, what is a STUN client? I be

Re: Import, how to change sys.path on Windows, and module naming?

2008-03-02 Thread Tim Roberts
it were a directory. It's a very handy feature for distributing premade packages. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: RELEASED Python 2.6a1 and 3.0a3

2008-03-02 Thread Tim Roberts
I know. Why? > >"The master said so" isn't an entirely satisfying answer. Nevertheless, it IS the answer for many questions in the Python world. That's the advantage of being Benevolent Dictator For Life. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: SV: Where's GUI for Python?

2008-03-02 Thread Tim Roberts
to you. wxPython, for instance, has a wonderful set of demos that demonstrate almost every feature of the toolkit. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: for-else

2008-03-04 Thread Tim Chase
> For instance, if you have a (trivial) if...elif...else like this: > > if a == 0: > do_task_0() > elif a == 1: > do_task_1() > elif a == 2: > do_task_2() > else: > do_default_task() > > You could roll it up into a for...else statement like this: > > for i in range(3): > if a

Re: Python an Exchange Server

2008-03-04 Thread Tim Chase
> Hi friends. Someone know how to work with python and exchange > server?. I've used both imaplib[1] and smtplib[2] (in the standard library) for talking successfully with an Exchange server. I don't do much with POP3, but there's also a poplib module[3] in the standard library. I just wrote

Re: sqlite3 permission issue

2008-03-04 Thread Tim Chase
> I am trying to execute an update to a sqlite3 db via a python cgi If you're running as a CGI, your script (as you guess below) will usually run with the effective permissions of the web-server. Frequently, this is some user such as "wwwdata" or "www". > conn = sqlite3.connect('db') Make sure

Re: Delete hidden files on unix

2008-03-04 Thread Tim Roberts
at would not just work. You did try to solve this yourself before sending a message around the world, didn't you? -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Talking to a usb device (serial terminal)

2008-03-04 Thread Tim Roberts
particularly information thats from the >past 8 years. That's because serial ports, and the means of accessing them, haven't changed significantly in the last 8 years. Or the last 38 years, for that matter. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Using re module better

2008-03-05 Thread Tim Chase
> if (match = re.search('(\w+)\s*(\w+)', foo)): Caveat #1: use a raw string here Caveat #2: inline assignment is verboten match = re.search(r'(\w+)\s*(\w*+)', foo) if match: > field1 = match.group(1) > field2 = match.group(2) This should then work more or less. However, since y

Re: system32 directory

2008-03-06 Thread Tim Golden
Robert Dailey wrote: > Hi, > > Is there a way to get the System32 directory from windows through python? > For example, in C++ you do this by calling GetSystemDirectory(). Is there an > equivalent Python function for obtaining windows installation dependent > paths? First thing to do when asking

Re: Exploring Attributes and Methods

2008-03-06 Thread Tim Chase
> Class Sample: > fullname = 'Something' > > How can I know that this class has an attribute called 'fullname'? with the builtin hasattr() function :) >>> class Sample: fullname='Something' ... >>> hasattr(Sample, 'fullname') True -tkc -- http://mail.python.org/mailman/listinfo/python-

Re: system32 directory

2008-03-07 Thread Tim Golden
Robert Dailey wrote: > On Thu, Mar 6, 2008 at 2:42 AM, Tim Golden <[EMAIL PROTECTED]> wrote: >> >> First thing to do when asking "How do I do X in Python under Windows?" >> is to stick -- python X -- into Google and you get, eg: >> >> >>

Re: problem with join

2008-03-07 Thread Tim Golden
nodrogbrown wrote: > hi > i am using python on WinXP..i have a string 'folder ' that i want to > join to a set of imagefile names to create complete qualified names so > that i can create objects out of them > > folder='F:/brown/code/python/fgrp1' > filenms=['amber1.jpg', 'amber3.jpg', 'amy1.jpg',

Re: I cannot evaluate this statement...

2008-03-07 Thread Tim Chase
> import os, sys > pyfile = (sys.platform[:3] == 'win' and 'python.exe') or 'python' > > Okay, run on a win32 machine, pyfile evaluates to python.exe [snip] > Now. Run this on linux. The first condition evaluates sys.platform[:3] > == 'win' as false. [snip] > Where am I going wrong. And when will

Re: Intelligent Date & Time parsing

2008-03-08 Thread Tim Chase
> I am a GNU newbie. (I know C &o.) Can you point me to a > place to find the source for 'date'? It's part of the GNU Coreutils: http://ftp.gnu.org/gnu/coreutils/ Within the file, you're likely interested in lib/getdate.* It helps if you have a working knowledge of Yacc. -tkc -- http://ma

Re: any chance regular expressions are cached?

2008-03-09 Thread Tim Chase
> s=re.sub(r'\n','\n'+spaces,s) > s=re.sub(r'^',spaces,s) > s=re.sub(r' *\n','\n',s) > s=re.sub(r' *$','',s) > s=re.sub(r'\n*$','',s) > > Is there any chance that these will be cached somewhere, and save > me the trouble of having to declare some global re's if I don't > want t

Re: parsing directory for certain filetypes

2008-03-10 Thread Tim Chase
> i wrote a function to parse a given directory and make a sorted list > of files with .txt,.doc extensions .it works,but i want to know if it > is too bloated..can this be rewritten in more efficient manner? > > here it is... > > from string import split > from os.path import isdir,join,normpat

Re: lowercase u before string in "python for windows"

2008-03-10 Thread Tim Chase
> why does this occur when using the python windows extensions? all > string are prefixed by a lowercase "u". They are Unicode strings: http://docs.python.org/ref/strings.html > is there a newsgroup explicitly for python windows extensions? Not that I know of, other than what's described here:

Re: tcp client socket bind problem

2008-03-11 Thread Tim Roberts
ection is be established using >socket_connect() or socket_listen(). >This function must be used on the socket before socket_connect(). That's all true. So what was your point? How does this help the original poster? -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: rmdir problem

2008-03-11 Thread Tim Golden
royG wrote: > hi > i am checking if a directory exists and if it does i want to delete it > and its contents.then i want to create the directory before creating > files in it. > > def myfolderops(): > testdir='..\mytestdir' > #if dir exist remove it > if isdir(testdir): > rmdir

Re: parsing directory for certain filetypes

2008-03-11 Thread Tim Chase
royG wrote: > On Mar 10, 8:03 pm, Tim Chase wrote: > >> In Python2.5 (or 2.4 if you implement the any() function, ripped >> from the docs[1]), this could be rewritten to be a little more >> flexible...something like this (untested): >> > > that was quite

Re: agg (effbot)

2008-03-12 Thread Tim Chase
Gerhard Häring wrote: > [EMAIL PROTECTED] wrote: >> aggdraw-1.2a3-20060212.tar.gz > > Try shegabittling the frotz first. If that doesn't help, please post the > output of the compile command that threw the error. Maynard: He who is valiant and pure of spirit may find the compiling instructions

Re: Is there Python equivalent to Perl BEGIN{} block?

2008-03-12 Thread Tim Chase
> The subject says pretty much all, Given what I understand about the BEGIN block[1], this is how Python works automatically: bash$ cat a.py print 'a1' import b print 'a2' bash$ cat b.py print 'b' bash$ python a.py a1 b a2 However, the first import does win and

Re: enums and PEP 3132

2008-03-12 Thread Tim Chase
>> Currently I'm just putting this at the top of the file: >> py=1 >> funcpre=2 >> funcpost=3 >> ... > > That can be done more compactly with > > py, funcpre, funcpost = range(3) I've harbored a hope that a combination of PEP 3132[1] ("Extended Iterable unpacking") and iter

Re: string / split method on ASCII code?

2008-03-12 Thread Tim Chase
> I have these annoying textilfes that are delimited by the ASCII char for << > (only its a single character) and >> (again a single character) > > Their codes are 174 and 175, respectively. > > My datafiles are in the moronic form > > X<>Z > > I need to split on those freaking characters. Any

Re: mulithreaded server

2008-03-13 Thread Tim Roberts
and you rather rudely ignored, there is no variable called "sSocketlock", because you commented it out. Next, "stdout.release()" will fail. "stdout" does not have a release function. You meant "stdoutlock.release()". Next, you release sSocketlock, but you n

Re: Spaces in path name

2008-03-14 Thread Tim Golden
David S wrote: > Gets me further but still seems to be issue with space after 'Program' as > code tries to run 'C:\Program'. Don't understand what is going on here... Slight apologies as I haven't followed this thread closely, but using the Acrobat Reader executable, which is, I think, good enou

Re: find string in file

2008-03-14 Thread Tim Chase
> I'm neophite about python, my target is to create a programa that > find a specific string in text file. > How can do it? >>> FNAME1 = 'has.txt' >>> FNAME2 = 'doesnt_have.txt' >>> TEXT = 'thing to search for' >>> TEXT in file(FNAME1).read() True >>> TEXT in file(FNAME2).read() False or th

Re: request for Details about Dictionaries in Python

2008-03-14 Thread Tim Golden
Matt Nordhoff wrote: > Michael Wieher wrote: >> I'm not sure if a well-written file/seek/read algorithm is faster than a >> relational database... >> sure a database can store relations and triggers and all that, but if >> he's just doing a lookup for static data, then I'm thinking disk IO is >> fa

Re: Joseph Weizenbaum

2008-03-14 Thread Tim Roberts
t;>>>> http://www-tech.mit.edu/V128/N12/weizenbaum.html >>>>> >>>> How do you feel about creator of Eliza? >>> >>> What is Eliza? >> >> Does that question interest you? > >Well played, sir. > >Earlier you said wha

Re: Spaces in path name

2008-03-15 Thread Tim Golden
joep wrote: > I had the same problem recently with subprocess.popen, when there is a > space in the executable and a space in an additional argument as in > the acrobat example. I finally found a past thread in this news group > that explained that you have to use two (2) leading double quotes, and

Re: Spaces in path name

2008-03-15 Thread Tim Golden
joep wrote: > On Mar 15, 5:42 pm, joep <[EMAIL PROTECTED]> wrote: >>> http://timgolden.me.uk/python/win32_how_do_i/run-a-command-with-a-spa... >> Note: this works for subprocess.call but for subprocess.Popen this >> does not work if there are two arguments in the command line with >> spaces. Especi

Re: Spaces in path name

2008-03-16 Thread Tim Golden
Tim Golden wrote: > joep wrote: >> On Mar 15, 5:42 pm, joep <[EMAIL PROTECTED]> wrote: >>>> http://timgolden.me.uk/python/win32_how_do_i/run-a-command-with-a-spa... >>> Note: this works for subprocess.call but for subprocess.Popen this >>> does not w

Re: Spaces in path name

2008-03-16 Thread Tim Golden
joep wrote: > > Tim Golden wrote: > >> subprocess.call ([ >> >>r"C:\Program Files\Adobe\Acrobat 5.0\Reader\acro reader.exe", >> >> r"C:\Program Files\Adobe\Acr >> obat 5.0\Reader\plug_ins.donotuse\Annotations\Stamps\abc def.p

Re: Spaces in path name

2008-03-16 Thread Tim Golden
joep wrote: > I assume that there is some difference how subprocess.call and > subprocess.Popen handle and format the command. subprocess.Popen does > the correct formatting when only one file path has spaces and requires > double quoting, but not if there are two file paths with spaces in it. The

Re: Types, Cython, program readability

2008-03-16 Thread Tim Golden
[EMAIL PROTECTED] wrote: > It seems the development of Cython is going very well, quite > differently from the dead-looking Pyrex. I'll leave others to comment on how dead Pyrex is or isn't ... > Hopefully Cython will become > more user-friendly too (Pyrex is far from being user-friendly for > W

Re: Spaces in path name

2008-03-16 Thread Tim Golden
Tim Golden wrote: > What I haven't investigated yet is whether the additional flags > your example is passing (shell=True etc.) cause the main Popen > mechanism to take a different path. Sure enough, passing shell=True -- which is probably quite a rare requirement -- causes the code

Re: Spaces in path name

2008-03-16 Thread Tim Golden
joep wrote: > > Tim Golden wrote: >> Tim Golden wrote: >>> What I haven't investigated yet is whether the additional flags >>> your example is passing (shell=True etc.) cause the main Popen >>> mechanism to take a different path. >> Sure enough,

Re: Spaces in path name

2008-03-16 Thread Tim Golden
Tim Golden wrote: > Well I've got a patch ready to go (which basically just > wraps a shell=True command line with an *extra* pair of > double-quotes, the same as you do for an os.system call). > I'll try to put some time into the subprocess docs as well, > at least as f

Re: When file-like objects aren't file-like enough for Windows

2008-03-16 Thread Tim Golden
William McBrine wrote: > Now, I have a similar problem with subprocess.Popen... The code that > works in Linux looks like this: > > source = urllib.urlopen(url) > child = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=source) > try: > shutil.copyfileobj(child.stdout, self

Re: Types, Cython, program readability

2008-03-17 Thread Tim Golden
Tom Stambaugh wrote: >> I'm not entirely sure why you think Pyrex should "contain a compiler". >> It certainly works well enough with the free [beer] MS VS 2008 Express >> and I'm fairly sure it's fine with MingW. Both of those are readily >> available and I don't imagine anyone who's going to use

Re: Spaces in path name

2008-03-17 Thread Tim Golden
Gertjan Klein wrote: > joep wrote: > >> * If shell=True is required, then the executable is a build-in shell >> command, which does not contain spaces, and, therefore, has no >> problems > > This is only true when you are referring to directly executable files. > However, Shell=True is also requi

Re: Convert binary file

2008-03-18 Thread Tim Golden
Diez B. Roggisch wrote: > Vamp4L schrieb: >> Hello, >> Specifically, I'm trying to convert the Internet Explorer history >> file (index.dat) into a readable format. Anyone done something >> similar or know of any functions that may help with such a task? I'm >> not sure exactly what kind of fil

Re: stdout custom

2008-03-18 Thread Tim Golden
[EMAIL PROTECTED] wrote: >>> Can I allocate a second console window, so I can place certain output >>> to that directly, and leave the original streams alone? I've rather lost track of what you're trying to do, but I would second Gabriel's suggestion of the standard Windows method of debug outpu

Re: Regarding coding style

2008-03-18 Thread Tim Lesher
lly expects. > > Like doctests? (I know, smart-ass response) > > Regards, > Ryan Ginstrom Not a smart-ass response at all--a _smart_ response. Doctests are one of the few mechanisms I've ever seen that even attempt to make this happen. -- Tim Lesher [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: placing a Python com object into Excel

2008-03-19 Thread Tim Roberts
? What you see there is the list of registered ActiveX controls. You need to implement a few additional interfaces. I believe IOleInPlaceObject is required to satisfy Excel. http://msdn2.microsoft.com/en-us/library/aa751972.aspx -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide,

Re: parsing json output

2008-03-19 Thread Tim Roberts
n.decode(response.read()) to parse it. Have you read the cjson documentation? -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: PODCasts

2008-03-19 Thread Tim Chase
> I really should say net cast as I think it's a better term ;) > > Does anyone have any recommended net casts on Python, or programming in > general? Well, though it's been a while since I last noticed a new release (last one dated Dec '07), the archives of "Python 411" should all be online:

Re: Search the command history - Python Shell

2008-03-19 Thread Tim Chase
> Are there any simillar key combination in Python Shell like Linux Ctrl+R > (reverse-i-search) to search the command history? It must depend on how your version of Python was built...mine here on my Linux box has exactly that functionality. I press ^R and start typing, and the line comes up f

Re: a beginner, beginners question

2008-03-19 Thread Tim Chase
> class example: > def __init__(self, foo, bar): > self.foo = foo > self.bar = bar > > def method(self): > print "method ... :" > print self.foo > print self.bar > > if __name__ == "__main__": > obj = example This makes "obj" a synonym for "e

Re: url validator in python

2008-03-19 Thread Tim Chase
> How can I check the validity of absolute urls with http scheme? > example: > "http://www.example.com/something.html"; -> valid > "http://www.google.com/ + Brite_AB_Iframe_URL + " -> invalid You could try something like import urllib tests = ( ("http://www.google.com/ + Brite_AB_Ifram

Re: parsing json output

2008-03-20 Thread Tim Roberts
hon 2.5. On the other hand, the same >code worked perfectly great on my linux machine with python 2.3.4. >What could the problem be? I'm not sure. It worked correctly on my Windows machine with Python 2.4.4. Are you going through a proxy? Are you able to read other (non-JSON) web pa

Re: os.path.getsize() on Windows

2008-03-20 Thread Tim Roberts
Sean DiZazzo <[EMAIL PROTECTED]> wrote: > >The overall idea is to be able to tell if a file has finished being >placed in a directory without any control over what is putting it >there. There is simply no way to do this on Windows that works in the general case. -- Tim Roberts

Re: Improving datetime

2008-03-20 Thread Tim Roberts
Christian Heimes <[EMAIL PROTECTED]> wrote: > >Yes, it sounds like a good idea. The low hanging fruits (aka easy tasks) >could be implemented for 2.6 and 3.0. The more complex tasks may have to >wait for 2.7 and 3.1 I thought there wasn't going to be a 2.7... -- Tim Ro

Re: beginners question about return value of re.split

2008-03-21 Thread Tim Chase
> datum = "2008-03-14" > the_date = re.split('^([0-9]{4})-([0-9]{2})-([0-9]{2})$', datum, 3) > print the_date > > Now the result that is printed is: > ['', '2008', '03', '14', ''] > > My question: what are the empty strings doing there in the beginning and > in the end ? Is this due

Re: Anomaly in time.clock()

2008-03-22 Thread Tim Roberts
count is updated as part of scheduling during timer interrupts. As long as no one disables interrupts for more than about 15ms, it is reliable. However, it's only a 32-bit value, so the number rolls over every 49 days. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- ht

Re: Does python hate cathy?

2008-03-23 Thread Tim Chase
> When I run this script, I got the following exception: > Exception exceptions.AttributeError: "'NoneType' object has no > attribute 'population'" in <__main__.Person instance at 0xb7d8ac6c>> ignored > > To to newcomer like me, this message doesn't make much sense. What > seems weird to me is th

Re: My python interpreter became mad !

2008-03-25 Thread Tim Golden
Benjamin Watine wrote: > Yes, my python interpreter seems to became mad ; or may be it's me ! :) > > I'm trying to use re module to match text with regular expression. In a > first time, all works right. But since yesterday, I have a very strange > behaviour : > > $ python2.4 > Python 2.4.4 (#2

Re: Reading new mail from outlook

2008-03-25 Thread Tim Golden
SPJ wrote: > I am trying to create new tickets in the ticketing system using python. When > I > receive new email from a particular address, I have to trigger the python > script > and parse the mail in required format. > > The main hurdle here is, how to invoke the script on arrival of new

Re: any good g.a.'s?

2008-03-25 Thread Tim Chase
> Any good genetic algorithms involving you-split, i-pick? I've always heard it as "you divide, I decide"... That said, I'm not sure how that applies in a GA world. It's been a while since I've done any coding with GAs, but I don't recall any facets related to the You Divide, I Decide problem.

Re: Reading new mail from outlook using Python

2008-03-25 Thread Tim Golden
SPJ wrote: > Thanks... > > I could access the folders in outlook express using the COM interface. > Now I am stuck with how to read to a file only new mails. Well, this Google query: http://www.google.co.uk/search?hl=en&q=OUTLOOK.application+unread+messages seems to indicate some useful hits.

Re: what does ^ do in python

2008-03-25 Thread Tim Chase
> In most of the languages ^ is used for 'to the power of'. > > No, not in most languages. In most languages (C, C++, Java, C#, Python, > Fortran, ...), ^ is the xor operator ;) ...and in Pascal it's the pointer-dereferencing operator... -tkc -- http://mail.python.org/mailman/listinfo/python-

Re: what does ^ do in python

2008-03-26 Thread Tim Chase
>> HOw can we use express pointers as in C or python? > > Traceback (most recent call last): >File "", line 1, in >File "parser.py", line 123, in parse_text > tree = language.parse_text(text) >File "english.py", line 456, in parse_text > tree = self.parse_sentence(sentence)

A question on decorators

2008-03-26 Thread Tim Henderson
Has any one here done anything like this before? Thank you for reading my long post, I hope you understand what I am asking especially since the code in it is not very good. cheers Tim Henderson -- http://mail.python.org/mailman/listinfo/python-list

Re: A question on decorators

2008-03-26 Thread Tim Henderson
it some context. cheers Tim Henderson -- http://mail.python.org/mailman/listinfo/python-list

first interactive app

2008-03-26 Thread Tim Arnold
apter for the first volume' and recalculate, etc until all volumes are defined. Any ideas on a simple interface for this? thanks, --Tim -- http://mail.python.org/mailman/listinfo/python-list

Re: py2exe socket.gaierror (10093)

2008-03-27 Thread Tim Golden
Python Programming on Win32 wrote: > The problem is running smtplib in a py2exe compiled exe file. When it > tries to establish a socket to the mail server it fails. > > Just wondering someone has encountered this before, and if someone > might be able to point me in the right direction. > > Unha

Re: Problem with write binary data to OLE field in Access

2008-03-27 Thread Tim Golden
lialie wrote: [... snip slightly confused indication that reading back a binary item using GetChunk appears to double its length ...] Well I don't know why this should be happening, but I do at least have a few suggestions: 1) Try using ADODB.Stream instead of GetChunk etc. 2) Try using the adod

Re: Checking processes running under Windows

2008-03-27 Thread Tim Golden
João Rodrigues wrote: > Hello all! I'm trying to write a script that needs to check which processes > are running under Windows (XP Pro, Home, whatever). The method I'm using is: > process_list = os.popen('TASKLIST').read() > > However, XP Home doesn't have the tasklist.exe tool so, this is

Re: first interactive app

2008-03-27 Thread Tim Arnold
"Miki" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello Tim, >> >> Any ideas on a simple interface for this? >> > How about something like: > > Chapter 1 (001-200 200) > Chapter 2 (200-300 100) > -- 001-300 300 --

<    44   45   46   47   48   49   50   51   52   53   >