Re: unittest and threading

2012-01-24 Thread Steven D'Aprano
On Tue, 24 Jan 2012 13:54:23 -0800, Ross Boylan wrote: > Is it safe to use unittest with threads? I see nobody else has answered, so I'll have a go. I think you need to explain what you mean here in a little more detail. If you mean, "I have a library that uses threads internally, and I want t

Re: Libxml2 Python Manual

2012-01-24 Thread Stefan Behnel
Mauricio Martinez Garcia, 25.01.2012 02:46: > For libxml2, are there any manual. For this library?, i searched on > google and just find the following URL xmlsoft.org > Wich can not find any API manual. I will apreciate your support if have one > for the library in python. Any reason you're not

Re: Distributing methods of a class across multiple files

2012-01-24 Thread Cameron Simpson
On 24Jan2012 19:54, lh wrote: | Is this possible please? I have done some searching but it is hard to | narrow down Google searches to this question. What I would like to do | is, for example: | 1) define a class Foo in file test.py... give it some methods | 2) define a file test2.py which contai

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-24 Thread Michael Torrie
On 01/24/2012 10:49 PM, Michael Torrie wrote: > On 01/24/2012 05:43 PM, Rick Johnson wrote: >> Actually my custom script had a small flaw which kept it from >> capturing ALL the atrocities. Here is a run with the bugfixes: > > Wow. I had to trim 80% of your e-mail just to get rid of old quoted > p

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-24 Thread Michael Torrie
On 01/24/2012 05:43 PM, Rick Johnson wrote: > Actually my custom script had a small flaw which kept it from > capturing ALL the atrocities. Here is a run with the bugfixes: Wow. I had to trim 80% of your e-mail just to get rid of old quoted posts. For an expert, Rick, I'm really surprised you don

Re: Distributing methods of a class across multiple files

2012-01-24 Thread Roy Smith
In article <569a94a3-cd84-449b-b0c1-80348014a...@i10g2000pbl.googlegroups.com>, lh wrote: > Is this possible please? I have done some searching but it is hard to > narrow down Google searches to this question. What I would like to do > is, for example: > 1) define a class Foo in file test.py..

Re: Libxml2 Python Manual

2012-01-24 Thread Mauricio Martinez Garcia
Tanks Nicholas. Yes, check the documentation effectively and yet it does not require C programminginformation if not for python, the only site I found examples and libxml2 for python propertiesis as follows http://mikekneller.com/kb/python/libxml2python / part1. And, apart from there to build a c

Distributing methods of a class across multiple files

2012-01-24 Thread lh
Is this possible please? I have done some searching but it is hard to narrow down Google searches to this question. What I would like to do is, for example: 1) define a class Foo in file test.py... give it some methods 2) define a file test2.py which contains a set of methods that are methods of c

Re: Libxml2 Python Manual

2012-01-24 Thread Nick Dokos
Mauricio Martinez Garcia wrote: >   For libxml2, are there any manual. For this library?, i searched on > google and just find the following URL xmlsoft.org Wich can not find > any API manual. > Did you check under "Reference Manual" at http://xmlsoft.org? That's the second entry in the Main Me

Libxml2 Python Manual

2012-01-24 Thread Mauricio Martinez Garcia
Hello! For libxml2, are there any manual. For this library?, i searched on google and just find the following URL xmlsoft.org Wich can not find any API manual. I will apreciate your support if have one for the library in python. -- http://mail.python.org/mailman/listinfo/python-list

Re: The devolution of English language and slothful c.l.p behaviours exposed!

2012-01-24 Thread Blockheads Oi Oi
Top posting fixed. -Original Message- From: Blockheads Oi Oi [mailto:breamore...@yahoo.co.uk] Sent: Wednesday, 25 January 2012 10:26 a.m. To: python-list@python.org Subject: Re: The devolution of English language and slothful c.l.p behaviors exposed! On 24/01/2012 21:20, Chris Angelico

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-24 Thread Rick Johnson
On Jan 23, 11:57 pm, Rick Johnson wrote: > Here is a grep from the month of September 2011 showing the rampantly > egregious misuse of the following words and phrases: Actually my custom script had a small flaw which kept it from capturing ALL the atrocities. Here is a run with the bugfixes: p

