Re: How to except the unexpected?

2006-03-03 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > The way to deal with it is to add another except clause to deal with the > KeyboardInterrupt, or to have recover_from_error_gracefully() deal with > it. I think adding another except clause for KeyboardInterrupt isn't good because maybe in Python 2.6

Re: add an asynchronous exception class

2006-03-03 Thread Fredrik Lundh
Paul Rubin wrote: > I'd like to suggest adding a builtin abstract class to Python called > AsynchronousException, which would be a subclass of Exception. The > only asynchronous exception I can think of right now is > KeyboardInterrupt, so KeyboardInterrupt would become a subclass of > Asynchrono

Re: idea: add an asynchronous exception class

2006-03-03 Thread Steven D'Aprano
On Fri, 03 Mar 2006 22:31:49 -0800, Paul Rubin wrote: > I'd like to suggest adding a builtin abstract class to Python called > AsynchronousException, which would be a subclass of Exception. [snip rationale] +1 on this. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Win32api, pyHook, possibly win32com, not sure XD, thats why I'm posting

2006-03-03 Thread Michel Claveau
Hi! Rename Pythonw.exe like jtp.exe And... run: jtp.exe yourscript.pyw -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: How to except the unexpected?

2006-03-03 Thread Steven D'Aprano
On Fri, 03 Mar 2006 21:10:22 -0800, Paul Rubin wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: >> try: >> process_things() >> except ExpectedErrors: >> recover_from_error_gracefully() >> except ErrorsThatCantHappen: >> print "Congratulations! You have found a program bug!" >>

idea: add an asynchronous exception class

2006-03-03 Thread Paul Rubin
I'd like to suggest adding a builtin abstract class to Python called AsynchronousException, which would be a subclass of Exception. The only asynchronous exception I can think of right now is KeyboardInterrupt, so KeyboardInterrupt would become a subclass of AsynchronousException instead of being

Re: slicing the end of a string in a list

2006-03-03 Thread John Salerno
Steven D'Aprano wrote: > On Fri, 03 Mar 2006 16:57:10 +, John Salerno wrote: > >> Steven D'Aprano wrote: >> >>> The important term there is BINARY, not large. Many problems *reading* >>> (not opening) binary files will go away if you use 'rb', regardless of >>> whether they are small, medium o

Re: Calculating md5 checksums.

2006-03-03 Thread Rajesh Sathyamoorthy
I tried the script and had to get a hexdigest to get the value providedMy test:SimplyMEPIS-3.3.1-1.iso checksum: 41a19060d3bb37bd596708ba77964491i got: 41a19060d3bb37bd596708ba77964491Do people normally provide md5 checksum in a hexadecimal string?Besides that, is the script reliable? Replies:Rajes

Re: Package organization: where to put 'common' modules?

2006-03-03 Thread fortepianissimo
Ok I guess a little more "hunch" might be needed to elicit suggestions. If I chose to put foo in A, is there a way for code in B to import foo from A? Namely, is there a way to import stuff from a parent directory/package? If it's not possible without changing sys.path, what's the path of least ef

Re: How to except the unexpected?

2006-03-03 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > try: > process_things() > except ExpectedErrors: > recover_from_error_gracefully() > except ErrorsThatCantHappen: > print "Congratulations! You have found a program bug!" > print "For a $327.68 reward, please send the following " \ >

Re: slicing the end of a string in a list

2006-03-03 Thread Steven D'Aprano
On Fri, 03 Mar 2006 16:57:10 +, John Salerno wrote: > Steven D'Aprano wrote: > >> The important term there is BINARY, not large. Many problems *reading* >> (not opening) binary files will go away if you use 'rb', regardless of >> whether they are small, medium or large. > > Is 'b' the proper

Re: stripping spaces in front of line

2006-03-03 Thread Steven D'Aprano
On Fri, 03 Mar 2006 20:01:30 -0800, eight02645999 wrote: > hi > wish to ask a qns on strip > i wish to strip all spaces in front of a line (in text file) > > f = open("textfile","rU") > while (1): > line = f.readline().strip() > if line == '': > break > pri

Re: socket freezes

2006-03-03 Thread [EMAIL PROTECTED]
Might want to check out the SO_REUSEADDR bit in sockets. I believe it helps with a problem of a program not notifying the OS that it's done with the port. Piece of a script (duh): host = "" port = 51423 #random for this example s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setsockopt(s

