menu and file

2009-12-25 Thread hong zhang
List, I want to read a file that has a list of data into a menu. User can pick up a line of data and execute it. For example, file has data like following 1 23 0x4530 2 42 0x8790 3 75 0x7684 . User can select line # and then execute hex data in that line. Any sample codes will b

Re: Is it possible to get the erroneous variable when getting a NameError exception?

2009-12-25 Thread Stephen Hansen
On Fri, Dec 25, 2009 at 8:00 PM, Dave Angel wrote: > Dotan Barak wrote: >>> >>> Recover the exception, and examine the tuple of args or the message >>> string. >>> >>> try: >>> ... eval("my_number < 10", {"__builtins__":None}, {}) >>> ... except NameError,e: >>> ... print e.args

Re: Extra fields for logging

2009-12-25 Thread Steven D'Aprano
On Fri, 25 Dec 2009 12:07:20 -0800, Joan Miller wrote: > On 25 dic, 13:24, Steven D'Aprano cybersource.com.au> wrote: >> On Thu, 24 Dec 2009 05:06:48 -0800, Joan Miller wrote: >> > I'm trying to add some extra fields to logging, I'm following this >> > information [1] but it faills in my case. >>

Re: how to register with pypi - no such setup.py

2009-12-25 Thread Phlip
On Dec 24, 3:32 am, "Martin v. Loewis" wrote: > > Any tips? > > A binary distribution won't have a setup.py, because > you can install it by other means (such as Windows Installer), > instead of running setup.py > > What you want is a source distribution (sdist). Thanks. Yes, this is prob'ly docu

Re: Is it possible to get the erroneous variable when getting a NameError exception?

2009-12-25 Thread Dave Angel
Dotan Barak wrote: On 25/12/2009 19:27, Gary Herron wrote: Dotan Barak wrote: Recover the exception, and examine the tuple of args or the message string. >>> try: ... eval("my_number < 10", {"__builtins__":None}, {}) ... except NameError,e: ... print e.args ... print e

how to save a modified .xml back

2009-12-25 Thread Hyunchul Kim
Hi all, I want to load a small .xml file, modifiy some nodes and save the .xml with modifications to another .xml file. I managed to load and modify a small .xml file using xml.dom.minidom and xml.dom.pulldom. However, I don't know how to save it back using any of two modules. Any suggestion?

Re: How do I install GMPY 1.11 on a Mac with OS X 10.6 and Python 3.1?

2009-12-25 Thread Benjamin Kaplan
On Fri, Dec 25, 2009 at 1:19 PM, Mensanator wrote: > On Dec 25, 9:25 am, Benjamin Kaplan wrote: >> On Fri, Dec 25, 2009 at 1:48 AM, Mensanator wrote: >> > On Dec 24, 10:18 pm, Benjamin Kaplan wrote: >> >> On Thu, Dec 24, 2009 at 9:11 PM, Mensanator wrote: >> >> > Ok, so I got a MacBook Air. >>

Re: getlist question

2009-12-25 Thread Steven D'Aprano
On Fri, 25 Dec 2009 12:59:20 -0500, Benjamin Kaplan wrote: > On Fri, Dec 25, 2009 at 12:40 PM, Victor Subervi > wrote: >> >> It returns nothing. I believe I've stated that three times now. > > In Python, that's not possible. Every function returns something. Unless it raises an exception. >

Re: Queues vs List

2009-12-25 Thread MRAB
Rodrick Brown wrote: Was reading the official python document and I noticed they mentioned queues being more efficient for adding/removing elements vs list so I wrote a quick test the validate this claim and I wasn't very impressed by the results it seems queues are just slightly faster so my q

Re: Queues vs List

2009-12-25 Thread Cameron Simpson
On 25Dec2009 17:21, Rodrick Brown wrote: | Was reading the official python document and I noticed they mentioned queues | being more efficient for adding/removing elements vs list so I wrote a quick | test the validate this claim and I wasn't very impressed by the results it | seems queues are jus

Queues vs List

2009-12-25 Thread Rodrick Brown
Was reading the official python document and I noticed they mentioned queues being more efficient for adding/removing elements vs list so I wrote a quick test the validate this claim and I wasn't very impressed by the results it seems queues are just slightly faster so my question to the list, is d

Re: Is it possible to get the erroneous variable when getting a NameError exception?

2009-12-25 Thread Gary Herron
Dotan Barak wrote: On 25/12/2009 19:27, Gary Herron wrote: Dotan Barak wrote: Recover the exception, and examine the tuple of args or the message string. >>> try: ... eval("my_number < 10", {"__builtins__":None}, {}) ... except NameError,e: ... print e.args ... print e

Re: Recommendation for small, fast, Python based web server

