Re: Traversing the properties of a Class

2007-01-18 Thread EdG
That works perfectly thank you. Bruno Desthuilliers wrote: > EdG a écrit : > (top-post corrected) > > > > Neil Cerutti wrote: > > > >>On 2007-01-18, EdG <[EMAIL PROTECTED]> wrote: > >> > >>>For debugging purposes, I would like to traverse the class > >>>listing out all the properties. > >> > >>Thi

Re: import vs. subdirectory search

2007-01-18 Thread gordyt
John try this: from M2Crypto import SSL That should put your SSL module in the namespace as you want. --gordy -- http://mail.python.org/mailman/listinfo/python-list

Re: A note on heapq module

2007-01-18 Thread Steven Bethard
[EMAIL PROTECTED] wrote: > Steven Bethard: >> Antoon Pardon: >>> For me, your class has the same drawback as the heappush, heappop >>> procedurers: no way to specify a comparision function. >> Agreed. I'd love to see something like ``Heap(key=my_key_func)``. > > It can be done, but the code becom

Re: *POLL* How many sheeple believe in the 911 fairy tale and willing to accept an Orwellian doublespeak and enslavement world ?

2007-01-18 Thread st911
[EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] wrote: > [...] > > Ask yourself, how can all these people, supposed physicists, engineers, > software developers, people of supposed intelligence be incapable of > understanding that fire cannot make buildings free fall? How can they > not understand th

Re: Module name to filename and back?

2007-01-18 Thread Ron Adam
Ron Adam wrote: > Is there a function to find a filename from a dotted module (or package) name > without importing it? > > The imp function find_module() doesn't work with dotted file names. And it > looks like it may import the file as it raises an ImportError error exception > if > it ca

Re: Anyone has a nice "view_var" procedure ?

2007-01-18 Thread Stef Mientki
thanks Gabriel > str(key)[7:-2] => key.__name__ I didn't know that one > Nice to see you built a useful tool! It's a great way to learn a language. Yes, and this group is helping me a whole lot, thanks ! cheers, Stef Mientki -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find out if another process is using a file

2007-01-18 Thread Donn Cave
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Nick Maclaren) wrote: > In article <[EMAIL PROTECTED]>, > Donn Cave <[EMAIL PROTECTED]> writes: > |> In article <[EMAIL PROTECTED]>, > |> "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > |> > "Tom Wright" <[EMAIL PROTECTED]> escribió en el mensaj

Re: A note on heapq module

2007-01-18 Thread bearophileHUGS
Steven Bethard wrote: > The current code fails when using unbound methods however:: I don't like your solution, this class was already slow enough. Don't use unbound methods with this class :-) Maybe there's a (better) solution to your problem: to make Heap a function (or classmethod) that return

Re: How to write code to get focuse the application which is open from server

2007-01-18 Thread Mark
Hi, There are better places to find me then on comp.lang.python (just too much traffic for me) pywinauto forums: http://forums.openqa.org/forum.jspa?forumID=15 or subscribe pywinauto mailing list: https://lists.sourceforge.net/lists/listinfo/pywinauto-users vithi wrote: > MatchError: Could not

Re: How to find out if another process is using a file

2007-01-18 Thread Nick Maclaren
In article <[EMAIL PROTECTED]>, Donn Cave <[EMAIL PROTECTED]> writes: |> > |> |> > |> O_EXCL fails if the file exists at all - whether closed or open. |> > |> > Yes. In theory. In practice, it usually works on normal files, provided |> > that all opens are local. Under some circumstances, it

Re: Regex Question

2007-01-18 Thread Bill Mill
Gabriel Genellina wrote: > At Tuesday 16/1/2007 16:36, Bill Mill wrote: > > > > py> import re > > > py> rgx = re.compile('1?') > > > py> rgx.search('a1').groups() > > > (None,) > > > py> rgx = re.compile('(1)+') > > > py> rgx.search('a1').groups() > > > >But shouldn't the ? be greedy, and thus pre

Re: Making a simple script standalone

