Re: Modify an exception before re-raising it

2009-03-05 Thread Steve Holden
Steven D'Aprano wrote: > I wish to catch an exception, modify the error message, and re-raise it. > There are two ways I know of to do this, with subtly different effects: > def raise_example1(): > ... try: > ... None() > ... except TypeError, e: > ... e.args =

Re: Translating pysnmp oids to human readable strings

2009-03-05 Thread SpamMePlease PleasePlease
On Fri, Mar 6, 2009 at 1:10 AM, birdsong wrote: > On Mar 5, 2:30 pm, SpamMePlease PleasePlease > wrote: >> On Thu, Mar 5, 2009 at 10:12 PM, birdsong wrote: >> > On Mar 5, 1:05 pm, birdsong wrote: >> >> On Mar 5, 12:32 pm, SpamMePlease PleasePlease >> >> >> wrote: >> >> > Hey list, >> >> >> > I

Re: Translating pysnmp oids to human readable strings

2009-03-05 Thread SpamMePlease PleasePlease
On Fri, Mar 6, 2009 at 6:56 AM, Shantanu Joshi wrote: > You need to parse the MIB file to get the human-readable names > corresponding to the OIDs. The pysnmp library already provides this > functionality. I haven't used this feature myself (I mainly use pysnmp > to automate SNMP walk requests, li

Re: Modify an exception before re-raising it

2009-03-05 Thread Gabriel Genellina
En Fri, 06 Mar 2009 04:29:16 -0200, Steven D'Aprano escribió: I wish to catch an exception, modify the error message, and re-raise it. There are two ways I know of to do this, with subtly different effects: def raise_example1(): ... try: ... None() ... except TypeError,

Re: Will multithreading make python less popular?

2009-03-05 Thread Hendrik van Rooyen
"Aahz" wrote: > In article , > Hendrik van Rooyen wrote: > >If Aahz was trolling, then he got me. I know about William of Occam, > >after whom the language was named, and his razor, but did not make the > >association, and answered seriously. > > Not trolling, but making a joke. Not always eas

Re: How to import Python files in the other directories?

2009-03-05 Thread Christian Heimes
Muddy Coder schrieb: > Hi Folks, > > If I have a python file foo.py in the current directory, I can simply > import it in the way below: > > import foo > > when a project keeps grow, more and more Python files are created, and > they are also needed to put into different directories. Then, a > p

Re: How to import Python files in the other directories?

2009-03-05 Thread Ben Finney
Muddy Coder writes: > If I have a python file foo.py in the current directory, I can > simply import it in the way below: > > import foo Because the current directory, '.', is in the import search path. > when a project keeps grow, more and more Python files are created, > and they are also ne

Re: Packaging modules with Bundlebuilder

2009-03-05 Thread DLitgo
On Mar 4, 1:34 am, "Diez B. Roggisch" wrote: > DLitgo schrieb: > > > Hello everyone, > > > I'm curious about creating .app files for the mac using bundlebuilder > > (or py2app or even py2exe). I'm just about done creating a GUI for a > > little set of scripts which basically perform batch image ed

Re: Modify an exception before re-raising it

2009-03-05 Thread Chris Rebert
On Thu, Mar 5, 2009 at 10:29 PM, Steven D'Aprano wrote: > I wish to catch an exception, modify the error message, and re-raise it. > There are two ways I know of to do this, with subtly different effects: > def raise_example1(): > ...     try: > ...             None() > ...     except TypeErr

How to import Python files in the other directories?

2009-03-05 Thread Muddy Coder
Hi Folks, If I have a python file foo.py in the current directory, I can simply import it in the way below: import foo when a project keeps grow, more and more Python files are created, and they are also needed to put into different directories. Then, a problem comes: how to import the Python fi

Reading Special Administration Console (SAC) in python

2009-03-05 Thread krishnakishore . nakarikanti
Hi All, I want to read the Special Administration Console (SAC) output spew using python. Is it possible for me? If yes, please help me how to do that? Thanks, Kishore -- http://mail.python.org/mailman/listinfo/python-list

Re: Translating pysnmp oids to human readable strings

2009-03-05 Thread Shantanu Joshi
You need to parse the MIB file to get the human-readable names corresponding to the OIDs. The pysnmp library already provides this functionality. I haven't used this feature myself (I mainly use pysnmp to automate SNMP walk requests, like the one in your code), but the documentation at found the be

Modify an exception before re-raising it