RE: The devolution of English language and slothful c.l.p behaviours exposed!

2012-01-24 Thread Phil Runciman
"Talking" about version numbers, shouldn't the English dictionary and grammar be under version control? I nominate Oxford University to administer this, after all they produce the largest English dictionary and are experts on English grammar. Someone had better let them know because the impendin

unittest and threading

2012-01-24 Thread Ross Boylan
Is it safe to use unittest with threads? In particular, if a unit test fails in some thread other than the one that launched the test, will that information be captured properly? A search of the net shows a suggestion that all failures must be reported in the main thread, but I couldn't find anyt

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-24 Thread Blockheads Oi Oi
On 24/01/2012 21:20, Chris Angelico wrote: On Wed, Jan 25, 2012 at 8:13 AM, Blockheads Oi Oi wrote: On 24/01/2012 20:03, Joshua Landau wrote: A simple version number doesn't imply huge breakages. Try "English2 v1.0"! In fact, why would a perfect language need a version number? It would be

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-24 Thread Chris Angelico
On Wed, Jan 25, 2012 at 8:13 AM, Blockheads Oi Oi wrote: > On 24/01/2012 20:03, Joshua Landau wrote: >> A simple version number doesn't imply huge breakages. Try "English2 v1.0"! >> >> In fact, why would a perfect language need a version number? >> > It would be difficult to maintain Python withou

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-24 Thread Blockheads Oi Oi
On 24/01/2012 20:03, Joshua Landau wrote: On 24 January 2012 17:25, Blockheads Oi Oi mailto:breamore...@yahoo.co.uk>> wrote: On 24/01/2012 15:46, Andrea Crotti wrote: I suggest to create English 2.0, and convince the whole world to speak your own way better i

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-24 Thread Joshua Landau
On 24 January 2012 17:25, Blockheads Oi Oi wrote: > On 24/01/2012 15:46, Andrea Crotti wrote: > >> I suggest to create English 2.0, and convince the whole world to speak >> your own >> way better implementation of English. >> > > Too late for that when comparing modern English with that of e.g. D

Re: dynamically creating classes from text

2012-01-24 Thread Visgean Skeloru
As I assume the text you want to process has some source you might want to look at http://docs.python.org/library/pickle.html ... 2012/1/24 T H > I’m new to python, sorry if my question is a bit naive, I was > wondering if it is possible to parse some text (ie. from a text file > or say html) an

Re: dynamically creating classes from text

2012-01-24 Thread Marco Nawijn
On Jan 24, 6:22 pm, T H wrote: > I’m new to python, sorry if my question is a bit naive, I was > wondering if it is possible to parse some text (ie. from a text file > or say html) and then dynamically create a class? > > for example lets say the contents of the text file is: > >      functionName

Re: problems with tkinter updates

2012-01-24 Thread woooee
if line is not None: probably does not work the way you expect. You might try if line.strip(): Take a look at this quick example test_lines = ["Number 1\n", "\n", ""] for ctr, line in enumerate(test_lines): print ctr, line if line is not None: print " not None" -- http://mai

calling a simple PyQt application more than once

2012-01-24 Thread Jabba Laci
Hi, I have a simple PyQt application that creates a webkit instance to scrape AJAX web pages. It works well but I can't call it twice. I think the application is not closed correctly, that's why the 2nd call fails. Here is the code below. I also put it on pastebin: http://pastebin.com/gkgSSJHY .

Re: dynamically creating classes from text