2007-01-18 Thread Rikishi 42
On Thursday 18 January 2007 10:13, robert wrote: > stay with py23 for "a script" (and more) and make <700kB > independent distros - UPX and 7zip involved: > > http://groups.google.com/group/comp.lang.python/msg/edf469a1b3dc3802 Thanks, that might be an option. But I might just convince the person

Iterator length

2007-01-18 Thread bearophileHUGS
Often I need to tell the len of an iterator, this is a stupid example: >>> l = (i for i in xrange(100) if i&1) len isn't able to tell it: >>> len(l) Traceback (most recent call last): File "", line 1, in TypeError: object of type 'generator' has no len() This is a bad solution, it may need t

Re: A note on heapq module

2007-01-18 Thread Steven Bethard
[EMAIL PROTECTED] wrote: > Steven Bethard wrote: >> The current code fails when using unbound methods however:: > > I don't like your solution, this class was already slow enough. Don't > use unbound methods with this class :-) > Maybe there's a (better) solution to your problem: to make Heap a >

Re: what can be used in a signal handler

2007-01-18 Thread hg
Nick Maclaren wrote: > > In article <[EMAIL PROTECTED]>, > hg <[EMAIL PROTECTED]> writes: > |> > |> I posted an equivalent question earlier ... but am still not sure: > |> > |> I currently (under Linux) have a program that uses Queue.put > |> (raw_input('')) in a signal handler and Queue.get()

Match 2 words in a line of file

2007-01-18 Thread elrondrules
Hi Am pretty new to python and hence this question.. I have file with an output of a process. I need to search this file one line at a time and my pattern is that I am looking for the lines that has the word 'event' and the word 'new'. Note that i need lines that has both the words only and not

Re: A note on heapq module

2007-01-18 Thread Paul Rubin
Steven Bethard <[EMAIL PROTECTED]> writes: > Heap(sequence=None, inplace=False) > KeyedHeap(key, sequence=None) > Of course, this approach ends up with a bunch of code duplication again. Maybe there's a way to use a metaclass that can make either type of heap but they'd share most method

Re: *POLL* How many sheeple believe in the 911 fairy tale and willing to accept an Orwellian doublespeak and enslavement world ?

2007-01-18 Thread schoenfeld . one
[EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] wrote: > > [EMAIL PROTECTED] wrote: > > [...] > > > > Ask yourself, how can all these people, supposed physicists, engineers, > > software developers, people of supposed intelligence be incapable of > > understanding that fire cannot make buildings free

Pass 'this' to a python script in an extended application

2007-01-18 Thread Stou Sandalski
Hi, I have an application consisting of a main C++ class (and other classes) stored inside a DLL. The application uses a small main executable that links against the main DLL, then initializes and runs the core class. The python bindings are inside a .pyd module that also links against the core

Re: Match 2 words in a line of file

2007-01-18 Thread Rickard Lindberg
[EMAIL PROTECTED] wrote: > Hi > > Am pretty new to python and hence this question.. > > I have file with an output of a process. I need to search this file one > line at a time and my pattern is that I am looking for the lines that > has the word 'event' and the word 'new'. > > Note that i need lin

How to pass arguments to the function embedded in the timeit.Timer()

2007-01-18 Thread Dongsheng Ruan
Hi Does anybody know how to pass multiple arguments to the function tested in timeit.timer() in python? I googled and found how to pass one argument: x=1 mytime = timeit.Timer( setup="from Createlst import createlst", stmt= "createlst(%s)"%(x) ) But how can I extend it to two or more

Free Downloads, Wallpapers, Games, Eroticgames, Handy-Logos and much more

2007-01-18 Thread Major27104
-- http://mail.python.org/mailman/listinfo/python-list

Using lambda with a Pmw.ComboBox

2007-01-18 Thread Willie
Hi, I have an array of 2 ComboBoxes. I would like to use lambda to report on which widget is being accessed. When I use arrays of other widgets I just use lambda to return which item I am using as an argument. This does not seem to work with ComboBox, the only thing returned is the value changed.

