Re: Is this a bug? Python intermittently stops dead for seconds

2006-10-01 Thread Tim Peters
[Charlie Strauss] >>> level0: newly created objects >>> level1: objects that survived 1 round of garbage collection >>> level2: objects that survivied 2+ rounds of gargbage collection >>> >>> Since all of my numerous objects are level2 objects, and none of >>> them are every deallocated, then I

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: How can I make a class that can be converted into an int?

2006-10-02 Thread Tim Chase
> What are the internal methods that I need to define on any class so that > this code can work? > > c = C("three") > > i = int(c) # i is 3 > > I can handle the part of mapping "three" to 3, but I don't know what > internal method is called when int(c) happens. > > For string conversion, I just

Re: Sort by domain name?

2006-10-02 Thread Tim Chase
>> Here, domain name doesn't contain subdomain, or should I >> say, domain's part of 'www', mail, news and en should be >> excluded. > > It's a little more complicated, you have to treat co.uk about > the same way as .com, and similarly for some other countries > but not all. For example, subd

Re: php and python: how to unpickle using PHP?

2006-10-03 Thread Tim Arnold
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ted Zeng: >> I store some test results into a database after I use python >> To pickle them (say, misfiles=['file1','file2']) >> Now I want to display the result on a web page which uses PHP. >> How could the web page unpickle the resu

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: String constants (was "Looping over a list question")

2006-10-03 Thread Tim Chase
> I'd also love to see string constants implemented some day too > (like str.whitespace and str.ascii_letters). You mean like the "string" module provides? :) >>> import string >>> print '\n'.join(["%s -> %s" % (s, repr(eval('string.%s' % s))) for s in dir(string) if isinstance(eval('string.%s

Re: What value should be passed to make a function use the default argument value?

2006-10-03 Thread Tim Chase
> def f(var=1): > return var*2 > > What value do I have to pass to f() if I want it to evaluate var to 1? > I know that f() will return 2, but what if I absolutely want to pass a > value to f()? "None" doesn't seem to work.. >>> def f(var=1): ... return var*2 ... >>> f() 2 >>> f(0.5) 1.0

Re: numpy magic: cast scalar returns auto to python types float & int ?

2006-11-17 Thread Tim Hochberg
t (the address of which just changed and I don't have it handy, but I'm sure you can find it). For your particular issue, you might try tweaking pickle to convert int64 objects to int objects. Assuming of course that you have enough of these to matter, otherwise, I suggest just leaving things alone. -tim -- http://mail.python.org/mailman/listinfo/python-list

Re: String Replace only if whole word?

2006-11-17 Thread Tim Chase
> I have been using the string.replace(from_string, to_string, len(string)) > to replace names in a file with their IP address. > For example, I have definitions file, that looks something like: > 10.1.3.4 LANDING_GEAR > 20.11.222.4 ALTIMETER_100 > 172.18.50.138 SIB > 172.18.50.138 LAPTOP >

Re: remove a list from a list

2006-11-17 Thread Tim Chase
> I have a list like >e = ['a', 'b', 'e'] > and another list like >l = ['A', 'a', 'c', 'D', 'E'] > I would like to remove from l all the elements that appear in e > case-insensitive. That is, the result would be >r = ['c', 'D'] > > What is a *nice* way of doing it? Well, it's usuall

Re: remove a list from a list

2006-11-17 Thread Tim Chase
> That is a nice solution. > > But, how about modifying the list in place? > > That is, l would become ['c', 'D']. > >> >>> e = ['a', 'b', 'e'] >> >>> l = ['A', 'a', 'c', 'D', 'E'] >> >>> s = set(e) >> >>> [x for x in l if x.lower() not in s] >> ['c', 'D'] Well...changing the requirements m

Re: remove a list from a list

2006-11-17 Thread Tim Chase
> Yeah, I ended up doing a similar kind of loop. That is pretty messy. > > Is there any other way? I've already provided 2 (or 3 depending on how one counts) solutions, each of which solve an interpretation of your original problem, neither of which involve more than 3 lines of fairly clean co

