Re: ctypes error on Windows

2008-09-04 Thread Fredrik Lundh
Fredrik Lundh wrote: I do have the tidy.dll installed (if I didn't, I couldn't even import the tidy module). typing the following into the Python interpreter might give you some more clues: >>> import _tidy >>> _tidy.__file__ >>> dir(_tidy) or not, since ctypes is involved. h

Re: "Full" element tag listing possible with Elementtree?

2008-09-04 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: this is node b this is node c this is node e this is node f I would want to print the following: text: this is node b text: this is node c text: this is node e this is node f Is there a simple way to do this? Any help

Re: ctypes error on Windows

2008-09-04 Thread Fredrik Lundh
Mike Hostetler wrote: I'm working on a script with the most excellent uTibyLib library. The script works just fine on Mac, but on Windows I get this: File "findtables.py", line 82, in cleanHTML return str(tidy.parseString(decentDoc)) File "c:\Python24\Lib\site-packages\tidy\lib.py", lin

Re: Case-insensitive string compare?

2008-09-04 Thread Fredrik Lundh
Maric Michaud wrote: > You''ll often see for loops written like this : for i in (e for e in iterable if predicate(e)) : ... luckily, I don't. most people, when faced with that problem, writes it in the obvious way: for i in iterable: if predicate(i): ... to avoid

"Full" element tag listing possible with Elementtree?

2008-09-04 Thread jaime . dyson
Hello all, I have the unenviable task of turning about 20K strangely formatted XML documents from different sources into something resembling a clean, standard, uniform format. I like Elementtree and have been using it to step through the documents to get a feel for their structure. .getiterator

Re: Case-insensitive string compare?

2008-09-04 Thread Fredrik Lundh
Maric Michaud wrote: "premature optimization is the root of all evil" So is use by that statement by people who don't have the slightest idea about what it actually means. The full version is "We should forget about small efficiencies, say about 97% of the time: premature optimization is

Creating directories

2008-09-04 Thread srinivasan srinivas
Can someone tell me is there any module available to create directories?? I tried os, tempfile. I was facing some issues with os.mkdir(). The mode setting was not proper with this method. I created the directory 'stdin' with '0700' mode using os.mkdir() method. $> ls -alR stdin/ stdin/: total 12

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