Re: Iterator length

2007-01-18 Thread George Sakkis
[EMAIL PROTECTED] wrote: > Often I need to tell the len of an iterator, this is a stupid example: > > >>> l = (i for i in xrange(100) if i&1) > > len isn't able to tell it: > > >>> len(l) > Traceback (most recent call last): > File "", line 1, in > TypeError: object of type 'generator' has no l

Re: *POLL* How many sheeple believe in the 911 fairy tale and willing to accept an Orwellian doublespeak and enslavement world ?

2007-01-18 Thread MRAB
David Bostwick wrote: > In article <[EMAIL PROTECTED]>, "Robert Hicks" <[EMAIL PROTECTED]> wrote: > >Please, none of the real facts points to anything else except what > >actually happened. Two planes hit two towers and they came down. > > > > You're talking to the wind. This is a conspiracy prec

Re: Iterator length

2007-01-18 Thread bearophileHUGS
George Sakkis: > Is this a rhetorical question ? If not, try this: It wasn't a rhetorical question. > >>> x = (i for i in xrange(100) if i&1) > >>> if leniter(x): print x.next() What's your point? Maybe you mean that it consumes the given iterator? I am aware of that, it's written in the functi

Re: Using lambda with a Pmw.ComboBox

2007-01-18 Thread James Stroud
Willie wrote: > Hi, > > I have an array of 2 ComboBoxes. I would like to use lambda to report > on which widget is being accessed. When I use arrays of other widgets I > just use lambda to return which item I am using as an argument. This > does not seem to work with ComboBox, the only thing retur

Determining when a file is an Open Office Document

2007-01-18 Thread tubby
Silly question, but here goes... what's a good way to determine when a file is an Open Office document? I could look at the file extension, but it seems there would be a better way. VI shows this info in the files: mimetypeapplication/vnd.oasis.opendocument.textPK mimetypeapplication/vnd.oasis.o

Re: Iterator length

2007-01-18 Thread Ben Finney
[EMAIL PROTECTED] writes: > But sometimes you don't need the elements of a given iterator, you > just need to know how many elements it has. AFAIK, the iterator protocol doesn't allow for that. Bear in mind, too, that there's no way to tell from outside that an iterater even has a finite length;

Re: Determining when a file is an Open Office Document

2007-01-18 Thread Ben Finney
tubby <[EMAIL PROTECTED]> writes: > Silly question, but here goes... what's a good way to determine when > a file is an Open Office document? I could look at the file > extension, but it seems there would be a better way. Yes, the name of a file may be useful for communicating with humans about t

Re: Using lambda with a Pmw.ComboBox

2007-01-18 Thread Willie
I will post a sample tomorrow AM. James Stroud wrote: > Can you show us your code? Your question is ambiguous to me. Comboboxes > do not hold widgets but display text. -- http://mail.python.org/mailman/listinfo/python-list

Re: Determining when a file is an Open Office Document

2007-01-18 Thread Ross Ridge
tubby wrote: > Silly question, but here goes... what's a good way to determine when a > file is an Open Office document? I could look at the file extension, but > it seems there would be a better way. VI shows this info in the files: > > mimetypeapplication/vnd.oasis.opendocument.textPK It's a ZIP

Re: Determining when a file is an Open Office Document

2007-01-18 Thread Ross Ridge
tubby wrote: > Silly question, but here goes... what's a good way to determine when a > file is an Open Office document? I could look at the file extension, but > it seems there would be a better way. VI shows this info in the files: > > mimetypeapplication/vnd.oasis.opendocument.textPK It's a ZIP

Re: Match 2 words in a line of file

2007-01-18 Thread MrJean1
Without using re, this may work (untested ;-): def lines_with_words(file, word1, word2): """Print all lines in file that have both words in it.""" for line in file: words = line.split() if word1 in words and word2 in words: print line /Jean Brouwers Rickard

Re: Match 2 words in a line of file