Re: How to except the unexpected?

2006-03-03 Thread Steven D'Aprano
On Sat, 04 Mar 2006 00:10:17 +0100, Rene Pijlman wrote: > I've writen an application that uses urllib2, urlparse, robotparser and > some other modules in the battery pack. One day my app failed with an > urllib2.HTTPError. So I catch that. But then I get a urllib2.URLError, so > I catch that too.

Re: stripping spaces in front of line

2006-03-03 Thread Jorge Godoy
[EMAIL PROTECTED] writes: > hi > wish to ask a qns on strip > i wish to strip all spaces in front of a line (in text file) > > f = open("textfile","rU") > while (1): > line = f.readline().strip() > if line == '': > break > print line > f.close() > > in "text

Re: id3 encoding testing

2006-03-03 Thread [EMAIL PROTECTED]
Use IRC (mIRC is best in my opinion), has a trial that lasts forever. Connect to the Rizon.net server and search for mp3 chatroom. Ask for help using xdcc if you need it. -- http://mail.python.org/mailman/listinfo/python-list

Re: stripping spaces in front of line

2006-03-03 Thread James Stroud
[EMAIL PROTECTED] wrote: > hi > wish to ask a qns on strip > i wish to strip all spaces in front of a line (in text file) > > f = open("textfile","rU") > while (1): > line = f.readline().strip() > if line == '': > break > print line > f.close() > > in "text

Re: stripping spaces in front of line

2006-03-03 Thread Tim Chase
> wish to ask a qns on strip > i wish to strip all spaces in front of a line (in text file) > > f = open("textfile","rU") > while (1): > line = f.readline().strip() > if line == '': > break > print line > f.close() Yes, that would be a way to do it. > in "

Re: scipy

2006-03-03 Thread computer1
thank you very much. I have dowtnloaded it successfully. -- http://mail.python.org/mailman/listinfo/python-list

stripping spaces in front of line

2006-03-03 Thread eight02645999
hi wish to ask a qns on strip i wish to strip all spaces in front of a line (in text file) f = open("textfile","rU") while (1): line = f.readline().strip() if line == '': break print line f.close() in "textfile", i added some spaces in and then ran the code

Re: do design patterns still apply with Python?

2006-03-03 Thread Alex Martelli
gene tani <[EMAIL PROTECTED]> wrote: ... > There's a couple Alex M slideshows and a couple discussions of > Creational/Structural / Behavioral patterns > > http://www.strakt.com/docs/ep04_pydp.pdf And more of my stuff (including slideshows on Design Patterns in Python, and one essay "Five easy

Re: Win32api, pyHook, possibly win32com, not sure XD, thats why I'm posting

2006-03-03 Thread [EMAIL PROTECTED]
I'm really trying to figure out the overall extent with which python can interact with the windows system (curious person ;D). I can't seem to find documentation on it, so if anyone could point me to that... i know python can kill processes and return what processes are running, so i was just wonde

Re: How much does Python optimize?

2006-03-03 Thread Alex Martelli
Blackbird <[EMAIL PROTECTED]> wrote: ... > >> for i in range(10): > >> ... > > Yup, and if you are tuning a piece of code to the wall, you should > > time it and possibly care. Likely you are not, and the timing makes > > no difference. Someday, range will behave like xrange automagica

Re: Python advocacy in scientific computation

2006-03-03 Thread David Treadwell
On Mar 3, 2006, at 8:33 PM, sturlamolden wrote: > Michael Tobis skrev: > > Being a scientist, I can tell you that your not getting it right. If > you speak computer science or business talk no scientist are going to > listen. Lets just see how you argue: > > >> These include: source and version c

Comments sought for PEP 357 --- allowing any object in slice syntax

2006-03-03 Thread Travis Oliphant
This post is to gather feedback from the wider community on PEP 357. It is nearing the acceptance stage and has previously been discussed on python-dev. This is a chance for the wider Python community to comment on the proposal. You will find the PEP attached PEP: 357 Title: Allowing Any

Re: XSLT and gettext?