2009-12-25 Thread mdipierro
This is a new wsgi web server implemented in a single file. http://code.google.com/p/web2py/source/browse/gluon/sneaky.py I could use some help with testing. Here is a version for Python 3.0 http://code.google.com/p/web2py/source/browse/gluon/sneaky.py Massimo On Dec 25, 12:38 pm, a...@pytho

Re: Extra fields for logging

2009-12-25 Thread Joan Miller
On 25 dic, 13:24, Steven D'Aprano wrote: > On Thu, 24 Dec 2009 05:06:48 -0800, Joan Miller wrote: > > I'm trying to add some extra fields to logging, I'm following this > > information [1] but it faills in my case. > [...] > > I get => KeyError: 'host' > > Please post the entire traceback you get.

Re: Perl to Python conversion

2009-12-25 Thread John Yeung
On Dec 13, 5:23 pm, martin.sch...@gmail.com (Martin Schöön) wrote: > r0g writes: > > You'll probably find the majority of code in a GUI > > app is boring window handling stuff [...] > > Also, they probably didn't make it with > > QT which is fairly different from GTK. > > Tk is what they used. We

Re: Is it possible to get the erroneous variable when getting a NameError exception?

2009-12-25 Thread Dotan Barak
On 25/12/2009 19:27, Gary Herron wrote: Dotan Barak wrote: Recover the exception, and examine the tuple of args or the message string. >>> try: ... eval("my_number < 10", {"__builtins__":None}, {}) ... except NameError,e: ... print e.args ... print e.message ... ("name

Re: Mechanize - Click a table row to navigate to detail page

2009-12-25 Thread S.Selvam
On Fri, Dec 25, 2009 at 4:06 PM, Diez B. Roggisch wrote: > Brian D schrieb: > > A search form returns a list of records embedded in a table. >> >> The user has to click on a table row to call a Javascript call that >> opens up the detail page. >> >> It's the detail page, of course, that really co

Re: Recommendation for small, fast, Python based web server

2009-12-25 Thread Aahz
In article , Antoine Pitrou wrote: > >Apparently you have debugged your speed issue so I suppose you don't have >performance problems anymore. Do note, however, that Python is generally >not as fast as C -- especially for low-level stuff -- and a Python Web >server will probably serve around 1

Re: Perl to Python conversion

2009-12-25 Thread Aahz
In article <87zl5rnayz@crunchbang.belkin>, Martin =?utf-8?B?U2Now7bDtm4=?= wrote: > >Problem: I have come across a small open source application that I find >quite useful. It does have one major flaw though. Its output is in >imperial units. Converting isn't a big deal for occasional use but

Re: How do I install GMPY 1.11 on a Mac with OS X 10.6 and Python 3.1?

2009-12-25 Thread Mensanator
On Dec 25, 9:25 am, Benjamin Kaplan wrote: > On Fri, Dec 25, 2009 at 1:48 AM, Mensanator wrote: > > On Dec 24, 10:18 pm, Benjamin Kaplan wrote: > >> On Thu, Dec 24, 2009 at 9:11 PM, Mensanator wrote: > >> > Ok, so I got a MacBook Air. > > >> > Has OS X 10.6 (Snow Leopard) and Python 2.6.1 alrea

Re: How do I install GMPY 1.11 on a Mac with OS X 10.6 and Python 3.1?

2009-12-25 Thread Benjamin Kaplan
On Fri, Dec 25, 2009 at 1:09 PM, Mensanator wrote: > On Dec 25, 9:25 am, Benjamin Kaplan wrote: >> On Fri, Dec 25, 2009 at 1:48 AM, Mensanator wrote: >> > On Dec 24, 10:18 pm, Benjamin Kaplan wrote: >> >> On Thu, Dec 24, 2009 at 9:11 PM, Mensanator wrote: >> >> > Ok, so I got a MacBook Air. >>

Re: getlist question

2009-12-25 Thread Victor Subervi
On Fri, Dec 25, 2009 at 12:59 PM, Benjamin Kaplan wrote: > On Fri, Dec 25, 2009 at 12:40 PM, Victor Subervi > wrote: > > > > It returns nothing. I believe I've stated that three times now. > > In Python, that's not possible. Every function returns something. If > you think it returns nothing, it

Re: How do I install GMPY 1.11 on a Mac with OS X 10.6 and Python 3.1?

2009-12-25 Thread Mensanator
On Dec 25, 9:25 am, Benjamin Kaplan wrote: > On Fri, Dec 25, 2009 at 1:48 AM, Mensanator wrote: > > On Dec 24, 10:18 pm, Benjamin Kaplan wrote: > >> On Thu, Dec 24, 2009 at 9:11 PM, Mensanator wrote: > >> > Ok, so I got a MacBook Air. > > >> > Has OS X 10.6 (Snow Leopard) and Python 2.6.1 alrea

Re: getlist question

2009-12-25 Thread Benjamin Kaplan
On Fri, Dec 25, 2009 at 12:40 PM, Victor Subervi wrote: > > It returns nothing. I believe I've stated that three times now. In Python, that's not possible. Every function returns something. If you think it returns nothing, it probably returns None. >>> def foo() : pass ... >>> a = foo() >>> prin

Re: getlist question

2009-12-25 Thread Carsten Haese
Victor Subervi wrote: > On Fri, Dec 25, 2009 at 11:35 AM, Carsten Haese > wrote: > > Victor Subervi wrote: > > Well I've done that. What happens is the storeColNames registers the > > "Availability" field naturally enough; however, as I stated > bef

Re: getlist question

2009-12-25 Thread Victor Subervi
On Fri, Dec 25, 2009 at 11:35 AM, Carsten Haese wrote: > Victor Subervi wrote: > > Well I've done that. What happens is the storeColNames registers the > > "Availability" field naturally enough; however, as I stated before, the > > getlist doesn't fetch anything because there is nothing to fetch!

Re: Is it possible to get the erroneous variable when getting a NameError exception?

2009-12-25 Thread Gary Herron
Dotan Barak wrote: Hi. I'm trying to evaluate a string and getting a NameError (it is expected, since the variable my_number wasn't provided in the "locals" dictionary). <--snip start--> >>> eval("my_number < 10", {"__builtins__":None}, {}) Traceback (most recent call last): File "", line 1