2008-09-04 Thread Marco Bizzarri
On Thu, Sep 4, 2008 at 8:59 PM, Carl Banks <[EMAIL PROTECTED]> wrote: > > > You can write code to guard against this if you want: > > class A: >legal = set(["x"]) >def __setattr__(self,attr,val): >if attr not in self.legal: >raise AttributeError("A object has no attribut

Re: xml + mmap cross

2008-09-04 Thread Stefan Behnel
Hi, this discussion seems pretty much off-topic for a Python list. castironpi wrote: > In an XML file, entries are stored in serial, sort of like this. > > AAA BBB CCC DDD > > Or more recognizably, > > somethingsomething > > Point is, to change something to something else, you > have to recop

Re: Help needed to freeze a script.

2008-09-04 Thread Gabriel Genellina
En Thu, 04 Sep 2008 14:11:45 -0300, LB <[EMAIL PROTECTED]> escribi�: Do you know if py2exe executable embedding a lot of C extensions - like numpy and scipy - can ben executed on another computer, with a different architecture (64bits vs 32 bits) and a different OS ? Forget it, Jake. -- Gabri

Re: Curious: 2134 2004-10-06 08:55:20Z fredrik

2008-09-04 Thread Gabriel Genellina
En Fri, 05 Sep 2008 00:13:28 -0300, Akathorn Greyhat <[EMAIL PROTECTED]> escribi�: I had an import error and I get this error: Traceback (most recent call last): File "C:\Eclipse\pyworkspace\CodenameRazor0.2\src\app.py", line 11, in import core File "C:\Python25\lib\site-packages\PIL\

Re: Converting .doc to .txt in Linux

2008-09-04 Thread Carl Banks
On Sep 4, 4:18 pm, Tommy Nordgren <[EMAIL PROTECTED]> wrote: > On Sep 4, 2008, at 9:54 PM, [EMAIL PROTECTED] wrote: > > > > > Hi Everyone, > > > I had previously asked a similar question, > >http://groups.google.com/group/comp.lang.python/browse_thread/thread/... > > > but at that point I was using

Re: Is it possible to download only the of a web page?

2008-09-04 Thread Gabriel Genellina
En Thu, 04 Sep 2008 18:53:33 -0300, Fredrik Lundh <[EMAIL PROTECTED]> escribi�: Rex wrote: I am writing a script that executes a bunch of queries through a form on a website and reads the results. I am only interested in the section in the of each web page. Currently, each page the server

Re: pdb bug and questions

2008-09-04 Thread Gabriel Genellina
En Thu, 04 Sep 2008 18:22:50 -0300, Stef Mientki <[EMAIL PROTECTED]> escribió: (Sorry, I cannot help you with your main question) When I launch the debugger ( winXP, Python 2.5) from with my editor python -u -m pdb D:\\Data\\test_IDE.py I get this error IOError: (2, 'No such file or dire

Re: Converting .doc to .txt in Linux

2008-09-04 Thread Cameron Simpson
On 04Sep2008 12:54, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: | I had previously asked a similar question, | http://groups.google.com/group/comp.lang.python/browse_thread/thread/2953d6d5d8836c4b/9dc901da63d8d059?lnk=gst&q=convert+doc+txt#9dc901da63d8d059 | | but at that point I was using Windo

Re: pdb bug and questions

2008-09-04 Thread castironpi
On Sep 4, 4:22 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: > hello, > > I'm trying to embed a debugger into an editor. > I'm only interested in high level debugging. > The first question is what debugger is the best for my purpose ? > (pdb, pydb, rpdb2, smart debugger, extended debugger ? > > Secon

Re: xml + mmap cross

2008-09-04 Thread castironpi
On Sep 4, 7:54 pm, alex23 <[EMAIL PROTECTED]> wrote: > On Sep 4, 8:31 am, castironpi <[EMAIL PROTECTED]> wrote: > > > Any interest in pursuing/developing/working together on a mmaped-xml > > class?  Faster, not readable in text editor. > > XML is text-based, so it should -always- be readable in a t

Re: Tkinter Radio button on the second window

2008-09-04 Thread Guilherme Polo
On Thu, Sep 4, 2008 at 10:01 PM, Dream <[EMAIL PROTECTED]> wrote: > The code create 2 windows. 2 radiobuttons are put on the second > window. A control variable "v" is binded to the 2 widgets. > But when I run the code, I found the control variable not binded > succsessfully: The second radiobutton

Re: Tkinter Radio button on the second window

2008-09-04 Thread Gabriel Genellina
En Thu, 04 Sep 2008 22:01:25 -0300, Dream <[EMAIL PROTECTED]> escribi�: The code create 2 windows. 2 radiobuttons are put on the second window. A control variable "v" is binded to the 2 widgets. But when I run the code, I found the control variable not binded succsessfully: The second radiobutto

Curious: 2134 2004-10-06 08:55:20Z fredrik

2008-09-04 Thread Akathorn Greyhat
I had an import error and I get this error: Traceback (most recent call last): File "C:\Eclipse\pyworkspace\CodenameRazor0.2\src\app.py", line 11, in import core File "C:\Python25\lib\site-packages\PIL\__init__.py", line 3, in # $Id: __init__.py 2134 2004-10-06 08:55:20Z fredrik $ Imp

Re: Issue warning if no "return" in function?

2008-09-04 Thread alex23
On Sep 4, 8:05 pm, Poster28 <[EMAIL PROTECTED]> wrote: > What would you suggest to check python programs for non-syntax error. > One example I could think of that one might forget to "return" a value from > a function. > > How could I check for these and maybe other mistakes? I really recommend ge

ctypes error on Windows

2008-09-04 Thread Mike Hostetler
I'm working on a script with the most excellent uTibyLib library. The script works just fine on Mac, but on Windows I get this: File "findtables.py", line 82, in cleanHTML return str(tidy.parseString(decentDoc)) File "c:\Python24\Lib\site-packages\tidy\lib.py", line 207, in parseString

Re: Python test case management system?

2008-09-04 Thread Ben Finney
Mudcat <[EMAIL PROTECTED]> writes: > Does anyone know of a good test case management system written in > python, or possibly another application (either open source or > commercial) that can be extended using python? What would the behaviour of such a system be? In other words, what is a "test ca

Re: max(), sum(), next()

2008-09-04 Thread Mensanator
On Sep 4, 12:31 pm, Thomas Bellman <[EMAIL PROTECTED]> wrote: > Mensanator <[EMAIL PROTECTED]> wrote: > > Ok, but I don't understand why an empty list is a valid sum > > whereas a list containing None is not. > > You can't conclude the behaviour of the one from the behaviour > of the other, because

Re: Can anyone suggest a good crypto package?

2008-09-04 Thread Paul Rubin
Fett <[EMAIL PROTECTED]> writes: > Wow, I have no idea how that works, but I think it will do nicely. The > main goal is simply to ensure that data coming in (from a website), is > valid (ie. posted by me). If you just want to authenticate the strings without confidentiality, use the built-in HMA

Tkinter Radio button on the second window

2008-09-04 Thread Dream
The code create 2 windows. 2 radiobuttons are put on the second window. A control variable "v" is binded to the 2 widgets. But when I run the code, I found the control variable not binded succsessfully: The second radiobutton was not selected by default; Click ed each button always print 1. I don't

Re: xml + mmap cross

2008-09-04 Thread alex23
On Sep 4, 8:31 am, castironpi <[EMAIL PROTECTED]> wrote: > Any interest in pursuing/developing/working together on a mmaped-xml > class?  Faster, not readable in text editor. XML is text-based, so it should -always- be readable in a text editor. It's part of the definition, I believe. However, an

Re: Python test case management system?

2008-09-04 Thread MrJean1
Perhaps Qmtest fits your needs /Jean On Sep 4, 4:36 pm, Mudcat <[EMAIL PROTECTED]> wrote: > I had originally planned on writing my own software for managing test > cases; however new boss = new directive. This will make it more > difficult to get t

Re: Converting .doc to .txt in Linux

2008-09-04 Thread William Purcell
Here is a function that I have used with wvText to convert .doc files into text files. def readdoc(fpath): tmp = 'tmp_readdoc.txt' cmd = 'wvText %s %s'%(fpath,tmp) os.system(cmd) lines = open(tmp,'r').readlines() os.unlink(tmp) return lines It's not a completely python dep

Re: Python test case management system?

2008-09-04 Thread skip
Mudcat> Does anyone know of a good test case management system written Mudcat> in python, or possibly another application (either open source Mudcat> or commercial) that can be extended using python? I don't know what you mean by "test case management system", but within the Python co

Re: why is self not passed to id()?

2008-09-04 Thread Terry Reedy
Ruediger wrote: I am aware that id is a built in function why shouldn't i use it? I consider this a sensible thing to have tried, but I an not too surprised it does not work because I am aware that built-in functions do not have all the features of Python function. I have asked about thi

Re: Can anyone suggest a good crypto package?

2008-09-04 Thread M.-A. Lemburg
On 2008-09-04 20:39, Fett wrote: > I need a crypto package that works on windows with python 2.5. Can > anyone suggest one for me? > > I have been searching for a couple days for a good cryptography > package to use for public/private key encryption, at this point I > would settle for symmetric ev

Re: Can anyone suggest a good crypto package?

2008-09-04 Thread Michael Ströder
Fett wrote: > On Sep 4, 2:23 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: >> How about M2Crypto:http://chandlerproject.org/Projects/MeTooCrypto#Downloads > > Seems that this is intended more for webapps or something, Why do you think so? It's a C wrapper module around the OpenSSL crypto libs. Ci

Re: Case-insensitive string compare?

2008-09-04 Thread Robert Dailey
On Thu, Sep 4, 2008 at 5:59 PM, Maric Michaud <[EMAIL PROTECTED]> wrote: > Le Friday 05 September 2008 00:47:00 Chris Rebert, vous avez écrit : > > > > Then store the string in its original case in the value part of the > > key-value pair: > > > > stage_map[key.lower()] = (key,whatever) > > > > "p

Python test case management system?

2008-09-04 Thread Mudcat
I had originally planned on writing my own software for managing test cases; however new boss = new directive. This will make it more difficult to get the functionality I need for test cases that are automated and executed using python. I've searched for alternatives but so far haven't come up wi

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

2008-09-04 Thread Carl Banks
On Sep 4, 3:15 pm, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > On 4 ÓÅÎÔ, 22:59, Carl Banks <[EMAIL PROTECTED]> wrote: > > You can write code to guard against this if you want: > > > class A: > > legal = set(["x"]) > > def __setattr__(self,attr,val): > > if attr not in self.legal: > >

Re: Case-insensitive string compare?

2008-09-04 Thread Maric Michaud
Le Friday 05 September 2008 00:47:00 Chris Rebert, vous avez écrit : > On Thu, Sep 4, 2008 at 3:37 PM, Robert Dailey <[EMAIL PROTECTED]> wrote: > > On Thu, Sep 4, 2008 at 5:21 PM, Fredrik Lundh <[EMAIL PROTECTED]> > > > > wrote: > >> Robert Dailey wrote: > >>> I currently have a dictionary object t

Re: Case-insensitive string compare?

2008-09-04 Thread Chris Rebert
On Thu, Sep 4, 2008 at 3:37 PM, Robert Dailey <[EMAIL PROTECTED]> wrote: > On Thu, Sep 4, 2008 at 5:21 PM, Fredrik Lundh <[EMAIL PROTECTED]> > wrote: >> >> Robert Dailey wrote: >> >>> I currently have a dictionary object that I'm doing the following with: >>> >>> if lib not in stage_map: >>># .

Re: Case-insensitive string compare?

2008-09-04 Thread Maric Michaud
Le Friday 05 September 2008 00:14:37 Robert Dailey, vous avez écrit : > Hi, > > I currently have a dictionary object that I'm doing the following with: > > if lib not in stage_map: > # ... do stuff ... > > However, this will perform a case-sensitive comparison between lib and each > key in stag

Re: Case-insensitive string compare?

2008-09-04 Thread Robert Dailey
On Thu, Sep 4, 2008 at 5:21 PM, Fredrik Lundh <[EMAIL PROTECTED]>wrote: > Robert Dailey wrote: > > I currently have a dictionary object that I'm doing the following with: >> >> if lib not in stage_map: >># ... do stuff ... >> >> However, this will perform a case-sensitive comparison between l

Re: Case-insensitive string compare?

2008-09-04 Thread Fredrik Lundh
Robert Dailey wrote: I currently have a dictionary object that I'm doing the following with: if lib not in stage_map: # ... do stuff ... However, this will perform a case-sensitive comparison between lib and each key in stage_map. Is there a way to make this do a case-insensitive compari

Re: why is self not passed to id()?

2008-09-04 Thread Maric Michaud
Le Thursday 04 September 2008 23:35:18 Terry Reedy, vous avez écrit : > Maric Michaud wrote: > > Le Thursday 04 September 2008 22:26:53 Ruediger, vous avez écrit : > >> class foo(list): > >>     __hash__ = lambda x: id(x) > > > > Wow ! You are really going on trouble with this, believe me there is

Re: Case-insensitive string compare?

2008-09-04 Thread Robert Dailey
On Thu, Sep 4, 2008 at 5:14 PM, Robert Dailey <[EMAIL PROTECTED]> wrote: > Hi, > > I currently have a dictionary object that I'm doing the following with: > > if lib not in stage_map: > # ... do stuff ... > > However, this will perform a case-sensitive comparison between lib and each > key in

Case-insensitive string compare?

2008-09-04 Thread Robert Dailey
Hi, I currently have a dictionary object that I'm doing the following with: if lib not in stage_map: # ... do stuff ... However, this will perform a case-sensitive comparison between lib and each key in stage_map. Is there a way to make this do a case-insensitive comparison instead? Yes, I r

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

2008-09-04 Thread Bruno Desthuilliers
Ivan Illarionov a écrit : On 4 сент, 21:49, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: Ivan Illarionov a écrit : On 4 сент, 22:59, Carl Banks <[EMAIL PROTECTED]> wrote: You can write code to guard against this if you want: class A: legal = set(["x"]) def __setattr__(self,attr,va

Re: Is it possible to download only the of a web page?

2008-09-04 Thread Fredrik Lundh
Rex wrote: I am writing a script that executes a bunch of queries through a form on a website and reads the results. I am only interested in the section in the of each web page. Currently, each page the server returns is about 100kb and contains a bunch of HTML and Javascript, all of which I d

Happy fun time with SWIG

2008-09-04 Thread Uberman
I have a bit of a odd arrangement here with SWIG, Python, Embedded Python and C++ classes exported into Python. Here's the plot: I have a class defined in a C++ DLL library. I am wrapping this class (we'll call it "Peter") with SWIG so some of its base functionality is available in Python. For

Re: why is self not passed to id()?

2008-09-04 Thread Robert Kern
Fredrik Lundh wrote: Robert Kern wrote: Well, that's not entirely true. They need to be not mutated while they are in the dictionary, certainly. At least not in ways that affect equality testing. In this case, one would also have to override list.__eq__ to also compare by identity, too. Then

Re: why is self not passed to id()?

2008-09-04 Thread Terry Reedy
Maric Michaud wrote: Le Thursday 04 September 2008 22:26:53 Ruediger, vous avez écrit : class foo(list): __hash__ = lambda x: id(x) Wow ! You are really going on trouble with this, believe me there is a real good reason for list not to be hashable. A dictionnary or set containing som

Is it possible to download only the of a web page?

2008-09-04 Thread Rex
I am writing a script that executes a bunch of queries through a form on a website and reads the results. I am only interested in the section in the of each web page. Currently, each page the server returns is about 100kb and contains a bunch of HTML and Javascript, all of which I don't need; I d

Re: why is self not passed to id()?

2008-09-04 Thread Fredrik Lundh
Robert Kern wrote: Well, that's not entirely true. They need to be not mutated while they are in the dictionary, certainly. At least not in ways that affect equality testing. In this case, one would also have to override list.__eq__ to also compare by identity, too. Then you could mutate the

Re: why is self not passed to id()?

2008-09-04 Thread Robert Kern
Maric Michaud wrote: Le Thursday 04 September 2008 22:26:53 Ruediger, vous avez écrit : class foo(list): __hash__ = lambda x: id(x) Wow ! You are really going on trouble with this, believe me there is a real good reason for list not to be hashable. A dictionnary or set containing some

pdb bug and questions

2008-09-04 Thread Stef Mientki
hello, I'm trying to embed a debugger into an editor. I'm only interested in high level debugging. The first question is what debugger is the best for my purpose ? (pdb, pydb, rpdb2, smart debugger, extended debugger ? Second question, in none of the above debuggers (except rpdb2), I can find a

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

2008-09-04 Thread Ivan Illarionov
On 4 сент, 21:49, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Ivan Illarionov a écrit : > > > > > On 4 сент, 22:59, Carl Banks <[EMAIL PROTECTED]> wrote: > >> You can write code to guard against this if you want: > > >> class A: > >> legal = set(["x"]) > >> def __setattr__(self,attr,va

Re: max(), sum(), next()

2008-09-04 Thread Thomas Bellman
Mensanator <[EMAIL PROTECTED]> wrote: > Ok, but I don't understand why an empty list is a valid sum > whereas a list containing None is not. You can't conclude the behaviour of the one from the behaviour of the other, because the two situations have nothing at all in common. >> As it happens, th

Re: why is self not passed to id()?

2008-09-04 Thread Ruediger
Fredrik Lundh wrote: > > >>> id > > >>> lambda x: id(x) > at 0x00C07C30> > > any special reason why you're not using Python to write Python programs, > btw? > > I am aware that id is a built in function why shouldn't i use it? Replaceing lambda with id was intended as an performance hack

Re: Not fully understanding the role of Queue.task_done()

2008-09-04 Thread Martin DeMello
On Sep 4, 1:51 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Martin DeMello wrote: > > I'm writing a cluster monitor, that collects information from a set of > > machines and logs it to a database > > > In the interests of not hammering the db unnecessarily, I'm > > considering the following > > 1

Re: Can anyone suggest a good crypto package?

2008-09-04 Thread Fett
On Sep 4, 3:09 pm, Paul Rubin wrote: > Fett <[EMAIL PROTECTED]> writes: > > Is there any crypto package that is actually written in python? I > > seriously don't care how slow it is. > > I wrote a simple symmetric encryption function in python: > >  http://nightsong.com/p

Re: Not fully understanding the role of Queue.task_done()

2008-09-04 Thread Fredrik Lundh
Martin DeMello wrote: I'm writing a cluster monitor, that collects information from a set of machines and logs it to a database In the interests of not hammering the db unnecessarily, I'm considering the following 1. A series of independent "monitor" threads that collect information over TCP fr

Re: why is self not passed to id()?

2008-09-04 Thread Maric Michaud
Le Thursday 04 September 2008 22:26:53 Ruediger, vous avez écrit : > Hello! > Hello, > Executing following little program gives me an TypeError. > > What makes me wonder is that foo does get an argument passed while bar > doesn't. Can anyone explain why?? > Because id is a builtin written in

Re: max(), sum(), next()

2008-09-04 Thread bearophileHUGS
castironpi: > For max and min, why can't you just add your argument to the set > itself? Sometimes that can be done, but in many other situations it's less easy, like in the example I have shown in my first post: max((fun(x) for x in iterable if predicate(x))) There are some ways to add the max

Re: why is self not passed to id()? < solved >

2008-09-04 Thread Ruediger
castironpi wrote: > > The answer is fairly technical. For member functions to be bound to > instances, they are required to have a __get__ method (which takes > instance and owner as parameters). 'id' does not. > > (Why does 'id' not have a __get__ method?) > > By contrast, > set.add >

Re: why is self not passed to id()?

2008-09-04 Thread Fredrik Lundh
Ruediger wrote: Executing following little program gives me an TypeError. What makes me wonder is that foo does get an argument passed while bar doesn't. Can anyone explain why?? >>> id >>> lambda x: id(x) at 0x00C07C30> any special reason why you're not using Python to write Python pr

Re: why is self not passed to id()?

2008-09-04 Thread castironpi
On Sep 4, 3:26 pm, Ruediger <[EMAIL PROTECTED]> wrote: > Hello! > > Executing following little program gives me an TypeError. > > What makes me wonder is that foo does get an argument passed while bar > doesn't. Can anyone explain why?? > > Thanks > Ruediger > > class foo(list): >     __hash__

why is self not passed to id()?

2008-09-04 Thread Ruediger
Hello! Executing following little program gives me an TypeError. What makes me wonder is that foo does get an argument passed while bar doesn't. Can anyone explain why?? Thanks Ruediger class foo(list): __hash__ = lambda x: id(x) class bar(list): __hash__ = id _s_ = set() _s_.a

Re: max(), sum(), next()

2008-09-04 Thread castironpi
On Sep 4, 2:42 pm, [EMAIL PROTECTED] wrote: > David C. Ullrich: > > > At least in mathematics, the sum of the elements of > > the empty set _is_ 0, while the maximum element of the > > empty set is undefined. > > What do you think about my idea of adding that 'default' argument to > the max()/min()

Re: Can anyone suggest a good crypto package?

2008-09-04 Thread Trent Nelson
On Thu, Sep 04, 2008 at 11:39:42AM -0700, Fett wrote: > I need a crypto package that works on windows with python 2.5. Can > anyone suggest one for me? You could always rely on the the APIs Windows provides to do this sort out stuff, either via pywin32 or ctypes. Trent. -- h

Re: Late initialization using __getattribute__

2008-09-04 Thread Carl Banks
On Sep 4, 3:38 pm, bukzor <[EMAIL PROTECTED]> wrote: > The point of using a mixin is to not limit myself to inheriting from > VanillaCursor. I want to put this on top of various subclasses of the > vanilla cursor, like TimeLimitedCursor or RetryingCursor. I have four > other mixins that operate thi

Re: Converting .doc to .txt in Linux

2008-09-04 Thread Tommy Nordgren
On Sep 4, 2008, at 9:54 PM, [EMAIL PROTECTED] wrote: Hi Everyone, I had previously asked a similar question, http://groups.google.com/group/comp.lang.python/browse_thread/thread/2953d6d5d8836c4b/9dc901da63d8d059?lnk=gst&q=convert+doc+txt#9dc901da63d8d059 but at that point I was using Windows

Re: Converting .doc to .txt in Linux

2008-09-04 Thread Chris Rebert
I'd recommend using one of the Word->txt converters for Linux and just running it in a shell script: * http://wvware.sourceforge.net/ * http://www.winfield.demon.nl/ No compelling reason to use Python in this instance. Right tool for the right job and all that. - Chris On Thu, Sep 4, 2008 at 12:

Re: Can anyone suggest a good crypto package?

2008-09-04 Thread Paul Rubin
Fett <[EMAIL PROTECTED]> writes: > Is there any crypto package that is actually written in python? I > seriously don't care how slow it is. I wrote a simple symmetric encryption function in python: http://nightsong.com/phr/crypto/p3.py I wrote a somewhat fancier package that did public key a w

Re: Not fully understanding the role of Queue.task_done()

2008-09-04 Thread Martin DeMello
On Sep 4, 1:04 pm, castironpi <[EMAIL PROTECTED]> wrote: > > Random access isn't supported by the defined interface.  You can make > it more convenient, though. Thanks. I wasn't looking for random access, just wondering what the cleanest way to implement items = Queue.get_all() was. Your code shou

Re: Not fully understanding the role of Queue.task_done()

2008-09-04 Thread castironpi
On Sep 4, 2:51 pm, Martin DeMello <[EMAIL PROTECTED]> wrote: > On Sep 4, 12:41 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > "task_done" just decrements a counter (incremented by "put").  when the > > counter reaches zero, the "join" call is unblocked. > > Thanks! Is there any standard python

Re: Can anyone suggest a good crypto package?

2008-09-04 Thread Mike Driscoll
On Sep 4, 2:50 pm, Fett <[EMAIL PROTECTED]> wrote: > On Sep 4, 2:23 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > > > > > On Sep 4, 1:39 pm, Fett <[EMAIL PROTECTED]> wrote: > > > > I need a crypto package that works on windows with python 2.5. Can > > > anyone suggest one for me? > > > > I have be

Re: xml + mmap cross

2008-09-04 Thread castironpi
On Sep 4, 2:14 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: > castironpi wrote: > > Any interest in pursuing/developing/working together on a mmaped-xml > > class?  Faster, not readable in text editor. > > Any hints on what you are talking about? > > Stefan Nice to hear from you. I assumed you we

Re: Late initialization using __getattribute__

2008-09-04 Thread Bruno Desthuilliers
bukzor a écrit : so unfortunately I think I need to use __getattribute__ to do this. I'm doing all this just to make the connection not actually connect until used. I may be dumb, but I don't get how this is supposed to solve your problem. But anyway : there's a known design pattern for what you

Converting .doc to .txt in Linux

2008-09-04 Thread patrick . waldo
Hi Everyone, I had previously asked a similar question, http://groups.google.com/group/comp.lang.python/browse_thread/thread/2953d6d5d8836c4b/9dc901da63d8d059?lnk=gst&q=convert+doc+txt#9dc901da63d8d059 but at that point I was using Windows and now I am using Linux. Basically, I have some .doc fil

Re: Not fully understanding the role of Queue.task_done()

2008-09-04 Thread Martin DeMello
On Sep 4, 12:41 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > "task_done" just decrements a counter (incremented by "put").  when the > counter reaches zero, the "join" call is unblocked. Thanks! Is there any standard python idiom to empty a queue into a list? Or do I just call get() repeatedly

Re: Can anyone suggest a good crypto package?

2008-09-04 Thread Fett
On Sep 4, 2:23 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On Sep 4, 1:39 pm, Fett <[EMAIL PROTECTED]> wrote: > > > > > I need a crypto package that works on windows with python 2.5. Can > > anyone suggest one for me? > > > I have been searching for a couple days for a good cryptography > > pack

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

2008-09-04 Thread Bruno Desthuilliers
Ivan Illarionov a écrit : On 4 сент, 22:59, Carl Banks <[EMAIL PROTECTED]> wrote: You can write code to guard against this if you want: class A: legal = set(["x"]) def __setattr__(self,attr,val): if attr not in self.legal: raise AttributeError("A object has no attrib

Re: Safely move an element into a heap

2008-09-04 Thread castironpi
On Sep 4, 6:57 am, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > On 4 Set, 13:49, Alexandru Palade <[EMAIL PROTECTED]> > wrote: > > > > > I'm not sure what you expect as an answer, but if you mean the heap as > > in the data structure, you can not just arbitrarily move one key where > > you want

Re: max(), sum(), next()

2008-09-04 Thread bearophileHUGS
David C. Ullrich: > At least in mathematics, the sum of the elements of > the empty set _is_ 0, while the maximum element of the > empty set is undefined. What do you think about my idea of adding that 'default' argument to the max()/min() functions? Bye, bearophile -- http://mail.python.org/mail

Re: Not fully understanding the role of Queue.task_done()

2008-09-04 Thread Fredrik Lundh
Martin DeMello wrote: Reading up on python's built in Queue class, though, it seems oriented towards "job queues", with a two-step dequeue operation (get() and task_done()). I'm worried that this would make it too heavyweight for my application. Is ther documentation somewhere on what exactly ta

Re: Late initialization using __getattribute__

2008-09-04 Thread bukzor
> > I'd like to be able to do something like this: > > class SuperCursor(FeatureOneMixIn, FeatureTwoMixin, ..., > > VanillaCursor): pass > > Why does it have to look like that?  A good programmer lets the code > look however it has to look to most effectively do it's job. > > With a proxy, the "bas

Not fully understanding the role of Queue.task_done()

2008-09-04 Thread Martin DeMello
I'm writing a cluster monitor, that collects information from a set of machines and logs it to a database In the interests of not hammering the db unnecessarily, I'm considering the following 1. A series of independent "monitor" threads that collect information over TCP from the cluster of machine

Re: Can anyone suggest a good crypto package?

2008-09-04 Thread Mike Driscoll
On Sep 4, 1:39 pm, Fett <[EMAIL PROTECTED]> wrote: > I need a crypto package that works on windows with python 2.5. Can > anyone suggest one for me? > > I have been searching for a couple days for a good cryptography > package to use for public/private key encryption, at this point I > would settle

Re: Late initialization using __getattribute__

2008-09-04 Thread Carl Banks
On Sep 4, 12:36 pm, bukzor <[EMAIL PROTECTED]> wrote: > > >>> so unfortunately I think I need to use __getattribute__ > > >>> to do this. I'm doing all this just to make the connection not > > >>> actually connect until used. > > >> I may be dumb, but I don't get how this is supposed to solve your

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

2008-09-04 Thread Ivan Illarionov
On 4 сент, 22:59, Carl Banks <[EMAIL PROTECTED]> wrote: > You can write code to guard against this if you want: > > class A: >     legal = set(["x"]) >     def __setattr__(self,attr,val): >         if attr not in self.legal: >             raise AttributeError("A object has no attribute '%s'" % > at

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

2008-09-04 Thread Carl Banks
On Sep 4, 7:09 am, "Marco Bizzarri" <[EMAIL PROTECTED]> wrote: > Sorry... pressed enter but really didn't want to. > > As I said, let's say I have a class > > class A: > def __init__(self): > self.x = None > > Python makes the decision to allow the developers to directly access > the a

Can anyone suggest a good crypto package?

2008-09-04 Thread Fett
I need a crypto package that works on windows with python 2.5. Can anyone suggest one for me? I have been searching for a couple days for a good cryptography package to use for public/private key encryption, at this point I would settle for symmetric even. Every encryption package I have found fo

Re: python/xpath question..

2008-09-04 Thread Stefan Behnel
Stefan Behnel wrote: > Yes, learn to use XPath, e.g. > > //tr/td[not string()] Oh, well... //tr/td[not(string())] as I said, wrong news group. ;-) Try something like "gmane.text.xml.xpath.general", for example. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Submitting forms over HTTPS with mechanize

2008-09-04 Thread Rex
On Sep 3, 10:17 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > Rex wrote: > > Hello, > > > I am working on an academic research project where I need to log in to > > a website (www.lexis.com) over HTTPS and execute a bunch of queries to > > gather a data set. I just discovered the mechanize module, w

Re: max(), sum(), next()

2008-09-04 Thread Wojtek Walczak
On Thu, 4 Sep 2008 10:57:35 -0700 (PDT), Mensanator wrote: > Why then, doesn't > sum([A for A in [None, None, None, None, None, None] if A != None]) > 0 > > give me an error? Because "[A for A in [None, None, None, None, None, None] if A != None]" returns an empty list, and sum([]) doesn't r

Re: Xpath for HTML processing

2008-09-04 Thread Stefan Behnel
Astley Le Jasper wrote: > Can anyone suggest something inthat can process an XPath like the > following: > > "/html/body/table[2]/tbody/tr/td[5]/table/tbody/tr[3]/td/table[3]/ > tbody/tr[5]/td" [skipping the obvious joke answer to your question] In case you're asking for a tool that can process

Re: max(), sum(), next()

2008-09-04 Thread Mensanator
On Sep 4, 2:05 am, Thomas Bellman <[EMAIL PROTECTED]> wrote: > Mensanator <[EMAIL PROTECTED]> wrote: > > No, but blank cells are 0 as far as Excel is concerned. > > That behaviour causes nothing but trouble and I am > > saddened to see Python emulate such nonsense. > > Then you should feel glad tha

Re: Python and Cyrillic characters in regular expression

2008-09-04 Thread Fredrik Lundh
phasma wrote: Hi, I'm trying extract all alphabetic characters from string. reg = re.compile('(?u)([\w\s]+)', re.UNICODE) buf = re.match(string) But it's doesn't work. If string starts from Cyrillic character, all works fine. But if string starts from Latin character, match returns only Latin

Re: Python and Cyrillic characters in regular expression

2008-09-04 Thread MRAB
On Sep 4, 3:42 pm, phasma <[EMAIL PROTECTED]> wrote: > Hi, I'm trying extract all alphabetic characters from string. > > reg = re.compile('(?u)([\w\s]+)', re.UNICODE) You don't need both (?u) and re.UNICODE: they mean the same thing. This will actually match letters and whitespace. > buf = re.ma

Re: max(), sum(), next()

2008-09-04 Thread Mensanator
On Sep 4, 11:13 am, "David C. Ullrich" <[EMAIL PROTECTED]> wrote: > In article > <[EMAIL PROTECTED]>, > > > > > >  Mensanator <[EMAIL PROTECTED]> wrote: > > On Sep 3, 2:18 pm, Laszlo Nagy <[EMAIL PROTECTED]> wrote: > > > [EMAIL PROTECTED] wrote: > > > > Empty Python lists [] don't know the type of

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

2008-09-04 Thread Timothy Grant
On Thu, Sep 4, 2008 at 4:09 AM, Marco Bizzarri <[EMAIL PROTECTED]> wrote: > Sorry... pressed enter but really didn't want to. > > As I said, let's say I have a class > > class A: >def __init__(self): > self.x = None > > > > Python makes the decision to allow the developers to directly a

Re: Help needed to freeze a script.

2008-09-04 Thread LB
> Did you try py2exe instead offreeze? On the page > > http://www.py2exe.org/index.cgi/WorkingWithVariousPackagesAndModules > > there is only one brief mention of numpy packaging troubles, > suggesting that it might work better. I have used py2exe in the past > without much trouble. Unfortunately,

  1   2   >