2006-03-03 Thread uche . ogbuji
KW wrote: > I'm looking for a nice way to do i18n with XSLT, preferably using the > gettext framework. Currently I'm using 4Suite for XSLT processing. Do > you know of any solutions to this problem? > > If no solutions currently exist, I'll try to write something myself. Any > ideas on how to do th

Re: object's list index

2006-03-03 Thread Steven D'Aprano
On Fri, 03 Mar 2006 04:48:20 -0800, Iain King wrote: > I think python only stores lists one way - i.e. each index maps to it's > value, but no backwards trace is kept from value to index. Python lists are arrays of pointers to objects. The objects themselves have no clue what lists they belong to

Re: Win32api, pyHook, possibly win32com, not sure XD, thats why I'm posting

2006-03-03 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Is there a way to hide a python instance from the Task Manager process > list? > And your reason for wanting to know would be... -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd www.holdenweb.com Love me, love my blog ho

Re: Does '#hash' mean anything in IDLE?

2006-03-03 Thread Blackbird
Scott David Daniels wrote: > Paul Rubin wrote: >> Scott David Daniels <[EMAIL PROTECTED]> writes: >>> And, for 2.4 or later: >>> >>> def letter_hash(word): >>> return "".join(sorted(word)) >>> >>> sorted takes an iterable, and strings are iterables. >> >> I don't think the "hash" is r

Re: Python advocacy in scientific computation

2006-03-03 Thread sturlamolden
Michael Tobis skrev: Being a scientist, I can tell you that your not getting it right. If you speak computer science or business talk no scientist are going to listen. Lets just see how you argue: > These include: source and version control and audit trails for runs, > build system management, te

Win32api, pyHook, possibly win32com, not sure XD, thats why I'm posting

2006-03-03 Thread [EMAIL PROTECTED]
Is there a way to hide a python instance from the Task Manager process list? -- http://mail.python.org/mailman/listinfo/python-list

Re: how do you move to a new line in your text editor?

2006-03-03 Thread Jorge Godoy
Mc Osten <[EMAIL PROTECTED]> writes: > Because I tried it and it just lacks a lot of functionality you get with > TextMate or Emacs. It is quite stupid when indenting, just to name one. This is the main motive I don't use PyDev with Eclipse... It is a lot more stupid than python-mode on Emacs wi

Re: How to except the unexpected?

2006-03-03 Thread Peter Hansen
Rene Pijlman wrote: > One of the things I dislike about Java is the need to declare exceptions > as part of an interface or class definition. But perhaps Java got this > right... > > I've writen an application that uses urllib2, urlparse, robotparser and > some other modules in the battery pack. O

Re: How to except the unexpected?

2006-03-03 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Ben Caradoc-Davies <[EMAIL PROTECTED]> wrote: > James Stroud wrote: > > except URLError, HTTPException: > > Aieee! This catches only URLError and binds the name HTTPException to > the detail of that error. You must write > > except (URLError, HTTPException): >

Re: Calculating md5 checksums.

2006-03-03 Thread Nainto
Take a look at: http://effbot.org/librarybook/md5.htm Fredrik Lundh wrote: > Rajesh Sathyamoorthy wrote: > > > How do you calculate the md5 checksum of a file? > > > > so far i got this, > > > > import md5 > > > > obj = md5.new() > > file = open( 'filename', 'rb') > > data = text.read() > > obj.

Re: How to except the unexpected?

2006-03-03 Thread James Stroud
Ben Caradoc-Davies wrote: > James Stroud wrote: > >> except URLError, HTTPException: > > > Aieee! This catches only URLError and binds the name HTTPException to > the detail of that error. You must write > > except (URLError, HTTPException): > > to catch both. > Oops. -- http://mail.python

Re: white space in expressions and argument lists

2006-03-03 Thread Sybren Stuvel
Magnus Lycka enlightened us with: > Think particularly about using version management systems and > applying patches coming from different sources etc. I was :) > Finally, if you end up with something like... > > a= 1 > b

Re: How to except the unexpected?

2006-03-03 Thread Ben Caradoc-Davies
James Stroud wrote: > except URLError, HTTPException: Aieee! This catches only URLError and binds the name HTTPException to the detail of that error. You must write except (URLError, HTTPException): to catch both. -- Ben Caradoc-Davies <[EMAIL PROTECTED]> http://wintersun.org/ "Those who deny

Re: sockets, where can I find documentation?