2007-01-18 Thread bearophileHUGS
MrJean1 wrote: > def lines_with_words(file, word1, word2): > """Print all lines in file that have both words in it.""" > for line in file: > words = line.split() > if word1 in words and word2 in words: > print line This sounds better, it's probably faster than t

Re: More M2Crypto issues

2007-01-18 Thread Gabriel Genellina
At Thursday 18/1/2007 04:41, John Nagle wrote: I've been running M2Crypto successfully using Python 2.4 on Windows 2000, and now I'm trying to get it to work on Python 2.3.4 on Linux. Attempting to initialize a context results in Traceback (most recent call last): File "/www/htdocs/si

Re: Match 2 words in a line of file

2007-01-18 Thread Rickard Lindberg
I see two potential problems with the non regex solutions. 1) Consider a line: "foo (bar)". When you split it you will only get two strings, as split by default only splits the string on white space characters. Thus "'bar' in words" will return false, even though bar is a word in that line. 2) If

subclassing pyrex extension types in python

2007-01-18 Thread Nitin
Hi All I am trying to subclass an extension type in Python and add attributes to the new class but I keep getting errors. I read the "Extension Types" document on the Pyrex website but I couldn't get an answer from it. Here's the Spam extension type from Pyrex website: cdef class Spam: cdef i

Re: Making a simple script standalone

2007-01-18 Thread Ravi Teja
On Jan 18, 2:19 pm, Rikishi 42 <[EMAIL PROTECTED]> wrote: > On Thursday 18 January 2007 10:13, robert wrote: > > > stay with py23 for "a script" (and more) and make <700kB > > independent distros - UPX and 7zip involved: > > >http://groups.google.com/group/comp.lang.python/msg/edf469a1b3dc3802Tha

Re: Anyone has a nice "view_var" procedure ?

2007-01-18 Thread Gabriel Genellina
At Thursday 18/1/2007 19:24, Stef Mientki wrote: > str(key)[7:-2] => key.__name__ I didn't know that one It's here: http://docs.python.org/lib/specialattrs.html -- Gabriel Genellina Softlab SRL __ Pregun

Re: Iterator length

2007-01-18 Thread Gabriel Genellina
At Thursday 18/1/2007 20:26, [EMAIL PROTECTED] wrote: def leniter(iterator): """leniter(iterator): return the length of an iterator, consuming it.""" if hasattr(iterator, "__len__"): return len(iterator) nelements = 0 for _ in iterator: nelements += 1 retu

Re: Determining when a file is an Open Office Document

2007-01-18 Thread tubby
Ross Ridge wrote: > tubby wrote: >> Silly question, but here goes... what's a good way to determine when a >> file is an Open Office document? I could look at the file extension, but >> it seems there would be a better way. VI shows this info in the files: >> >> mimetypeapplication/vnd.oasis.opendo

Re: How to pass arguments to the function embedded in the timeit.Timer()

2007-01-18 Thread Gabriel Genellina
At Thursday 18/1/2007 21:31, Dongsheng Ruan wrote: Does anybody know how to pass multiple arguments to the function tested in timeit.timer() in python? I googled and found how to pass one argument: x=1 mytime = timeit.Timer( setup="from Createlst import createlst", stmt= "createlst(%

Why this script can work?

2007-01-18 Thread Jm lists
Please help with this script: class ShortInputException(Exception): '''A user-defined exception class.''' def __init__(self,length,atleast): Exception.__init__(self) self.length=length self.atleast=atleast try: s=raw_input('E

Re: Why this script can work?

2007-01-18 Thread Robert Kern
Jm lists wrote: > Please help with this script: > > class ShortInputException(Exception): > '''A user-defined exception class.''' > def __init__(self,length,atleast): > Exception.__init__(self) > self.length=length > self.atleast=atle

selective logger disable/enable

2007-01-18 Thread Gary Jefferson
Suppose I have 3 modules that belong to a project, 'A', 'A.a' and 'B', and each module has its own logger, created with: module1logger = logging.getLogger('project.A') and module2logger = logging.getLogger('project.A.a') and module3logger = logging.getLogger('project.B') And I want to select

<    1   2