2009-03-05 Thread Steven D'Aprano
I wish to catch an exception, modify the error message, and re-raise it. There are two ways I know of to do this, with subtly different effects: >>> def raise_example1(): ... try: ... None() ... except TypeError, e: ... e.args = ('modified error message',) + e.args[

Re: Roulette wheel

2009-03-05 Thread Peter Pearson
On 05 Mar 2009 20:43:41 GMT, mattia wrote: >> for a, b in zip(*[iter(pop)]*2): > In the python documentation there is a similar example, well, the obscure > thing here is the usage of *[iter(pop)]! Then I believe that I can safely > say that you iterate over the values 0 and 1, 2 and 3 etc.

RE: Help required to read and print lines based on the type of first character

2009-03-05 Thread Abhinayaraj . Raju
-Original Message- From: Bruno Desthuilliers [mailto:bruno.42.desthuilli...@websiteburo.invalid] Sent: Thursday, March 05, 2009 10:45 PM To: python-list@python.org Subject: Re: Help required to read and print lines based on the type of first character abhinayaraj.r...@emulex.com a écrit

Re: Python3 on the Web

2009-03-05 Thread John Nagle
Jean-Paul Calderone wrote: On Thu, 05 Mar 2009 18:13:05 +0100, Johannes Permoser wrote: Hi, I wanted to learn Python from scratch and start off with Version 3. Since I already know PHP very well, I thought it would be nice to start off with a small web-project. But what's the way to bring pyt

Re: alias method definitions / syntactic sugar suggestion

2009-03-05 Thread Terry Reedy
Tennessee Leeuwenburg wrote: I'm not sure if this problem I face affects many other people, but I'll just describe it and see what kind of feedback I get. I have a suggestion for a new piece of Python syntax when defining methods. I have seen the following done, and have done it myself clas

Re: alias method definitions / syntactic sugar suggestion

2009-03-05 Thread Tennessee Leeuwenburg
On Fri, Mar 6, 2009 at 3:39 PM, Chris Rebert wrote: > On Thu, Mar 5, 2009 at 6:17 PM, Tennessee Leeuwenburg > wrote: > > I'm not sure if this problem I face affects many other people, but I'll > just > > describe it and see what kind of feedback I get. > > > > I have a suggestion for a new piece

Re: [PyGTK] Singleton Window

2009-03-05 Thread alex goretoy
Correction, it's not True singleton. -Alex Goretoy http://www.goretoy.com On Thu, Mar 5, 2009 at 10:38 PM, alex goretoy wrote: > Hello All, > > I am trying to create a singleton window in pygtk and for the life of me > can't seem to figure out a better way to go about doing this. The way I

Re: alias method definitions / syntactic sugar suggestion

2009-03-05 Thread Chris Rebert
On Thu, Mar 5, 2009 at 6:17 PM, Tennessee Leeuwenburg wrote: > I'm not sure if this problem I face affects many other people, but I'll just > describe it and see what kind of feedback I get. > > I have a suggestion for a new piece of Python syntax when defining methods. > I have seen the following

[PyGTK] Singleton Window

2009-03-05 Thread alex goretoy
Hello All, I am trying to create a singleton window in pygtk and for the life of me can't seem to figure out a better way to go about doing this. The way I'm doing it now is to recreate the window and show it. Example code is below. I would much appreciate any assistance in this matter. I've googl

Re: Can Python do shopping cart?

2009-03-05 Thread Luis Gonzalez
Python can do. On 5 mar, 19:30, Muddy Coder wrote: > Hi Folks, > > I know PHP can do shopping cart, such as Zen Cart. I wonder can Python > do such a thing? Thanks! > > Muddy Coder -- http://mail.python.org/mailman/listinfo/python-list

Re: Indentations and future evolution of languages

2009-03-05 Thread Paul Rubin
bearophileh...@lycos.com writes: > Indentation-wise Haskell syntax seems one of the very few local maxima > that is close enough to the little fitness plateau where Python is. It is odd, the article claims indentation-aware syntax only works in languages that separate statement and expressions, bu

Re: Sphinx for API documentation

2009-03-05 Thread melevine
On Mar 5, 5:38 pm, Robert Kern wrote: > On 2009-03-05 19:23, Paul Hildebrandt wrote: > > > Thanks, I've been playing with that but I believe it assumes a reST > > structure you build, then use autodoc to bring in your code's > > docstrings.  I would rather not hand generate the main reST > > struc

Re: Indentations and future evolution of languages

2009-03-05 Thread Martin P. Hellwig
bearophileh...@lycos.com wrote: Living on a small fitness plateau isn't good, even if it's very high, because it's evolutionary unstable :-( Actually I think, in biological sense speaking [citation needed], if one path has an advantage over the other path, even if the other path is in majori

Re: Indentations and future evolution of languages

2009-03-05 Thread Steven D'Aprano
bearophileh...@lycos.com wrote: > This is an interesting post, it shows me that fitness plateau where > design of Python syntax lives is really small, you can't design > something just similar: > > http://unlimitednovelty.com/2009/03/indentation-sensitivity-post-mortem.html > > Living on a small

alias method definitions / syntactic sugar suggestion

2009-03-05 Thread Tennessee Leeuwenburg
I'm not sure if this problem I face affects many other people, but I'll just describe it and see what kind of feedback I get. I have a suggestion for a new piece of Python syntax when defining methods. I have seen the following done, and have done it myself class FanstasticClass: def __init

Indentations and future evolution of languages

2009-03-05 Thread bearophileHUGS
This is an interesting post, it shows me that fitness plateau where design of Python syntax lives is really small, you can't design something just similar: http://unlimitednovelty.com/2009/03/indentation-sensitivity-post-mortem.html Living on a small fitness plateau isn't good, even if it's very

Re: help understanding class or function

2009-03-05 Thread Rhodri James
Please don't top-post. On Fri, 06 Mar 2009 01:09:48 -, Vincent Davis wrote: I guess I am thinking of it as an operation that I am preforming on a list and not making a new list. Also looking to learn better methods. This is difficult when you are working alone. It is difficult to know

Re: Sphinx for API documentation

2009-03-05 Thread Robert Kern
On 2009-03-05 19:23, Paul Hildebrandt wrote: Thanks, I've been playing with that but I believe it assumes a reST structure you build, then use autodoc to bring in your code's docstrings. I would rather not hand generate the main reST structure. I am hoping to use Sphinx like Epydoc and just ru

Re: Will multithreading make python less popular?

2009-03-05 Thread Aahz
In article , Hendrik van Rooyen wrote: >"Ben Finney" wrote: >>a...@pythoncraft.com (Aahz) writes: >>> In article , >>> Hendrik van Rooyen wrote: Occam was the language that should have won the marketing prize, but didn't. >>> >>> It wasn't simple enough. >> >>*bdom-tsssh* http://en

Re: problem with pydoc under python 2.6.1

2009-03-05 Thread steve . ferg . bitbucket
Problem solved Yinon's messages prompted me to take another look at my own code (below). I realized that in the batch file I am looking for pydoc.py in different locations for Python25 and Python26, but I am executing python.exe without changing the path. Which means that I am executing the same

Re: help understanding class or function

2009-03-05 Thread andrew cooke
Vincent Davis wrote: > I guess I am thinking of it as an operation that I am preforming on a list > and not making a new list. Also looking to learn better methods. This is > difficult when you are working alone. It is difficult to know where to > improve. python occupies a strange place. in some

Re: Sphinx for API documentation

2009-03-05 Thread Paul Hildebrandt
On Mar 5, 1:22 pm, Benjamin Peterson wrote: > 2009/3/5 andrew cooke : > > > Benjamin Peterson wrote: > >> Paul Hildebrandt yahoo.com> writes: > >>> I really like the look of Sphinx BUT I want autogenerated > >>> documentation like Epydoc/doxygen.  Does anyone know of a frontend for > >>> Sphix th

Re: help understanding class or function

2009-03-05 Thread Vincent Davis
I guess I am thinking of it as an operation that I am preforming on a list and not making a new list. Also looking to learn better methods. This is difficult when you are working alone. It is difficult to know where to improve. The actual functions I am making are more complicated than this example

Re: Dr Dobbs' Python Weekly URL Archive?

2009-03-05 Thread Steve Holden
Mike Driscoll wrote: > On Mar 5, 6:15 am, Steve Holden wrote: >> Hendrik van Rooyen wrote: >>> "Steve Holden" wrote: My well-known-search-engine-foo must be at an all-time low today. *Is* there an index and I can't see for looking? >>> typing in python weekly at google gives me: >>> Py

Re: distutils: "build" command

2009-03-05 Thread Gabriel Genellina
En Thu, 05 Mar 2009 14:10:38 -0200, TP escribió: Hi everybody, I have programmed a python package, and I would like to use distutils with it. My package has the following structure after doing sdist and build: $ python setup.py sdist [...] $ python setup.py build [...] $ tree . |-- MANIF

Re: Can Python do shopping cart?

2009-03-05 Thread Jason Scheirer
On Mar 5, 2:30 pm, Muddy Coder wrote: > Hi Folks, > > I know PHP can do shopping cart, such as Zen Cart. I wonder can Python > do such a thing? Thanks! > > Muddy Coder http://www.satchmoproject.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Translating pysnmp oids to human readable strings

2009-03-05 Thread birdsong
On Mar 5, 2:30 pm, SpamMePlease PleasePlease wrote: > On Thu, Mar 5, 2009 at 10:12 PM, birdsong wrote: > > On Mar 5, 1:05 pm, birdsong wrote: > >> On Mar 5, 12:32 pm, SpamMePlease PleasePlease > > >> wrote: > >> > Hey list, > > >> > I was given a task, to reproduce functionality of command spec

Re: help understanding class or function

2009-03-05 Thread Gabriel Genellina
En Thu, 05 Mar 2009 14:43:12 -0200, Vincent Davis escribió: If I have a list and I what to make changes to it.a = [1,2,3,4,5,6,7,8,9] and maybe I want to drop the odd and double the even numbers and I will need to do this repeatedly. How is this best done? That is as a function or class. All

In search of the click track

2009-03-05 Thread andrew cooke
thought people might find this article on drummer's "click tracks" interesting - http://musicmachinery.com/2009/03/02/in-search-of-the-click-track/ here's the python lib used - http://developer.echonest.com/docs/method/remix/ andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: [pysqlite] [ANN] pysqlite 2.5.2

2009-03-05 Thread Steve Holden
Edzard Pasma wrote: > Hello, > > It looks that the issue with fetch across rollback still can occur in the new > version. It turned up when I applied the Pysqlite transaction test suite to > some dbapi2 version of my own. Below is a minimal script to reproduce it. It > has puzzled me what goes

Re: question about ctrl-d and atexit with threads

2009-03-05 Thread Gabriel Genellina
En Thu, 05 Mar 2009 15:26:18 -0200, Darren Dale escribió: On Mar 5, 12:02 pm, s...@pobox.com wrote: What happens if you simply call     my_thread.setDaemon(True) (or in Python 2.6):     my_thread.daemon = True ?  That is the documented way to exit worker threads when you want the applica

RE: Parsing/Crawler Questions - solution

2009-03-05 Thread bruce
hi john... update... further investigation has revealed that apparently, for some urls/sites, the server serves up pages that take awhile to be fetched... this appears to be a potential problem, in that it appears that the parsescript never gets anything from the python mech/urllib read function

Re: Can Python do shopping cart?

2009-03-05 Thread Joe Riopel
On Thu, Mar 5, 2009 at 5:40 PM, SpamMePlease PleasePlease wrote: > Python can do that and a lot more! For this purpose I would go to > http://djangoproject.com/ Django is neat, but there are more choices for you: http://wiki.python.org/moin/WebFrameworks -- http://mail.python.org/mailman/listinfo

Re: Python3 on the Web

2009-03-05 Thread Graham Dumpleton
On Mar 6, 4:13 am, Johannes Permoser wrote: > Hi, > > I wanted to learn Python from scratch and start off with Version 3. > Since I already know PHP very well, I thought it would be nice to start > off with a small web-project. > > But what's the way to bring python3 to the Web? > mod_python isn't

Re: Can Python do shopping cart?

2009-03-05 Thread SpamMePlease PleasePlease
On Thu, Mar 5, 2009 at 11:30 PM, Muddy Coder wrote: > Hi Folks, > > I know PHP can do shopping cart, such as Zen Cart. I wonder can Python > do such a thing? Thanks! > > > > Muddy Coder > -- > http://mail.python.org/mailman/listinfo/python-list > Python can do that and a lot more! For this purpos

Re: Shared library Python on Mac OS X 64-bit

2009-03-05 Thread Graham Dumpleton
On Mar 6, 6:24 am, Uberman wrote: > Graham Dumpleton wrote: > > > I don't understand the problem, you can say where it installs the > > framework, it doesn't have to be under /Library, so can be in your > > special SDK folder. For example: > > > ./configure --prefix=/usr/local/python-2.5.4  \ > >

Can Python do shopping cart?

2009-03-05 Thread Muddy Coder
Hi Folks, I know PHP can do shopping cart, such as Zen Cart. I wonder can Python do such a thing? Thanks! Muddy Coder -- http://mail.python.org/mailman/listinfo/python-list

Re: Translating pysnmp oids to human readable strings

2009-03-05 Thread SpamMePlease PleasePlease
On Thu, Mar 5, 2009 at 10:12 PM, birdsong wrote: > On Mar 5, 1:05 pm, birdsong wrote: >> On Mar 5, 12:32 pm, SpamMePlease PleasePlease >> >> >> >> wrote: >> > Hey list, >> >> > I was given a task, to reproduce functionality of command specified >> > below by writing proper python functions to re

Re: Reading a file

2009-03-05 Thread John Machin
On Mar 6, 1:28 am, MRAB wrote: > Aahz wrote: > > In article , > > Terry Reedy   wrote: > >> for line in open('char.txt'): > >>   if line.find('sweet') != -1 or line.find('blue') != -1: > >>     print(line) > > > For any recent Python, this should be: > > >     if 'sweet' in line or 'blue' in line:

Re: Sphinx for API documentation

2009-03-05 Thread Benjamin Peterson
2009/3/5 andrew cooke : > Benjamin Peterson wrote: >> Paul Hildebrandt yahoo.com> writes: >>> I really like the look of Sphinx BUT I want autogenerated >>> documentation like Epydoc/doxygen.  Does anyone know of a frontend for >>> Sphix that will make it work like Epydoc? >> >> There's a Sphinx ex

Re: Translating pysnmp oids to human readable strings

2009-03-05 Thread birdsong
On Mar 5, 1:05 pm, birdsong wrote: > On Mar 5, 12:32 pm, SpamMePlease PleasePlease > > > > wrote: > > Hey list, > > > I was given a task, to reproduce functionality of command specified > > below by writing proper python functions to reuse in some monitoring > > script: > > > rivendell# snmpwalk

Re: Translating pysnmp oids to human readable strings

2009-03-05 Thread birdsong
On Mar 5, 12:32 pm, SpamMePlease PleasePlease wrote: > Hey list, > > I was given a task, to reproduce functionality of command specified > below by writing proper python functions to reuse in some monitoring > script: > > rivendell# snmpwalk -Os -mALL -v1 -cgabilgathol 10.0.6.66 > .1.3.6.1.4.1.263

Re: Roulette wheel

2009-03-05 Thread mattia
Il Thu, 05 Mar 2009 18:07:29 +0100, Peter Otten ha scritto: > mattia wrote: > >> The last question: how can I improve readability in this piece of code? >> >> def crossover(pop, prob=0.6): >> """ >> With a crossover probability cross over the parents to form new >> offspring. If no c

Re: Inverse of dict(zip(x,y))

2009-03-05 Thread Carl Banks
On Mar 5, 9:01 am, Tino Wildenhain wrote: > Piet van Oostrum wrote: > >> Andre Engels (AE) wrote: > > >> AE> On Wed, Mar 4, 2009 at 11:02 AM, lone_eagle wrote: > Can someone suggest a easy method to do the inverse of dict(zip(x,y)) > to get two lists x and y? > > So, if x and

Re: Roulette wheel

2009-03-05 Thread mattia
> for a, b in zip(*[iter(pop)]*2): In the python documentation there is a similar example, well, the obscure thing here is the usage of *[iter(pop)]! Then I believe that I can safely say that you iterate over the values 0 and 1, 2 and 3 etc. because the zip automatically updates the index, i

Translating pysnmp oids to human readable strings

2009-03-05 Thread SpamMePlease PleasePlease
Hey list, I was given a task, to reproduce functionality of command specified below by writing proper python functions to reuse in some monitoring script: rivendell# snmpwalk -Os -mALL -v1 -cgabilgathol 10.0.6.66 .1.3.6.1.4.1.2636.5.1.1.2 jnxBgpM2PeerIdentifier.0.ipv4."".unknown."".0.1.38.101.87.

Re: Sphinx for API documentation

2009-03-05 Thread andrew cooke
Benjamin Peterson wrote: > Paul Hildebrandt yahoo.com> writes: >> I really like the look of Sphinx BUT I want autogenerated >> documentation like Epydoc/doxygen. Does anyone know of a frontend for >> Sphix that will make it work like Epydoc? > > There's a Sphinx extension called autodoc which sho

Re: Sphinx for API documentation

2009-03-05 Thread Benjamin Peterson
Paul Hildebrandt yahoo.com> writes: > > I really like the look of Sphinx BUT I want autogenerated > documentation like Epydoc/doxygen. Does anyone know of a frontend for > Sphix that will make it work like Epydoc? There's a Sphinx extension called autodoc which should help you. -- http://m

Re: Roulette wheel

2009-03-05 Thread mattia
Il Thu, 05 Mar 2009 15:48:01 +, mattia ha scritto: > Il Wed, 04 Mar 2009 21:30:54 +0100, Peter Otten ha scritto: > >> mattia wrote: >> >>> Hi everyone, I'm new to python and I want to create some simple code >>> in order to code the classical genetic algorithm example: given a >>> population

Re: While loop

2009-03-05 Thread J Kenneth King
Fab86 writes: > On Mar 5, 5:23 pm, Marco Mariani wrote: >> Fab86 wrote: >> > Is it possible to get the program to catch the exception, wait 10 >> > seconds, then carry of from where it was rather than starting again? >> >> something like this? probably works in PASCAL as well :) >> >> > i=0 >> >

Re: Roulette wheel

2009-03-05 Thread Peter Pearson
On Thu, 05 Mar 2009 18:07:29 +0100, Peter Otten <__pete...@web.de> wrote: [snip] > > Just for fun here's an alternative version of your function > > def generate_crossover(pop, prob): > for a, b in zip(*[iter(pop)]*2): . . . Good grief! That's devilishly obscure. -- To email me, substitute

logging.handlers.SocketHandler

2009-03-05 Thread writeson
Hi everyone, I wrote a logging server that receives messages from logging.handlers.SocketHandler objects in client Python programs. This works well so long as the client programs are start/stop affairs. However, if the client is also a long running daemon a problem shows up. If the logging server

Re: Can't override class |__new__

2009-03-05 Thread jelle feringa
> Aaron explained it better than I did. Basically the C/C++ module uses > C/C++ version of Facet class directly without consulting python > interpreter, this is what I meant by static linking. Thanks so much for the explanation Lie, I understood it fully now. Thanks again, -jelle -- http:

Re: Shared library Python on Mac OS X 64-bit

2009-03-05 Thread Uberman
Graham Dumpleton wrote: > > I don't understand the problem, you can say where it installs the > framework, it doesn't have to be under /Library, so can be in your > special SDK folder. For example: > > ./configure --prefix=/usr/local/python-2.5.4 \ > --enable-framework=/usr/local/python-2.5.4/fra

Re: While loop

2009-03-05 Thread Fab86
On Mar 5, 5:49 pm, Fab86 wrote: > On Mar 5, 5:23 pm, Marco Mariani wrote: > > > > > Fab86 wrote: > > > Is it possible to get the program to catch the exception, wait 10 > > > seconds, then carry of from where it was rather than starting again? > > > something like this? probably works in PASCAL a

Re: While loop

2009-03-05 Thread Chris Rebert
On Thu, Mar 5, 2009 at 9:49 AM, Fab86 wrote: > On Mar 5, 5:23 pm, Marco Mariani wrote: >> Fab86 wrote: >> > Is it possible to get the program to catch the exception, wait 10 >> > seconds, then carry of from where it was rather than starting again? > using sleep and then continue just makes the s

Re: While loop

2009-03-05 Thread Andre Engels
On Thu, Mar 5, 2009 at 6:49 PM, Fab86 wrote: > On Mar 5, 5:23 pm, Marco Mariani wrote: >> Fab86 wrote: >> > Is it possible to get the program to catch the exception, wait 10 >> > seconds, then carry of from where it was rather than starting again? >> >> something like this? probably works in PASC

RE: Parsing/Crawler Questions - solution

2009-03-05 Thread bruce
john... again the problem i'm facing really has nothing to do with a specific url... the app i have for the usc site works... but for any number of reasons... you might get different results when running the app.. -the server could be screwed up.. -data might be cached -data might be changed,

Re: Inverse of dict(zip(x,y))

2009-03-05 Thread Andre Engels
On Thu, Mar 5, 2009 at 7:46 PM, Andre Engels wrote: > If the dict = {key1: val1, key2: val2, ...}, you can do: > > for key in dict: >    plot(key,dictionary[key]) Of course I meant: for key in dict: plot(key,dict[key]) -- André Engels, andreeng...@gmail.com -- http://mail.python.org/mail

Re: Inverse of dict(zip(x,y))

2009-03-05 Thread Andre Engels
On Thu, Mar 5, 2009 at 7:07 PM, psykeedelik wrote: > I usually get properties that I compute, in a dictionary like property > = [key1: val1, key2:val2, ...] and then I usually want to plot them in > pylab, which AFAIK requires x and y as lists for the plot argument. > Then I need to get the lists

Re: Parsing/Crawler Questions - solution

2009-03-05 Thread John Nagle
Philip Semanchuk wrote: On Mar 5, 2009, at 12:31 PM, bruce wrote: hi.. the url i'm focusing on is irrelevant to the issue i'm trying to solve at this time. Not if we're to understand the situation you're trying to describe. From what I can tell, you're saying that the target site displays d

Re: Inverse of dict(zip(x,y))

2009-03-05 Thread psykeedelik
On Mar 5, 6:01 pm, Tino Wildenhain wrote: > Piet van Oostrum wrote: > >> Andre Engels (AE) wrote: > > >> AE> On Wed, Mar 4, 2009 at 11:02 AM, lone_eagle wrote: > Can someone suggest a easy method to do the inverse of dict(zip(x,y)) > to get two lists x and y? > > So, if x and

Re: Python3 on the Web

2009-03-05 Thread Christian Heimes
Johannes Permoser wrote: > But what's the way to bring python3 to the Web? > mod_python isn't available, cgi is said to be slow, mod_wsgi looks > complicated... WSGI is the right way to go. It's *the* Python standard for web application interfaces. You don't need mod_wsgi and Apache to run a WSGI

Re: Roulette wheel

2009-03-05 Thread Scott David Daniels
mattia wrote: ... The last question: how can I improve readability in this piece of code? def crossover(pop, prob=0.6): """ With a crossover probability cross over the parents to form new offspring. If no crossover was performed, offspring is the exact copy of parents. """ c

Re: Pickle Problem

2009-03-05 Thread MRAB
Fab86 wrote: On Mar 4, 2:49 pm, MRAB wrote: Fab86 wrote: On Mar 4, 1:40 am, "Gabriel Genellina" wrote: En Tue, 03 Mar 2009 23:11:30 -0200, Fab86 escribió: On Mar 4, 12:00 am, MRAB wrote: Fab86 wrote: On Mar 3, 8:59 pm, "Gabriel Genellina" wrote: How to "spell" exactly the exception nam

Re: While loop

2009-03-05 Thread Fab86
On Mar 5, 5:23 pm, Marco Mariani wrote: > Fab86 wrote: > > Is it possible to get the program to catch the exception, wait 10 > > seconds, then carry of from where it was rather than starting again? > > something like this? probably works in PASCAL as well :) > > > i=0 > > while i < len(stuff): > >

Re: Inverse of dict(zip(x,y))

2009-03-05 Thread Andre Engels
On Thu, Mar 5, 2009 at 6:01 PM, Tino Wildenhain wrote: > Still I'd like to see an application where this really matters (that > keys() and values() match in order) I think there are many such applications, but also that in each of those cases it's a mis-programming of something that would be don

Re: Parsing/Crawler Questions..

2009-03-05 Thread Philip Semanchuk
On Mar 5, 2009, at 12:31 PM, bruce wrote: hi.. the url i'm focusing on is irrelevant to the issue i'm trying to solve at this time. Not if we're to understand the situation you're trying to describe. From what I can tell, you're saying that the target site displays different results e

RE: Parsing/Crawler Questions..

2009-03-05 Thread bruce
hi.. the url i'm focusing on is irrelevant to the issue i'm trying to solve at this time. i think an approach will be to fire up a number of parsing attempts, and to track the returned depts/classes/etc... in theory (hopefully) i should be able to create a process to build a kind of statistical r

Re: question about ctrl-d and atexit with threads

2009-03-05 Thread Darren Dale
On Mar 5, 12:02 pm, s...@pobox.com wrote: > What happens if you simply call > >     my_thread.setDaemon(True) > > (or in Python 2.6): > >     my_thread.daemon = True > > ?  That is the documented way to exit worker threads when you want the > application to exit.  From the threading module docs: >

Re: Python3 on the Web

2009-03-05 Thread Bruno Desthuilliers
Johannes Permoser a écrit : Hi, I wanted to learn Python from scratch and start off with Version 3. Since I already know PHP very well, I thought it would be nice to start off with a small web-project. But what's the way to bring python3 to the Web? mod_python isn't available, cgi is said to be

Re: While loop

2009-03-05 Thread Marco Mariani
Fab86 wrote: Is it possible to get the program to catch the exception, wait 10 seconds, then carry of from where it was rather than starting again? something like this? probably works in PASCAL as well :) i=0 while i < len(stuff): try: do_with(stuff[i]) except SomeError: s

Sphinx for API documentation

2009-03-05 Thread Paul Hildebrandt
I really like the look of Sphinx BUT I want autogenerated documentation like Epydoc/doxygen. Does anyone know of a frontend for Sphix that will make it work like Epydoc? Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Python3 on the Web

2009-03-05 Thread Jean-Paul Calderone
On Thu, 05 Mar 2009 18:13:05 +0100, Johannes Permoser wrote: Hi, I wanted to learn Python from scratch and start off with Version 3. Since I already know PHP very well, I thought it would be nice to start off with a small web-project. But what's the way to bring python3 to the Web? mod_python

Re: While loop

2009-03-05 Thread Tino Wildenhain
Hi, Fab86 wrote: Hello, I am currently working on my program which send queries to Yahoo and then saves them into a flatfile. The problem I have is that I need to conduct 200 searches and Yahoo typically times out during the search with an error. I have caught the error and told it to time.slee

Re: Help required to read and print lines based on the type of first character

2009-03-05 Thread Bruno Desthuilliers
abhinayaraj.r...@emulex.com a écrit : Please, don't top-post, and learn to quote & snip (if you don't know what top-posting is, google is your friend). Thank you so much for your guidance, Bruno. This should help me in a long way. Here is the code I have written. path = raw_input("\nEnter

Python3 on the Web

2009-03-05 Thread Johannes Permoser
Hi, I wanted to learn Python from scratch and start off with Version 3. Since I already know PHP very well, I thought it would be nice to start off with a small web-project. But what's the way to bring python3 to the Web? mod_python isn't available, cgi is said to be slow, mod_wsgi looks complica

Re: Roulette wheel

2009-03-05 Thread Peter Otten
mattia wrote: > The last question: how can I improve readability in this piece of code? > > def crossover(pop, prob=0.6): > """ > With a crossover probability cross over the parents to form new > offspring. If no crossover was performed, offspring is the exact copy > of parents. "

While loop

2009-03-05 Thread Fab86
Hello, I am currently working on my program which send queries to Yahoo and then saves them into a flatfile. The problem I have is that I need to conduct 200 searches and Yahoo typically times out during the search with an error. I have caught the error and told it to time.sleep(10) however I can

Re: question about ctrl-d and atexit with threads

2009-03-05 Thread skip
What happens if you simply call my_thread.setDaemon(True) (or in Python 2.6): my_thread.daemon = True ? That is the documented way to exit worker threads when you want the application to exit. From the threading module docs: "The entire Python program exits when no alive non-daem

Re: Inverse of dict(zip(x,y))

2009-03-05 Thread Tino Wildenhain
Piet van Oostrum wrote: Andre Engels (AE) wrote: AE> On Wed, Mar 4, 2009 at 11:02 AM, lone_eagle wrote: Can someone suggest a easy method to do the inverse of dict(zip(x,y)) to get two lists x and y? So, if x and y are two lists, it is easier to make a dictionary using d = dict(zip(x,y)),

Re: Pickle Problem

2009-03-05 Thread Fab86
On Mar 4, 2:49 pm, MRAB wrote: > Fab86 wrote: > > On Mar 4, 1:40 am, "Gabriel Genellina" wrote: > >> En Tue, 03 Mar 2009 23:11:30 -0200, Fab86 escribió: > > >>> On Mar 4, 12:00 am, MRAB wrote: > Fab86 wrote: > > On Mar 3, 8:59 pm, "Gabriel Genellina" wrote: > >> How to "spell" exa

help understanding class or function

2009-03-05 Thread Vincent Davis
If I have a list and I what to make changes to it.a = [1,2,3,4,5,6,7,8,9] and maybe I want to drop the odd and double the even numbers and I will need to do this repeatedly. How is this best done? That is as a function or class. All I know how to do is def doubleeven(alist): blist = [2*x for

Re: String Identity Test

2009-03-05 Thread Terry Reedy
Terry Reedy wrote: Hendrik van Rooyen wrote: "S Arrowsmith" wrote: "Small" integers get a similar treatment: a = 256 b = 256 a is b True a = 257 b = 257 a is b False This is weird - I would have thought that the limit of "small" would be at 255 - the biggest number to fit in a byte. 2

Re: How to access a containing objects properties from an object inside.

2009-03-05 Thread nuwandame
Aaron Brady wrote: > On Mar 5, 9:51 am, nuwandame wrote: >> Aaron Brady wrote: >>> On Mar 5, 8:44 am, nuwandame wrote: I have two objects obj1 and obj2. Inside obj1 there is an attribute for success (obj1.success) and for containing other objects (obj1.data) I am using setattr() to

Re: distutils: "build" command

2009-03-05 Thread andrew cooke
don't know if this is useful, but setuptools is a plug-in replacement for distutils that makes this kind of thing easier (i think). http://peak.telecommunity.com/DevCenter/setuptools andrew TP wrote: > Hi everybody, > > I have programmed a python package, and I would like to use distutils with

distutils: "build" command

2009-03-05 Thread TP
Hi everybody, I have programmed a python package, and I would like to use distutils with it. My package has the following structure after doing sdist and build: $ python setup.py sdist [...] $ python setup.py build [...] $ tree . |-- MANIFEST |-- MANIFEST.in |-- README |-- build | `-- lib |

Re: String Identity Test

2009-03-05 Thread Terry Reedy
Hendrik van Rooyen wrote: "S Arrowsmith" wrote: "Small" integers get a similar treatment: a = 256 b = 256 a is b True a = 257 b = 257 a is b False This is weird - I would have thought that the limit of "small" would be at 255 - the biggest number to fit in a byte. 256 takes two bytes,

  1   2   >