2006-03-03 Thread John Pote
Thanks everyone for such a quick response. Brilliant! John Pote "John Pote" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all, > > I want to use python on a server to access incoming TCP port accesses. So > I need to use the socket interface which is new to me. To quote the P

Re: How to except the unexpected?

2006-03-03 Thread James Stroud
Rene Pijlman wrote: > One of the things I dislike about Java is the need to declare exceptions > as part of an interface or class definition. But perhaps Java got this > right... > > I've writen an application that uses urllib2, urlparse, robotparser and > some other modules in the battery pack. O

How to except the unexpected?

2006-03-03 Thread Rene Pijlman
One of the things I dislike about Java is the need to declare exceptions as part of an interface or class definition. But perhaps Java got this right... I've writen an application that uses urllib2, urlparse, robotparser and some other modules in the battery pack. One day my app failed with an url

Re: Stopping Windows Service

2006-03-03 Thread Larry Bates
D wrote: > Sorry for the many messages, but I've been looking into it further - > since I have the server services listening and waiting for incoming > connections, how would I interrupt it to let the program know that a > stop request has been issued? For example, if I put the stop check > before

Re: dynamically creating variables

2006-03-03 Thread James Stroud
Crutcher wrote: >>Is it possible to do something like that? > > > No, you can't change the binding of variables in your calling space. > Unless your calling space is global py> def doit(): ... globals()['wilma'] = 'pebbles' ... py> doit() py> wilma 'pebbles' But that would be crazy. -- htt

Re: Writing an OPC client with Python ?

2006-03-03 Thread Larry Bates
pierlau wrote: > Larry Bates a écrit : >> >> pierlau wrote: >> >>> Hello, >>> >>> I use an OPC server for connection to DC Drive. >>> I would like to write a small OPC client. >>> I have the dll OPCDAAuto.dll which contains all class and method but >>> I wonder if its possible to instance in python

Re: dynamically creating variables

2006-03-03 Thread Larry Bates
[EMAIL PROTECTED] wrote: > I am writing a parser and I have a routine that can digest > a series of tokes: > > def digest(*args) > > I use it like this: digest("FOR", "IDENT", "EQ", "INTVAL", "COLON"). > This part works fine. My digest function returns a list of the values > associated with each

Re: no-setup packages?

2006-03-03 Thread James Stroud
xamdam wrote: > Hi all, > we have a situation where I need to deploy some python modules without > superuser permissions - is there a 'standard' way of doing it? > > Better yet, is there a way to deploy modules without running any > scripts at all? Tarball deployment of some sort? > > Particular

Re: dynamically creating variables

2006-03-03 Thread Crutcher
> Is it possible to do something like that? No, you can't change the binding of variables in your calling space. -- http://mail.python.org/mailman/listinfo/python-list

Re: Does '#hash' mean anything in IDLE?

2006-03-03 Thread Scott David Daniels
Paul Rubin wrote: > Scott David Daniels <[EMAIL PROTECTED]> writes: >> And, for 2.4 or later: >> >> def letter_hash(word): >> return "".join(sorted(word)) >> >> sorted takes an iterable, and strings are iterables. > > I don't think the "hash" is really a hash in the normal sense--in

[ANNOUNCE] PyIW and PyWPA

2006-03-03 Thread Jeremy Moles
Sorry for the double-post; that's what I get for using busted, Dapper Evolution. :) Many updates to the modules I'm writing for interacting with wireless networking in Linux using Python. PyIW - Python bindings to libiw. PyWPA - P

[ANNOUNCE] PyIW and PyWPA

2006-03-03 Thread Jeremy Moles
Many updates to the modules I'm writing for interacting with wireless networking in Linux using Python. PyIW - Python bindings to libiw. PyWPA - Python bindings/wrapper for wpa_supplicant. They can be found here: http://downloads.emperorlinux.com/contrib/pyiw http://downloads.emperorlinux.com/c

Re: Calculating md5 checksums.

2006-03-03 Thread Fredrik Lundh
Rajesh Sathyamoorthy wrote: > How do you calculate the md5 checksum of a file? > > so far i got this, > > import md5 > > obj = md5.new() > file = open( 'filename', 'rb') > data = text.read() > obj.update(data) > checksum = md5.digest() > > Is this correct? Is there anything else i should do befo