Re: remove a list from a list

2006-11-17 Thread Tim Chase
> from sets import Set as set # Python 2.3 > > b = list( set([i.upper() for i in b) - set([i.upper() for i in a] ) ) Just a caveat...this can change the order of items in the results as sets (and their differences) are inherently unordered data structures. If order of the items in the list n

Re: how to print pdf with python on a inkjet printer.

2006-11-17 Thread Tim Roberts
ere is a standard "print" dialog for Windows that shows you the familiar dialog, with the list of printers and all of the options. In wxPython, I believe it is called wx.PrintDialog. In Pywin32, win32print.EnumPrinters can give you the list of available printers. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Decimal() instead of float?

2006-11-17 Thread Tim Peters
[Michael B. Trausch] >> Let's say that I want to work with the latitude 33.6907570. In Python, >> that number > can not be stored exactly without the aid of >> decimal.Decimal(). >> >> >>> 33.6907570 >> 33.6907568 >> >>> >> >> As you can see, it loses accuracy after the 6th decimal place.

Re: How can I speed this function up?

2006-11-17 Thread Tim Hochberg
dn't check that they were actually right). Using some of the other suggestions mentioned in this thread may make things better still. It's possible that some intermediate chunk size might be better than collecting everything into one string, I dunno. cStringIO might be helpful here as a buf

Re: numpy: frequencies