2012-01-24 Thread Chris Angelico
On Wed, Jan 25, 2012 at 4:22 AM, T H wrote: > I’m new to python, sorry if my question is a bit naive, I was > wondering if it is possible to parse some text (ie. from a text file > or say html) and then dynamically create a class? Presuming that your class name comes from somewhere (eg the name o

Re: How to work around a unicode problem?

2012-01-24 Thread tinnews
Chris Rebert wrote: > On Tue, Jan 24, 2012 at 3:57 AM, wrote: > > I have a small python program that uses the pyexiv2 package to view > > exif data in image files. > > > > I've hit a problem because I have a filename with accented characters > > in its path and the pyexiv2 code traps as follows:

Re: How to work around a unicode problem?

2012-01-24 Thread tinnews
Peter Otten <__pete...@web.de> wrote: > tinn...@isbd.co.uk wrote: > > > I have a small python program that uses the pyexiv2 package to view > > exif data in image files. > > > > I've hit a problem because I have a filename with accented characters > > in its path and the pyexiv2 code traps as fol

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-24 Thread Blockheads Oi Oi
On 24/01/2012 15:46, Andrea Crotti wrote: I suggest to create English 2.0, and convince the whole world to speak your own way better implementation of English. Too late for that when comparing modern English with that of e.g. Dickens, Shakespeare, Chaucer and Bede, hence at a minimum I reckon

dynamically creating classes from text

2012-01-24 Thread T H
I’m new to python, sorry if my question is a bit naive, I was wondering if it is possible to parse some text (ie. from a text file or say html) and then dynamically create a class? for example lets say the contents of the text file is: functionName: bark arg1: numberBarks functionName:

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-24 Thread Blockheads Oi Oi
On 24/01/2012 16:41, Chris Angelico wrote: On Wed, Jan 25, 2012 at 3:26 AM, Martin P. Hellwig wrote: Having said that, I do like to bring to your attention that her Majesty, never ratified the 'Declaration of Independence'. :-) Oh, stop it. It's high time we got rid of these silly distincti

Re: windows and home path

2012-01-24 Thread Andrea Crotti
On 01/24/2012 04:43 PM, Chris Angelico wrote: On Wed, Jan 25, 2012 at 3:36 AM, Andrea Crotti wrote: I just would like to be able to write somewhere in a place that should always exist, why Windows you're so annoying :(? Can you use the current directory, and rely on the user running your prog

Re: windows and home path

2012-01-24 Thread Chris Angelico
On Wed, Jan 25, 2012 at 3:36 AM, Andrea Crotti wrote: > I just would like to be able to write somewhere in a place that should > always exist, > why Windows you're so annoying :(? Can you use the current directory, and rely on the user running your program from a viable default? ChrisA -- http:

Re: What happened tp scipy.stsci?

2012-01-24 Thread Eelco
On Jan 23, 6:54 pm, Wanderer wrote: > Back in scipy 0.7 there was a package called stsci that had  function > scipy.stsci.image.median that created a median image from a stack of > images. The stsci package is dropped in v0.8. Has this functionality > been moved to a different package? > > Thanks

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-24 Thread Chris Angelico
On Wed, Jan 25, 2012 at 3:26 AM, Martin P. Hellwig wrote: > Having said that,  I do like to bring to your attention that her Majesty, > never ratified the 'Declaration of Independence'. :-) Oh, stop it. It's high time we got rid of these silly distinctions of English and American. Rick's right -

Re: windows and home path

2012-01-24 Thread Andrea Crotti
On 01/24/2012 04:21 PM, Jerry Hill wrote: windows might make the trick.. It would not do the trick on my windows XP workstation here. Your target environments may be different, of course. From a general command prompt (cmd.exe) on my work machine, here's what you would have to work with: HOME

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-24 Thread Martin P. Hellwig
On 24/01/2012 14:51, J wrote: On Tue, Jan 24, 2012 at 09:05, Martin P. Hellwig wrote: On 24/01/2012 05:57, Rick Johnson wrote: I would wish that pedantic citizens of the British colony in America stopped calling whatever misinterpreted waffle they produce, English. I, sir, as a citizen of t

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-24 Thread Steven D'Aprano
On Tue, 24 Jan 2012 09:21:37 +0100, Jérôme wrote: > Mon, 23 Jan 2012 21:57:16 -0800 (PST) Rick Johnson a écrit: >> Of course, "used to" and "supposed to" will require people to rethink >> there lazy and slothful ways. > > I don't even see the problem with those... > > As someone already said,