RE: Writing an OPC client with Python ?

2006-03-03 Thread Walter S. Leipold
Larry Bates wrote: > pierlau wrote: > > I use an OPC server for connection to DC Drive. > > I would like to write a small OPC client. > > I have the dll OPCDAAuto.dll which contains all class > > and method but I wonder if its possible to instance in > > python the class that are in the dll ? > >

dynamically creating variables

2006-03-03 Thread rambham
I am writing a parser and I have a routine that can digest a series of tokes: def digest(*args) I use it like this: digest("FOR", "IDENT", "EQ", "INTVAL", "COLON"). This part works fine. My digest function returns a list of the values associated with each token. dummy1, ident, dummy2, start =

[ANNOUNCE] Twenty-ninth release of PythonCAD now available

2006-03-03 Thread Art Haas
Hi. I'm pleased to announce the twenty-ninth development release of PythonCAD, a CAD package for open-source software users. As the name implies, PythonCAD is written entirely in Python. The goal of this project is to create a fully scriptable drafting program that will match and eventually exceed

Re: Writing an OPC client with Python ?

2006-03-03 Thread pierlau
Larry Bates a écrit : > > pierlau wrote: > >>Hello, >> >>I use an OPC server for connection to DC Drive. >>I would like to write a small OPC client. >>I have the dll OPCDAAuto.dll which contains all class and method but I >>wonder if its possible to instance in python the class that are in the d

Re: why does close() fail miserably on popen with exit code -1 ?!

2006-03-03 Thread Jeffrey Schwab
Tobiah wrote: > phase:toby:~> echo 'exit -1' | bash > phase:toby:~> echo $? > 255 http://www.linuxtopia.org/online_books/advanced_bash_scripting_guide/exitcodes.html Exit Code Number: 255 [1] Meaning: Exit status out of range Example: exit -1 Comments: exit takes o

Package organization: where to put 'common' modules?

2006-03-03 Thread fortepianissimo
Say I have the following package organization in a system I'm developing: A |B |C |D I have a module, say 'foo', that both package D and B require. What is the best practice in terms of creating a 'common' package that hosts 'foo'? I want to be able to - Testing modules in

Re: forcing exceptions

2006-03-03 Thread Peter Otten
Nikola Skoric wrote: > print self.sect[1].encode('utf-8') > > Which results in: > > Traceback (most recent call last): > File "AIDbot2.py", line 238, in ? > bot.checkNominations() > File "AIDbot2.py", line 201, in checkNominations > if sect.parseSect() == 1: > File "AIDbot2.py", line 96, in pars

Re: forcing exceptions

2006-03-03 Thread Robert Kern
Nikola Skoric wrote: > Traceback (most recent call last): > File "AIDbot2.py", line 238, in ? > bot.checkNominations() > File "AIDbot2.py", line 201, in checkNominations > if sect.parseSect() == 1: > File "AIDbot2.py", line 96, in parseSect > print self.sect[1].encode('utf-8') >

Re: Does '#hash' mean anything in IDLE?