2006-11-18 Thread Tim Hochberg
undary conditions you apply. The general idea is this: result = ia[n-1:] for i in range(n-1): numpy.maximum(result, ia[i:-n+i], result) This punts on dealing with the ends (and I haven't tested this version), but should give you the idea. -tim -- http://mail.python.org/mailman/listinfo/python-list

Re: syntax error in sum(). Please explicate.

2006-11-18 Thread Tim Peters
[Matt Moriarity] >> try surrounding your sum argument in brackets: >> >> sum([phi(x // ps[i+1], i) for i in range(a)]) >> >> instead of: >> >> sum(phi(x // ps[i+1], i) for i in range(a)) [Michael Press] > Thank you. That makes it work. But is a wrong solution ;-) As others have suggested, it's a

RE: file backup in windows

2006-11-22 Thread Tim Golden
| " c:\documents and settings\060577\Local Settings\Application | Data\Microsoft\Outlook " | where 060577 represents username. I want my script to | identigy the user | logged in and go to the resp outlook folder or should be able to read | outlook store directory path from registry and the copy t

RE: file backup in windows

2006-11-22 Thread Tim Golden
[... snip ...] | --- | how can i make the following code work, I have probelm with filepath | declaration. | --- | import os, shutil | filepath = ' C:\\Documents and Settings\\060577\\Local | Settings\\

RE: file backup in windows

2006-11-22 Thread Tim Golden
| > | > import os, sys | > from win32com.shell import shell, shellcon | > | > local_app_data = shell.SHGetSpecialFolderPath (0, | > shellcon.CSIDL_LOCAL_APPDATA) | > outlook_path = os.path.join (local_app_data, "Microsoft", "Outlook") | > | > print outlook_path | > | > | | The above code was fin

RE: file backup in windows

2006-11-22 Thread Tim Golden
| I am sorry I am providing the code i used as it is. Being newbee to | programming I have tinkerd with various options i found on the net. Thanks. That makes it a lot easier [... snip ...] | source = outlook_path | #source = outlook_path +'\\*' | print source [...] | win32file.CopyFile (sourc

Re: regex problem

2006-11-22 Thread Tim Chase
> line is am trying to match is > 1959400|Q2BYK3|Q2BYK3_9GAMM Hypothetical outer membra29.90.00011 1 > > regex i have written is > re.compile > (r'(\d+?)\|((P|O|Q)\w{5})\|\w{3,6}\_\w{3,5}\s+?.{25}\s{3}(\d+?\.\d)\s+?(\d\.\d+?)') > > I am trying to extract 0.0011 value from the above line

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: Is time.time() < time.time() always true?

2006-11-23 Thread Tim Roberts
ur at one time instant Well, as long as we're being pedantic, surely that should read "only one thing can occur at any time instant..." -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: len(var) is [CONSTANT] equal to len(var) == [CONSTANT]?

2006-11-23 Thread Tim Roberts
? It has been my experience that virtually every use of the "is" operator (except "is None") is wrong. Now, I fully understand that there are perfectly valid uses for "is", and the standard library contains a few, but for the non-guru casual Python programmer, I

Re: python skipping lines?

2006-11-27 Thread Tim Chase
I'm not sure if this will /solve/ your problem, but it's something I noticed... > UnitList = open('/Python25/working/FacList.txt', 'r') > RawData = open('/Python25/working/data.txt', 'r') Here, you open RawData once... > Output = open('/Python25/working/output.txt', 'a') > > def PullHourlyData

Re: splitting a long string into a list

2006-11-27 Thread Tim Roberts
irth Defects; Toxic ChemicalsAntibiotics, >AnimalsAgricultural Subsidies, Global TradeAgricultural >SubsidiesBiodiversityCitizen ActivismCommunity... What do you want out of this? It looks like there are several levels crammed together here. At first blush, it looks like topics separat

Error when installing the Python Imaging Library

2006-11-28 Thread Tim Adler
t is wrong. Can somebody point me directions. I really need the PIL to work. Thx, Tim -- http://mail.python.org/mailman/listinfo/python-list

Re: Error when installing the Python Imaging Library

2006-11-28 Thread Tim Adler
Thx, I got it. I installed PIL through the automatic install tool. Which resolved some dependencies. Fredrik Lundh schrieb: > Tim Adler wrote: > > > I'm quite new to Python. I'm working on a webproject with Django and > > need to install the Python Imaging Library.

RE: Accessing file metadata on windows XP

2006-11-28 Thread Tim Golden
[EMAIL PROTECTED] | When rightclicking a, for example, pdf file on windows, one normally | gets a screen with three or four tags. Clicking on one of the summary | tag one can get some info like "title", "Author", "category", | "keyword" | etc.. [warning: not my area of expertise] That informat

RE: Accessing file metadata on windows XP

2006-11-28 Thread Tim Golden
[Dennis Lee Bieber] | > When rightclicking a, for example, pdf file on windows, one normally | > gets a screen with three or four tags. Clicking on one of | the summary | > tag one can get some info like "title", "Author", | "category", "keyword" | > etc.. | > | Doesn't for me... Right-clicking

RE: Accessing file metadata on windows XP

2006-11-28 Thread Tim Golden
[EMAIL PROTECTED] | When rightclicking a, for example, pdf file on windows, one normally | gets a screen with three or four tags. Clicking on one of the summary | tag one can get some info like "title", "Author", "category", | "keyword" | etc.. This (Delphi) article is about the most informativ

Re: Modifying every alternate element of a sequence

2006-11-28 Thread Tim Chase
> I have a list of numbers and I want to build another list with every > second element multiplied by -1. > > input = [1,2,3,4,5,6] > wanted = [1,-2,3,-4,5,-6] > > I can implement it like this: > > input = range(3,12) > wanted = [] > for (i,v) in enumerate(input): > if i%2 == 0: > wa

Re: Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread Tim Hochberg
me idea that, for better or for worse is considerably less verbose: def continue_join_2(linesin): getline = iter(linesin).next while True: buffer = getline().rstrip() try: while buffer.endswith('_'): buffer = buffer[:-1] + getline().rstrip() except StopIteration: raise ValueError("last line is continued: %r" % line) yield buffer -tim [SNIP] -- http://mail.python.org/mailman/listinfo/python-list

Re: How to detect what type a variable is?

2006-11-29 Thread Tim Chase
>> I want to know what type is a variable. > > You should try to treat it as a list, catch the exceptions > raise when it is a string (problably ValueError, TypeError ou > Attribute error, depends on what are you doing), and then > treat it as a string. This is the BAFP (better ask for > forgivene

Re: Python Question About Compiling.

2006-11-30 Thread Tim Roberts
s like a compiled program. py2exe is one example. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python spam?

2006-11-30 Thread Tim Peters
[Aahz] >>> Anyone else getting "Python-related" spam? So far, I've seen messages >>> "from" Barry Warsaw and Skip Montanaro (although of course header >>> analysis proves they didn't send it). [Thomas Heller] >> I'm getting spam not only from Barry, but also from myself ;-) with >> forged headers

RE: detecting that a SQL db is running

2006-12-01 Thread Tim Golden
[EMAIL PROTECTED] | Sorry if i did not make myself clear. let me try again. | | I can detect when the db is up and not responding, however, | if the DB does not start at all, my local application hangs. I need to find a | way to determine if the DB has started, that's all. Maybe (and only

Re: v2.3, 2.4, and 2.5's GUI is slow for me

2006-12-02 Thread Tim Roberts
nd the world, and much longer before people actually download the message to their local reader, then an equal amount of time for replies to get back to you. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Video feature

2006-12-02 Thread Tim Roberts
something that will do most of the job, probably in PHP. Is your website already using Python? -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Ensure a variable is divisible by 4

2006-12-04 Thread Tim Chase
> I am sure this is a basic math issue, but is there a better way to > ensure an int variable is divisible by 4 than by doing the following; > > x = 111 > x = (x /4) * 4 > > Just seems a bit clunky to me. You're right...you'll want to read up on the "modulo" operator: if x % 4 <> 0: pri

Re: Video feature

2006-12-04 Thread Tim Roberts
"Lad" <[EMAIL PROTECTED]> wrote: > >Hello Tim, >Thank you for your reply. >Yes, my site uses Python. >Do you have any idea how to add video playing ( video streaming >feature)to my webiste? That's not the hard part. You can use an or tag to play a movie

Re: Video stream server

2006-12-04 Thread Tim Roberts
age. Then you can use your Python web site to create the appropriate HTML. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

RE: Filename too long error

2006-12-05 Thread Tim Golden
[Moqtar] | I am trying to walk a directory and print the file and its modified | time. When the path is longer then 259 characters i get an error | "Filename too long". I guess these is because windows limitation on | path length. | | My code: | [... snip code ...] | | Traceback (most recent

Re: What are python closures realy like?

2006-12-06 Thread Tim Chase
> def foobar(arg1, arg2, arg3): > def helper(arg): > do something with arg1 and argument > def foo(): > do something with arg1 and arg3 and > call helper > def bar(): > do something with arg1 and arg2 > def zoo(

RE: Windows: get owner and group of a file

2006-12-06 Thread Tim Golden
[kai rosenthal] | with ls -l on windows I get | -rw-r--r-- 1 500 everyone 320 Nov 09 09:35 myfile | | How can I get on windows with a standard python 2.2 (without windows | extensions) the information "500" and "everyone" (owner and group)? | Also I cannot use popen('ls -l'). Wow. Python 2.2. No

RE: Windows: get owner and group of a file

2006-12-06 Thread Tim Golden
[Fredrik Lundh] | Tim Golden wrote: | | > Wow. Python 2.2. No extensions. Not even popen (). You don't | > want much, do you? I *think* the answer is that you can't. | | does the "group" concept even exist on Windows ? cannot recall I've | ever seen "

Re: Windows: get owner and group of a file

2006-12-06 Thread Tim Chase
>> with ls -l on windows I get >> -rw-r--r-- 1 500 everyone 320 Nov 09 09:35 myfile > > Are you by any chance running cygwin? That comes with ls, but > windows doesn't. Another alternative might be mounting their Windows-formatted drive from within a *nix-like OS. These permissions are usually

RE: Windows: get owner and group of a file

2006-12-06 Thread Tim Golden
[Duncan Booth] | You can get the owner by doing os.popen('dir /q') and parsing | the output, but it is a string not a number (which I guess is why | stat/lstat can't return a value). Good one; I'd forgotten about that. However, I don't know if the OP's restriction against popen ("ls- l") exten

Re: how to get all the "variables" of a string formating?

2006-12-06 Thread Tim Chase
>> Is there an easy (i.e.: no regex) way to do get the names of all >> parameters? >> >> get_parameters(template) should return ["name", "action"] > > How about: > > class gpHelper: > def __init__(self): > self.names = set() > def __getitem__(self, name): > self.names.add(n

Re: [Python] SMTP server based on Python?

2006-12-06 Thread Tim Roberts
ust passes it to sendmail. Ummm, I'm rather confused as to why you don't just have sendmail do this. After all, that is its primary function: to run as a daemon, listening on port 25, and delivering incoming messages to local mailboxes. -- Tim Roberts, [EMAIL PROTECTED] Providenza & B

Re: how to get all the "variables" of a string formating?

2006-12-07 Thread Tim Chase
> I'd like to see this regex. And make sure it works correctly with this > format string: > > """%(key)s > %%(this is not a key)d > %%%(but this is)f > %%%(%(and so is this)%()%%)u > and don't forget the empty case %()c > but not %%()E > and remember to handle %(new > lines)X correctly >

Re: Why not just show the out-of-range index?

2006-12-07 Thread Tim Chase
>> - because error messages are not debugging tools (better use unit > > Then what are they? Machine-generated poetry? >>> me.__cmp__(gruntbuggly['freddled'].micturations, bee[LURGID].gabbleblotchits[PLURDLED]) == 0 Traceback (most recent call last): File "", line 1, in ? VogonPoetryExcepti

Re: merits of Lisp vs Python

2006-12-08 Thread Tim Chase
> How do you compare Python to Lisp? What specific advantages do you > think that one has over the other? Easy... Python reads like pseudocode Lisp reads like line-noise (much like most Perl or Ruby code) Python makes better use of my time as a programmer because it maps fairly closely to how

RE: Text Encoding - Like Wrestling Oiled Pigs

2006-12-08 Thread Tim Golden
[EMAIL PROTECTED] | I've got a database of information that is encoded in Windows/CP1252. | What I want to do is dump this to a UTF-8 encoded text file (a RSS | feed). | "UnicodeDecodeError: 'ascii' codec can't decode byte 0x92 in position | 163: ordinal not in range(128)" | | So somewhere I'm m

Re: Snake references just as ok as Monty Python jokes/references in python community? :)

2006-12-08 Thread Tim Chase
> I'm semi-seriously wondering if snake jokes are valid in the Python > community since technically, Python came from Monty Python, not > slithery animals. > > Problem is I don't know that anyone born after Elvis died gets any of > these Monty Python jokes. I protest...Elvis isn't dead... ;-) Ev

Re: Why does wx.Window.CaptureMouse() send EVT_PAINT

2006-12-09 Thread Tim Roberts
sure, but I doubt that it is CaptureMouse doing it, and I know the SetCapture API (which it eventually calls) does not. Is it possible that your clicking caused some part of the app to become unhidden, or caused some button to change state? -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boek

Re: wx.Font.GetPointSize returning bogus value?

2006-12-09 Thread Tim Roberts
font depending on your operating system and locale. 74 (0x4A) indicates a vector TrueType font of the "script" family, which is bizarre. May I suggest that you set your own default font before beginning? -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-11 Thread Tim Peters
[Paddy] >> http://en.wikipedia.org/wiki/Doctest [Kaz Kylheku] > I pity the hoplelessly anti-intellectual douche-bag who inflicted this > undergraduate misfeature upon the programming language. As a blind misshapen dwarf, I get far too much pity as it is, but I appreciate your willingness to sha

Re: possible php convert

2006-12-11 Thread Tim Roberts
but it also gives you some great real-world examples of virtually every function. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to do a Http HEAD requests

2006-12-11 Thread Tim Roberts
Soni Bergraj <[EMAIL PROTECTED]> wrote: > >I was just wondering if there is a more convenient way of doing a Http >HEAD requests then the socket module? > >Any ideas? The standard "httplib" module can do that in a half-dozen lines of code. -- Tim Robert

Re: comparing two IP addresses and the underlying machine

2006-12-12 Thread Tim Chase
> I've been trying to figure this one out for some time but > with no success. I have a machine with two network > interfaces, each with their own IP address and it's own > domain, for example: > - ipA on machineA.domainA > - ipB on machineB.domainB > > Given any pair of IPs or hostnames (

Re: not a big deal or anything, but, curiously:

2006-12-12 Thread Tim Peters
[Simon Schuster] > following this tutorial, Which tutorial? > I copied and pasted: > > from string import * > > cds = """atgagtgaacgtctgagcattagctccgtatatcggcgcacaaa > tttcgggtgccgacctgacgcgcccgttaagcgataatcagtttgaacagctttaccatgcggtg > ctgcgccatcaggtggtgtttctacgcgatcaagctattacgccgcagcagca

Re: merits of Lisp vs Python

2006-12-13 Thread tim . peters
[Bill Atkins] >> (Why are people from c.l.p calling parentheses "brackets"?) [Kaz Kylheku] > Because that's what they are often called outside of the various > literate fields. For example, the English are "outside of the various literate fields"? FWIW, Python documentation consistently uses the

RE: pwinauto to remote automate a GUI ?

2006-12-14 Thread Tim Golden
automation code | | Question: Is it possible to start and automate a remote GUI | using Python? One way might be to have something like Pyro (http://pyro.sf.net) running on the remote machine linked to a proxy on the local machine. TJG Tim Golden Senior Analyst

Re: pwinauto to remote automate a GUI ?

2006-12-14 Thread Tim Golden
Tim Golden wrote: [... snip horrendous company-generated sig/disclaimer ...] Sorry about that, folks. We've started using a new server-based sig generation thing so I'll have to start not sending via company email! TJG -- http://mail.python.org/mailman/listinfo/python-list

Re: open a directory in widows

2006-12-14 Thread Tim Golden
Bell, Kevin slcgov.com> writes: > > If I want "C:\temp" to pop open on screen, how do I do it? import os os.startfile (r"c:\temp") -- http://mail.python.org/mailman/listinfo/python-list

Re: remove matching pairs

2006-12-14 Thread Tim Chase
> Is there a simple way to to identify and remove matching pairs from 2 > lists? > > For example: > > I have > > a=[2, 5, 3, 4, 7, 2, 2, 4, 8, 1] > b=[7, 3, 5, 8, 1, 7, 4, 8, 2, 6] > > and I want to get this: > > a=[2, 5, 3, 4, 7, 2, 8, 1] > b=[7, 3, 5, 8, 1, 4, 2, 6] Well, with a few caveats

Need Simple Way To Determine If File Is Executable

2006-12-14 Thread Tim Daneliuk
*nix? Thanks, Tim Daneliuk [EMAIL PROTECTED] PGP Key: http://www.tundraware.com/PGP/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Need Simple Way To Determine If File Is Executable

2006-12-15 Thread Tim Golden
[Tim Daneliuk] > I have a program wherein I want one behavior when a file is > set as executable and a different behavior if it is not. Is > there a simple way to determine whether a given named file is > executable that does not resort to all the lowlevel ugliness > of os.sta

Re: tuple.index()

2006-12-15 Thread Tim Golden
[Christoph Zwerschke] > And can somebody explain what is exactly meant with > "homogenous data"? This seems to have been explained a few times recently :) Basically, if you have a "list of xs" and remove one item from it, it is still a "list of xs", where "xs" might be people, coordinate-pairs, n

Re: I'm looking for an intelligent date conversion module

2006-12-15 Thread Tim Golden
mthorley wrote: > Greetings, I'm looking for a python module that will take a datetime > obj and convert it into relative time in english. > For example: 10 minutes ago, 1 Hour ago, Yesterday, A few day ago, Last > Week, etc For the very little it's worth, I offer the following: http://timgolden.

Re: re pattern for matching JS/CSS

2006-12-15 Thread Tim Chase
>> I've tried >> '' >> but that didn't work properly. I'm fairly basic in my knowledge of >> Python, so I'm still trying to learn re. >> What pattern would work? > > I use re.compile("",re.DOTALL) > for scripts. I strip this out first since my tag stripping re will > strip out script tags as we

Re: Need Simple Way To Determine If File Is Executable

2006-12-15 Thread Tim Daneliuk
Tim Golden wrote: > [Tim Daneliuk] >> I have a program wherein I want one behavior when a file is >> set as executable and a different behavior if it is not. Is >> there a simple way to determine whether a given named file is >> executable that does not resort to all

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

Re: Over my head with descriptors

2006-12-15 Thread Tim Roberts
choices=C_CHOICES) > homezip = Q_Zip("Your zip code?", "homezip", required=True, ) > happy = Q_Bool("Are you happy?", "happy", default=False) > birthday = Q_Date("Your Birthday:", "birthda

Re: Need Simple Way To Determine If File Is Executable

2006-12-15 Thread Tim Roberts
Tim Daneliuk <[EMAIL PROTECTED]> wrote: > >This seems to work, at least approximately: > > os.stat(selected)[ST_MODE] & (S_IXUSR|S_IXGRP|S_IXOTH > >It probably does not catch every single instance of something >that could be considered "executable"

[ANN]: 'twander' 3.204 Released And Available

2006-12-16 Thread Tim Daneliuk
'twander' Version 3.204 is now released and available for download at: http://www.tundraware.com/Software/twander The last public release was 3.195. If you are unfamiliar with this program, see the end of this message for a brief description. --

Re: win32 service

2006-12-16 Thread Tim Williams
On 16/12/06, g.franzkowiak <[EMAIL PROTECTED]> wrote: > Hi everybody, > > have a little problem with a service on Win32. > > I use a TCP server as service, but can't access from an other machine. > Only local access is possible. > > The service starts like this: > > -> myService.py --username user

Re: How to test if two strings point to the same file or directory?

2006-12-16 Thread Tim Chase
> Comparing file system paths as strings is very brittle. Is there a > better way to test if two paths point to the same file or directory > (and that will work across platforms?) os.path.samefile(filename1, filename2) os.path.sameopenfile(fileobject1, fileobject2) -tkc -- htt

Re: How to test if two strings point to the same file or directory?

2006-12-16 Thread Tim Chase
>> Comparing file system paths as strings is very brittle. > > Why do you say that? Are you thinking of something like this? > > /home//user/somedirectory/../file > /home/user/file Or even ~/file > How complicated do you want to get? If you are thinking about aliases, > hard links, sho

Re: How to test if two strings point to the same file or directory?

2006-12-16 Thread Tim Chase
>>> Comparing file system paths as strings is very brittle. Is there a >>> better way to test if two paths point to the same file or directory >>> (and that will work across platforms?) >> os.path.samefile(filename1, filename2) >> os.path.sameopenfile(fileobject1, fileobject2) > > Nice t

Re: How to test if two strings point to the same file or directory?

2006-12-17 Thread Tim Golden
Sandra-24 wrote: > Comparing file system paths as strings is very brittle. Is there a > better way to test if two paths point to the same file or directory > (and that will work across platforms?) I suspect that the "and that will work across platforms" parenthesis is in effect a killer. However,

Re: How to test if two strings point to the same file or directory?

2006-12-17 Thread Tim Chase
> The current setup will not "silently fail when run on win32". How could > it? It doesn't exist; it can't be run. Ah...didn't know which it did (or didn't do) as I don't have a win32 box at hand on which to test it. In chasing the matter further, the OP mentioned that their particular problem

Re: Need Simple Way To Determine If File Is Executable

2006-12-17 Thread Tim Roberts
"Gabriel Genellina" <[EMAIL PROTECTED]> wrote: >On 16 dic, 04:47, Tim Roberts <[EMAIL PROTECTED]> wrote: >> > os.stat(selected)[ST_MODE] & (S_IXUSR|S_IXGRP|S_IXOTH > >>This will tell you that "x.exe" is executable, even if "x.exe&qu

Re: Why there isn't a sort method for array ?

2006-12-17 Thread Tim Roberts
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > >It seems that an array acts like an list very much, except it doesn't >have a method sort. What do you mean by "array"? There is no such beast in the Python language. Do you mean the library module &q

Re: Need Simple Way To Determine If File Is Executable

2006-12-17 Thread Tim Daneliuk
Roger Upole wrote: > Gabriel Genellina wrote: >> On 16 dic, 04:47, Tim Roberts <[EMAIL PROTECTED]> wrote: >>>> os.stat(selected)[ST_MODE] & (S_IXUSR|S_IXGRP|S_IXOTH >>> This will tell you that "x.exe" is executable, even if "x.exe" cont

Re: How to get a substring with variable indices

2006-12-18 Thread Tim Chase
> I have a string named text. I need to extract a substring from it > starting by variable 's' and ending by 'e'. > > text[s:e] generates the following error: > > TypeError: slice indices must be integers or None Your syntax is correct...the error you get back is the clue: either "s" or "e

Re: Need Simple Way To Determine If File Is Executable

2006-12-18 Thread Tim Daneliuk
on defined and run that program if there is. b) If the file *is* "executable", run it. So ... all I really needed to know is whether or not the OS thinks the file is executable. Obvious - and this is true on most any system - you can create the situation where the file appear execu

Re: Need Simple Way To Determine If File Is Executable

2006-12-18 Thread Tim Daneliuk
Gabriel Genellina wrote: > At Monday 18/12/2006 13:41, Tim Daneliuk wrote: > >> I was working on a new release and wanted to add file associations >> to it. That is, if the user selected a file and double clicked or >> pressed Enter, I wanted the following behavior (i

Re: sha, PyCrypto, SHA-256

2006-12-18 Thread Tim Henderson
; > Thank you. I have run that exact installer many many times and it works fine. to use SHA-256 with pycrypto: >>> from Crypto.Hash import SHA256 >>> sha = SHA256.new() >>> sha.update('message') >>> sha.hexdigest() # sha.digest gives the raw form 'ab530a13e45914982b79f9b7e3fba994cfd1f3fb22f71cea1afbf02b460c6d1d' cheers tim -- http://mail.python.org/mailman/listinfo/python-list

[ANN]: 'twander' 3.210 Released And Available

2006-12-19 Thread Tim Daneliuk
(Apologies for two releases in less than a week. It was, um... necessary. This should be it for quite a while barring any notable bug reports.) 'twander' Version 3.210 is now released and available for download at: http://www.tundraware.com/Software/twander The last public release wa

Re: def index(self):

2006-12-19 Thread Tim Roberts
tarted >with, there are a few gotchas. You're above snippet should be: > >class HelloWorld(object): > def index(self): > return "Hello World" > index.exposed = True Many people find it more readable to write that as: class HelloWorld(object): @

Re: a question on python dict

2006-12-20 Thread Tim Peters
[EMAIL PROTECTED] > Python dict is a hash table, isn't it? Yup. > I know that hashtable has the concept of "bucket size" and "min bucket > count" stuff, Some implementations of hash tables do. Python's does not. Python's uses what's called "open addressing" instead. > and they should be confi

Re: Need Simple Way To Determine If File Is Executable

2006-12-21 Thread Tim Roberts
a Windows system, using stat, the definition is "has an extension that is in PATHEXT". Nothing more, nothing less. In both cases, the contents of the file are irrelevant. Now, when you, as a human being, try answer the question "is this file executable", you would use more s

<    32   33   34   35   36   37   38   39   40   41   >