Re: Is it possible to get the erroneous variable when getting a NameError exception?

2009-12-25 Thread Steven D'Aprano
On Fri, 25 Dec 2009 17:29:48 +0200, Dotan Barak wrote: > Hi. > > I'm trying to evaluate a string and getting a NameError (it is expected, > since the variable my_number wasn't provided in the "locals" > dictionary). > > <--snip start--> > >>> eval("my_number < 10", {"__builtins__":None}, {}) >

Re: getlist question

2009-12-25 Thread Carsten Haese
Victor Subervi wrote: > Well I've done that. What happens is the storeColNames registers the > "Availability" field naturally enough; however, as I stated before, the > getlist doesn't fetch anything because there is nothing to fetch! No > such value is passed! Well, what does getlist return when

Is it possible to get the erroneous variable when getting a NameError exception?

2009-12-25 Thread Dotan Barak
Hi. I'm trying to evaluate a string and getting a NameError (it is expected, since the variable my_number wasn't provided in the "locals" dictionary). <--snip start--> >>> eval("my_number < 10", {"__builtins__":None}, {}) Traceback (most recent call last): File "", line 1, in ? File "", li

Re: How do I install GMPY 1.11 on a Mac with OS X 10.6 and Python 3.1?

2009-12-25 Thread Benjamin Kaplan
On Fri, Dec 25, 2009 at 1:48 AM, Mensanator wrote: > On Dec 24, 10:18 pm, Benjamin Kaplan wrote: >> On Thu, Dec 24, 2009 at 9:11 PM, Mensanator wrote: >> > Ok, so I got a MacBook Air. >> >> > Has OS X 10.6 (Snow Leopard) and Python 2.6.1 already installed. >> >> > So I install Xcode, download ma

Re: Extra fields for logging

2009-12-25 Thread Steven D'Aprano
On Thu, 24 Dec 2009 05:06:48 -0800, Joan Miller wrote: > I'm trying to add some extra fields to logging, I'm following this > information [1] but it faills in my case. [...] > I get => KeyError: 'host' Please post the entire traceback you get. -- Steven -- http://mail.python.org/mailman/list

Re: Join a thread and get the return value of a function

2009-12-25 Thread mattia
Il Fri, 25 Dec 2009 05:19:46 +1100, Lie Ryan ha scritto: > import threading > > class MyThread(threading.Thread): > def join(self): > super(MyThread, self).join() > return self.result > > class Worker(MyThread): > def run(self): > total = 0 > for i i

Re: Mechanize - Click a table row to navigate to detail page

2009-12-25 Thread Diez B. Roggisch
Brian D schrieb: A search form returns a list of records embedded in a table. The user has to click on a table row to call a Javascript call that opens up the detail page. It's the detail page, of course, that really contains the useful information. How can I use Mechanize to click a row? Yo

Re: getlist question

2009-12-25 Thread Victor Subervi
On Thu, Dec 24, 2009 at 6:32 PM, MRAB wrote: > Victor Subervi wrote: > > On Thu, Dec 24, 2009 at 3:28 PM, MRAB > pyt...@mrabarnett.plus.com>> wrote: >> >>Victor Subervi wrote: >> >>Hi; >>I have the following code: >> >> try: >> trueVal = form.getlist