2006-03-03 Thread John Coleman
Scott David Daniels wrote: > John Coleman wrote: > > Blackbird wrote: > >> I think this simpler version of letter_hash should work too: > >> > >> def letter_hash(word): > >> w = [c for c in word] > >> w.sort() > >> return "".join(w) > > And, for 2.4 or later: > > def letter_hash(w

Re: Does '#hash' mean anything in IDLE?

2006-03-03 Thread Paul Rubin
Scott David Daniels <[EMAIL PROTECTED]> writes: > And, for 2.4 or later: > > def letter_hash(word): > return "".join(sorted(word)) > > sorted takes an iterable, and strings are iterables. I don't think the "hash" is really a hash in the normal sense--in particular, it has to be col

Re: forcing exceptions

2006-03-03 Thread Nikola Skoric
In article <[EMAIL PROTECTED]>, Paul Rubin says... > Nikola Skoric <[EMAIL PROTECTED]> writes: > > Is there a way to tell the interpreter to display exceptions, even those > > which were captured with except? > > Normally you wouldn't do that unless you were trying to

Re: RPC client class?

2006-03-03 Thread Aaron Lav
In article <[EMAIL PROTECTED]>, Dick Watson <[EMAIL PROTECTED]> wrote: >"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> if the RPC you're talking about is Sun RPC, the whole concept is pretty >> dated (the original RFCs are from the late eighties). > >Just because i

Re: PyQt issue

2006-03-03 Thread dmbkiwi
Hangs head in shame. Slinks off with tail between legs. Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Proper class initialization

2006-03-03 Thread Christoph Zwerschke
gry@ll.mit.edu schrieb: > Hmm, the meta-class hacks mentioned are cool, but for this simple a > case how about just: > > class A: >def __init__(self): > self.__class__.sum = self.calculate_sum() >def calculate_sum(self): > do_stuff > return sum_value If you do it like th

Re: socket freezes

2006-03-03 Thread Luis P. Mendes
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 | Try setting a default timeout on the socket, and if it times out | recontact the other system on a new socket. See socket.setdefaultimeout() | | regards | Steve Thank you for your answers. I'm beggining to suspect that the problem has to do with

Re: Does '#hash' mean anything in IDLE?

2006-03-03 Thread Scott David Daniels
John Coleman wrote: > Blackbird wrote: >> I think this simpler version of letter_hash should work too: >> >> def letter_hash(word): >> w = [c for c in word] >> w.sort() >> return "".join(w) And, for 2.4 or later: def letter_hash(word): return "".join(sorted(word)) sorte

Re: Writing an OPC client with Python ?

2006-03-03 Thread Larry Bates
pierlau wrote: > Hello, > > I use an OPC server for connection to DC Drive. > I would like to write a small OPC client. > I have the dll OPCDAAuto.dll which contains all class and method but I > wonder if its possible to instance in python the class that are in the dll ? > > Thanks for your he

no-setup packages?

2006-03-03 Thread xamdam
Hi all, we have a situation where I need to deploy some python modules without superuser permissions - is there a 'standard' way of doing it? Better yet, is there a way to deploy modules without running any scripts at all? Tarball deployment of some sort? Particular things I have in mind are cx_O

Re: white space in expressions and argument lists

2006-03-03 Thread Scott David Daniels
Magnus Lycka wrote: > Touching more lines of code than you actually need will > both make it difficult for a reviewer to understand what > has changed (although good diff tools can be told to > ignore pure whitespace changes) ... Such features have a nasty interaction with languages that use s

Re: how do you move to a new line in your text editor?

2006-03-03 Thread John Salerno
John Salerno wrote: > This is a real small point, but I'd like to hear what others do in this > case. It's more an 'administrative' type question than Python code > question, but it still involves a bit of syntax. > > One thing I like to do is use tabs for my indentation, because this > makes i

Re: forcing exceptions

2006-03-03 Thread Paul Rubin
Nikola Skoric <[EMAIL PROTECTED]> writes: > Is there a way to tell the interpreter to display exceptions, even those > which were captured with except? Normally you wouldn't do that unless you were trying to debug the interpreter itself. It uses caught exceptions for all sorts of things that you

Calculating md5 checksums.

2006-03-03 Thread Rajesh Sathyamoorthy
Hi,How do you calculate the md5 checksum of a file?so far  i got this,import md5obj = md5.new()file = open( 'filename',  'rb') data = "">obj.update(data)checksum = md5.digest ()Is this correct? Is there anything else i should do before comparing the checksum with the one provided for the file?Thank

Re: [Python-Help] Reading from socket file handle took too long

2006-03-03 Thread Etienne Desautels
Hi, thanks Matthew for the answer. It help me think a little bit more. I found a solution and I think I found the culprit but I would need to do more investigation to be sure. My solution is to work directly with the socket library instead of using the higher level urllib2 library. Now it tak

id3 encoding testing

2006-03-03 Thread ianaré
hey all, anybody know where i can download some mp3's and/or other file formats that use id3 tags in different encodings? working on an app that retrieves id3 info, and all the mp3's i have come across so far use iso-8859-1 encoding. i would like to test: 'Eastern Europe (iso-8859-2)' 'Cyrillic

Re: forcing exceptions

2006-03-03 Thread Gary Herron
Bill Scherer wrote: >Nikola Skoric wrote: > > > >>Is there a way to tell the interpreter to display exceptions, even those >>which were captured with except? >> >> >> >I believe you are looking for "raise". >For example: > >Try: > some.code() >except SomeError: > do.whatever() > raise

Re: forcing exceptions

2006-03-03 Thread Gary Herron
Nikola Skoric wrote: >Is there a way to tell the interpreter to display exceptions, even those >which were captured with except? > > > Yes, sort of ... You have to trigger the display yourself within the capturing "except" -- it's not automatic. The traceback module provides a number of func

Re: forcing exceptions

2006-03-03 Thread Bill Scherer
Nikola Skoric wrote: > Is there a way to tell the interpreter to display exceptions, even those > which were captured with except? > I believe you are looking for "raise". For example: Try: some.code() except SomeError: do.whatever() raise - Bill -- http://mail.python.org/mailman/lis

forcing exceptions

2006-03-03 Thread Nikola Skoric
Is there a way to tell the interpreter to display exceptions, even those which were captured with except? -- "Now the storm has passed over me I'm left to drift on a dead calm sea And watch her forever through the cracks in the beams Nailed across the doorways of the bedrooms of my dreams" --

Outdated Python Info on www.unicode.org

2006-03-03 Thread Dennis Benzinger
The Unicode Consortium has a page about Unicode Enabled Products . This page contains some really outdated information about Python (like Python 2.3 will come out in a few months). Could someone who knows the current state of Unicode support in Py

Re: help in converting perl re to python re

2006-03-03 Thread Mitja Trampus
>> i have some regular exp code in perl that i want to convert to python. >> if $line =~ m#<(tag1)>(.*)# >>{ >> $variable = $2; >> } > regexp = re.compile(r"<(tag1)>(.*)") > line = "sometext" > match = regexp.search(line) > if match: >variable = match.group(2) Or, if you pre

Re: PyQt issue

2006-03-03 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > I'm trying to write a simple dialog with PyQt. Ive got this code as > one of the slots: > > def setFixed(self): > if len(str(self.fixed_label.displayText())) == 0: > QMessageBox.critical(self, "Label Missing", "You must enter > a label.") >

Re: Tail Call Optimization as a Decorator

2006-03-03 Thread Michel Salim
Neat stuff! I commented on the ActiveState post, but for completeness, I modified your code to support mutual recursions, and used jorend's isTailCall() to make it safe to call an optimized function in a non-tail-call context. http://the-dubois-papers.blogspot.com/2006/03/python-tail-call-decorato

Re: re-posting: web.py, incomplete

2006-03-03 Thread Magnus Lycka
Dennis Lee Bieber wrote: > On 3 Mar 2006 04:01:44 -0800, "_wolf" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > >>it does look like it, no? No, it looks the other way around: You have buffered output, and parts of your stdout never gets flushed. -u is not a problem, it's

Re: PyQt issue

2006-03-03 Thread Phil Thompson
On Friday 03 March 2006 6:39 pm, [EMAIL PROTECTED] wrote: > I'm trying to write a simple dialog with PyQt. Ive got this code as > one of the slots: > > def setFixed(self): > if len(str(self.fixed_label.displayText())) == 0: > QMessageBox.critical(self, "Label Missing", "You

Re: white space in expressions and argument lists

2006-03-03 Thread Magnus Lycka
Sybren Stuvel wrote: > Scott David Daniels enlightened us with: > >>One reason is such code changes too much on code edits, which makes >>code differences hard to read. > > Good point. I'll keep it in mind :) Think particularly about using version management systems and applying patches coming f

Re: How much does Python optimize?

2006-03-03 Thread Scott David Daniels
Blackbird wrote: > I think > > for i in range(10): > > > is more readable than a while loop with explicit incrementation of i. > However, range(10) in the command interpreter obviously returns a list. Is > this list optimized away in the code above, or is it actually constructed > internal

PyQt issue

2006-03-03 Thread dmbkiwi
I'm trying to write a simple dialog with PyQt. Ive got this code as one of the slots: def setFixed(self): if len(str(self.fixed_label.displayText())) == 0: QMessageBox.critical(self, "Label Missing", "You must enter a label.") else: print str(self.fixed

Re: How much does Python optimize?

2006-03-03 Thread Blackbird
Scott David Daniels wrote: > Blackbird wrote: >> I think >> >> for i in range(10): >> >> >> is more readable than a while loop with explicit incrementation of i. > >> However, range(10) in the command interpreter obviously returns a >> list. Is this list optimized away in the code above, or i

Re: ODBC module and strange date reference <...>

2006-03-03 Thread Gerhard Häring
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Magnus Lycka wrote: > [EMAIL PROTECTED] wrote: > >>Been using the ODBC module for Python 2.1 > > > It might well become a problem that you are stuck with > a five year old Python version. Python 2.1 is no longer > a supported Python version. Suppor

Re: Incorrect Decimal-Float behaviour in comparison tests

2006-03-03 Thread Fredrik Lundh
Tim Hochberg wrote: > It's not a bug, but it is a misfeature. In 3.0, I'd love to see > nonsensical comparisons raise TypeError, but still keep the ability to > sort lists of heterogeneous objects. One approach would be keep cmp(x,y) > permissive in its arguments while making __gt__ and friends st

Re: Roundup Issue Tracker release 1.1.1

2006-03-03 Thread george williams
This all looks interesting but I don't know what all this would do for me and I don't understand any of it george - Original Message - From: "Richard Jones" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: ; <[EMAIL PROTECTED]> Sent: Thursday, March 02, 2006 6:40 PM Subject: Roundup Issue

Re: Does '#hash' mean anything in IDLE?

2006-03-03 Thread John Salerno
John Coleman wrote: > How do you like Python so far? So far I'm pretty impressed with its simplicity. Seems like anything I write in 5+ lines can be condensed to one line! :) Coming from C#, it was just such a surprise to see how much easier it is to do things in Python. I'm also interested i

Re: how do you move to a new line in your text editor?

2006-03-03 Thread Mc Osten
On Fri, 03 Mar 2006 16:48:11 GMT, John Salerno wrote: > Why do you say that? Because I tried it and it just lacks a lot of functionality you get with TextMate or Emacs. It is quite stupid when indenting, just to name one. -- USB Priests for only 10$ -- http://mail.python.org/mailman/listinfo/p

Re: ODBC module and strange date reference <...>

2006-03-03 Thread Steve Holden
Scott David Daniels wrote: > Magnus Lycka wrote: > >> Concerning mxODBC, you might want to have a second look >>at it. ... a licence might well be worth its price. > > Yup, it _is_ a great deal. I worked with mxODBC in a former > job at DevelopNET, and (A) the license cost was _low_, and (B

Writing an OPC client with Python ?

2006-03-03 Thread pierlau
Hello, I use an OPC server for connection to DC Drive. I would like to write a small OPC client. I have the dll OPCDAAuto.dll which contains all class and method but I wonder if its possible to instance in python the class that are in the dll ? Thanks for your help . Pierre -- http://mail.p

Re: ODBC module and strange date reference <...>

2006-03-03 Thread Scott David Daniels
Magnus Lycka wrote: > Concerning mxODBC, you might want to have a second look > at it. ... a licence might well be worth its price. Yup, it _is_ a great deal. I worked with mxODBC in a former job at DevelopNET, and (A) the license cost was _low_, and (B) it saved me enough time in the first

Re: Incorrect Decimal-Float behaviour in comparison tests

2006-03-03 Thread Tim Hochberg
Fredrik Lundh wrote: > "Cassiano, Marco" wrote: > > >>I have difficulties with a weird Python 2.4.2 behaviour in comparing >>Decimal to Floats. >> >>For Example : >> >> >> >from decimal import Decimal >a=Decimal('3.7') >b=6.3 >> >if a > b :print a,b,'a is greater than b - NOT TRUE

Re: in need of some sorting help

2006-03-03 Thread Scott David Daniels
ianaré wrote: > > files.sort(key=lambda x: x.lower()) > files.sort(key=lambda x: os.path.dirname(x)) This is exactly why some of us hate lambda. It encourages long-way-around thinking. files.sort(key=lambda x: os.path.dirname(x)) is better written as: files.sort(key=os.path.dirn

Re: Incorrect Decimal-Float behaviour in comparison tests

2006-03-03 Thread Sergei Organov
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > "Cassiano, Marco" wrote: > >> I have difficulties with a weird Python 2.4.2 behaviour in comparing >> Decimal to Floats. >> >> For Example : >> >> >> >>> from decimal import Decimal >> >>> a=Decimal('3.7') >> >>> b=6.3 >> >> >>> if a > b :print a,b,'a

  1   2   3   >