Re: windows and home path

2012-01-24 Thread Andrea Crotti
On 01/24/2012 04:09 PM, Jerry Hill wrote: On Tue, Jan 24, 2012 at 11:05 AM, Jerry Hill wrote: So, my guess is that emacs is mangling your HOME environment variable. That appears to be confirmed by the emacs documentation here: http://www.gnu.org/software/emacs/manual/html_node/emacs/General-V

Re: windows and home path

2012-01-24 Thread Jerry Hill
On Tue, Jan 24, 2012 at 11:10 AM, Andrea Crotti wrote: > Ah yes thanks for the explanation, on Python 2.7 on Linux I don't see > the same doc, it might have been updated later.. > Anyway I just want to make sure that I get always the same path, > not depending on the program. > > From a first look

Re: windows and home path

2012-01-24 Thread Andrea Crotti
On 01/24/2012 04:09 PM, Jerry Hill wrote: On Tue, Jan 24, 2012 at 11:05 AM, Jerry Hill wrote: So, my guess is that emacs is mangling your HOME environment variable. That appears to be confirmed by the emacs documentation here: http://www.gnu.org/software/emacs/manual/html_node/emacs/General-V

Re: windows and home path

2012-01-24 Thread Andrea Crotti
On 01/24/2012 04:05 PM, Jerry Hill wrote: The os.path.exanduser() docs ( http://docs.python.org/library/os.path.html#os.path.expanduser ) say that "On Windows, HOME and USERPROFILE will be used if set, otherwise a combination of HOMEPATH and HOMEDRIVE will be used. An initial ~user is handled by

Re: windows and home path

2012-01-24 Thread Jerry Hill
On Tue, Jan 24, 2012 at 11:05 AM, Jerry Hill wrote: > So, my guess is that emacs is mangling your HOME environment variable. >  That appears to be confirmed by the emacs documentation here: > http://www.gnu.org/software/emacs/manual/html_node/emacs/General-Variables.html#General-Variables I know,

Re: windows and home path

2012-01-24 Thread Jerry Hill
On Tue, Jan 24, 2012 at 9:56 AM, Andrea Crotti wrote: > Window never stops to surprise me, I've been banging my head since yesterday > and only > now I now what is the problem. > > So suppose I have something like > > from os import path > print path.expanduser('~') > > If I run it from cmd.exe I

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-24 Thread Andrea Crotti
I suggest to create English 2.0, and convince the whole world to speak your own way better implementation of English. -- http://mail.python.org/mailman/listinfo/python-list

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-24 Thread Benedict Verheyen
On 24/01/2012 7:06, Steven D'Aprano wrote: > On Mon, 23 Jan 2012 21:57:16 -0800, Rick Johnson wrote: > >> Here is a grep from the month of September 2011 showing the rampantly >> egregious misuse of the following words and phrases: >> >> * pretty >> * hard >> * right >> * used to >> * supposed to

RE: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-24 Thread Neru Yume
Wh. I did not expect this when I signed up to the Python mailing list. > From: dreadpiratej...@gmail.com > Date: Tue, 24 Jan 2012 09:51:57 -0500 > Subject: Re: The devolution of English language and slothful c.l.p behaviors > exposed! > To: martin.hell...@gmail.com > CC: python-list@python.

windows and home path

2012-01-24 Thread Andrea Crotti
Window never stops to surprise me, I've been banging my head since yesterday and only now I now what is the problem. So suppose I have something like from os import path print path.expanduser('~') If I run it from cmd.exe I get /Users/user, doing the same in an emacs eshell buffer I get /Use

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-24 Thread J
On Tue, Jan 24, 2012 at 09:05, Martin P. Hellwig wrote: > On 24/01/2012 05:57, Rick Johnson wrote: > > I would wish that pedantic citizens of the British colony in America stopped > calling whatever misinterpreted waffle they produce, English. I, sir, as a citizen of that FORMER British colony h

PythonWin debugger holds onto global logging objects too long

2012-01-24 Thread Rob Richardson
I use PythonWin to debug the Python scripts we write. Our scripts often use the log2py logging package. When running the scripts inside the debugger, we seem to get one logging object for every time we run the script. The result is that after running the script five times, the log file contai

RE: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-24 Thread Rob Richardson
"In America, they haven't spoken it for years!" -- Professor Henry Higgins, "My Fair Lady" -Original Message- On 24/01/2012 05:57, Rick Johnson wrote: I would wish that pedantic citizens of the British colony in America stopped calling whatever misinterpreted waffle they produce, Englis

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-24 Thread Martin P. Hellwig
On 24/01/2012 05:57, Rick Johnson wrote: I would wish that pedantic citizens of the British colony in America stopped calling whatever misinterpreted waffle they produce, English. -- mph -- http://mail.python.org/mailman/listinfo/python-list

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-24 Thread Grant Edwards
On 2012-01-24, Chris Angelico wrote: > On Tue, Jan 24, 2012 at 4:57 PM, Rick Johnson > wrote: >> >> >> [RR's usual schtick] > All in favour, say "Aye" in Latin. All against, say "Plonk". I plonked RR ages ago. Now I only get to see his post when somebody replies to him. -- Grant Edwards

Re: Parsing a serial stream too slowly

2012-01-24 Thread Thomas Rachel
Am 24.01.2012 00:13 schrieb Thomas Rachel: [sorry, my Thunderbird kills the indentation] And finally, you can make use of re.finditer() resp. sensorre.finditer(). So you can do sensorre = re.compile(r'\$(.)(.*?)\$') # note the change theonebuffer = '$A1234$$B-10$$C987$' # for now sensorresult

Re: How to work around a unicode problem?

2012-01-24 Thread Peter Otten
tinn...@isbd.co.uk wrote: > I have a small python program that uses the pyexiv2 package to view > exif data in image files. > > I've hit a problem because I have a filename with accented characters > in its path and the pyexiv2 code traps as follows:- > > Traceback (most recent call last): >

Re: How to work around a unicode problem?

2012-01-24 Thread Chris Rebert
On Tue, Jan 24, 2012 at 3:57 AM, wrote: > I have a small python program that uses the pyexiv2 package to view > exif data in image files. > > I've hit a problem because I have a filename with accented characters > in its path and the pyexiv2 code traps as follows:- > >    Traceback (most recent c

How to work around a unicode problem?

2012-01-24 Thread tinnews
I have a small python program that uses the pyexiv2 package to view exif data in image files. I've hit a problem because I have a filename with accented characters in its path and the pyexiv2 code traps as follows:- Traceback (most recent call last): File "/home/chris/bin/eview.py", lin

Re: Parsing a serial stream too slowly

2012-01-24 Thread Ulrich Eckhardt
Am 23.01.2012 22:48, schrieb M.Pekala: I think that regex is too slow for this operation, but I'm uncertain of another method in python that could be faster. A little help would be appreciated. Regardless of the outcome here, I would say that your code is still a bit wonky on the handling of p

Re: A way to write properties

2012-01-24 Thread HEK
On Jan 23, 12:45 pm, Arnaud Delobelle wrote: > Hi all, > > It just occurred to me that there's a very simple but slightly > different way to implement properties: > > class PropertyType(type): >     def __get__(self, obj, objtype): >         return self if obj is None else self.get(obj) >     def

Re: problems with tkinter updates

2012-01-24 Thread Peter Otten
y...@zioup.com wrote: > > I'm missing something about tkinter updates. How can I give tkinter a > chance to run? > > Here's some code: > > import time > import tkinter > import tkinter.scrolledtext > > tk = tkinter.Tk() > f = tkinter.Toplevel(tk) > st = tkinter.scrolledtext.ScrolledText(f) > s

FYI: Making python.exe capable to work with 3GiB address space

2012-01-24 Thread Thomas Rachel
Hi, I just added some RAM to my PC @ work and now wanted Python to be capable to make use of it. My boot.ini has been containing the /3GB switch for quite a while, but nevertheless I only could allocate 2 GB in Python. So I changed python.exe with the imagecfg.exe which I obtained from htt

Re: String interning in Python 3 - missing or moved?

2012-01-24 Thread Chris Rebert
On Tue, Jan 24, 2012 at 12:17 AM, Stefan Behnel wrote: > Chris Angelico, 24.01.2012 05:47: >> Lua and Pike both quite happily solved hash collision attacks in their >> interning of strings by randomizing the hash used, because there's no >> way to rely on it. Presumably (based on the intern() docs

Re: String interning in Python 3 - missing or moved?

2012-01-24 Thread Chris Angelico
On Tue, Jan 24, 2012 at 7:17 PM, Stefan Behnel wrote: > If you want to encourage them to fill up their memory with user provided > data in a non-erasable way, then sure, that would certainly keep an > attacker from having to figure out hash collisions in order to bring down a > system. Sending *an

Re: [GENERAL] [RFE] auto ORDER BY for SELECT

2012-01-24 Thread Chris Angelico
Whoops. Wrong list. *sigh* At least there's some variety - it's not Savoynet this time. Disregard the mad guy in the corner, he's not saying anything useful anyway... ChrisA On Tue, Jan 24, 2012 at 7:29 PM, Chris Angelico wrote: > On Mon, Jan 23, 2012 at 11:17 PM, Douglas Eric wrote: >> I

Re: [GENERAL] [RFE] auto ORDER BY for SELECT

2012-01-24 Thread Chris Angelico
On Mon, Jan 23, 2012 at 11:17 PM, Douglas Eric wrote: > I suggest to change this behavior. If one makes a SELECT statement without > any ORDER BY, it would be > clever to automatically sort by the first primary key found in the query, if > any. > The present behavior would still be used in case of

Re: Parsing a serial stream too slowly

2012-01-24 Thread Cameron Simpson
On 24Jan2012 05:08, Steven D'Aprano wrote: | On Tue, 24 Jan 2012 10:49:41 +1100, Cameron Simpson wrote: | | > | def OnSerialRead(self, event): | > | text = event.data | > | self.sensorabuffer = self.sensorabuffer + text | > | self.sensorbbuffer = self.sensorbbuffer + text | > | self.se

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-24 Thread Jérôme
Mon, 23 Jan 2012 21:57:16 -0800 (PST) Rick Johnson a écrit: > "Pretty" is the most ludicrous of them all! As you will see, "pretty" > is used superfluously, over and over again! In fact, you could safely omit > "pretty" without sacrificing any meaning of most all the sentences that > include the w

Re: String interning in Python 3 - missing or moved?

2012-01-24 Thread Stefan Behnel
Chris Angelico, 24.01.2012 05:47: > Lua and Pike both quite happily solved hash collision attacks in their > interning of strings by randomizing the hash used, because there's no > way to rely on it. Presumably (based on the intern() docs) Python can > do the same, if you explicitly intern your str

Re: Looking under Python's hood: Will we find a high performance or clunky engine?

2012-01-24 Thread Chris Angelico
On Tue, Jan 24, 2012 at 5:44 PM, alex23 wrote: > On Jan 24, 4:56 am, 8 Dihedral > wrote: >> I know manny python programmers just abandon the list comprehension >> in non-trivial processes. > > Really? Observation of the python mailing list indicates the opposite: > people seem inclined to use