urllib2.urlopen(url) pulling something other than HTML

2007-08-20 Thread [EMAIL PROTECTED]
I am reading "Python for Dummies" and found the following example of a web crawler that I thought was interesting. The first time I keyed the program and executed it I didn't understand it well enough to debug it so I just skipped it. A few days later I realized that it failed after a few second

Re: I Need help from all the group participants

2007-08-20 Thread [EMAIL PROTECTED]
I would be happy to help but I don't have a clear understand of what the poster needs. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python equivalent of Perl's $/

2007-08-20 Thread [EMAIL PROTECTED]
On Aug 19, 11:13 am, John K Masters <[EMAIL PROTECTED]> wrote: > I am currently working my way through Jeffrey Friedl's book Mastering > Regular Expressions. Great book apart from the fact it uses Perl for the > examples. > > One particular expression that interest

Re: Handwriting Recognition

2007-08-20 Thread [EMAIL PROTECTED]
> > import handwriting > > ... > > >http://docs.python.org/lib/module-handwriting.html > > > ha ha, I kid, I kid. > > > I don't think this is an easy problem to solve. You'd probably want > > Python to be a wrapper around whatever hand-writing recognition > > software you find or buy. I know han

Re: urllib2.urlopen(url) pulling something other than HTML

2007-08-20 Thread [EMAIL PROTECTED]
Those responses were both very helpful. John's additional type checking is straight forward and easy to implement. I will also rewrite the application a second time using the class Gabriel offered. Both of these suggestions will help gain some insight into how Python works. "Don't even try to

Re: Python equivalent of Perl's $/

2007-08-20 Thread [EMAIL PROTECTED]
On Aug 20, 1:02 pm, John K Masters <[EMAIL PROTECTED]> wrote: > On 19:19 Mon 20 Aug , [EMAIL PROTECTED] wrote: > > > > > import StringIO > > > text = """\ > > To mimic Perl's input record separator in > > Python, you can use a ge

Re: yet another indentation proposal

2007-08-21 Thread [EMAIL PROTECTED]
On Aug 18, 2:22 pm, "Aaron" <[EMAIL PROTECTED]> wrote: > Hello all. > > I realize that proposals dealing with alternatives to indentation have been > brought up (and shot down) before, but I would like to take another stab at > it, because it is rather important to

Re: Newbee Question

2007-08-21 Thread [EMAIL PROTECTED]
On Aug 21, 4:38 am, Ant <[EMAIL PROTECTED]> wrote: > On Aug 20, 11:47 pm, [EMAIL PROTECTED] wrote: > ... > > > Thanks for the help. By the way I am trying to learn the python after > > work and on weekends. If it was a dumb question, to this group, I will > > not b

libgmail failure

2007-08-21 Thread [EMAIL PROTECTED]
ef send(TO_LIST,SUBJECT,MESSAGE): GA = libgmail.GmailAccount("[EMAIL PROTECTED]","xxx") try: print "Logging in" GA.login() except libgmail.GmailLoginFailure: print "\nLogin failed. (Wrong username/password?)" else:

Re: libgmail failure

2007-08-21 Thread [EMAIL PROTECTED]
Thanks for the suggestion. I've tried logging in and sending email manually and it works just fine. Thanks though, James -- http://mail.python.org/mailman/listinfo/python-list

Re: libgmail failure

2007-08-22 Thread [EMAIL PROTECTED]
On Aug 22, 10:26 am, James Stroud <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Hey all, > > > I've been using libgmail to send out automated notification emails for > > my company's nightly regression testing. Last night these emails > &g

Learning Python using a book based on version 1.5

2007-08-22 Thread [EMAIL PROTECTED]
Greetings, A friend of mine dropped off a copy of Sams Teach Yourself Python in 24 Hours published in 2000. I skimmed the first couple of chapters looking for the interpreter version and the book was based on version Python version 1.5. Is this book still relevant? Should I toss it and look f

Re: Learning Python using a book based on version 1.5

2007-08-22 Thread [EMAIL PROTECTED]
> http://docs.python.org/tut/http://www.diveintopython.org/ I'm dense so the online python docs make great sources for reference points and they help clarify ambiguity but its too dry (without enough sample code) to help me fully understand the concepts. I think Dive Into Python would probably

Re: libgmail failure

2007-08-22 Thread [EMAIL PROTECTED]
On Aug 22, 4:11 pm, James Stroud <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Aug 22, 10:26 am, James Stroud <[EMAIL PROTECTED]> wrote: > >> Have you thought about spoofing explorer? Always spoof explorer. > > >> James > > >

Are there precompiled python for sgi ?

2007-08-23 Thread [EMAIL PROTECTED]
Hi, Are there precompiled python for sgi(IRIX6.5) to download? Several packages(_socket, Tkinter, ...) always failed when I tried to build python from source on our machine running IRIX6.5. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes and unsigned char*

2007-08-23 Thread [EMAIL PROTECTED]
On 23 Aug., 05:46, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > If the result can contain nul bytes, you have to specify its size > explicitely (else it will be truncated at the first zero). Use the > string_at utility function: > > result_str = string_at(result

Re: libgmail failure

2007-08-23 Thread [EMAIL PROTECTED]
Thanks! That worked brilliantly. -James -- http://mail.python.org/mailman/listinfo/python-list

Re: List Comprehension Question: One to Many Mapping?

2007-08-23 Thread [EMAIL PROTECTED]
On Aug 23, 9:24 pm, beginner <[EMAIL PROTECTED]> wrote: > Hi All, > > How do I map a list to two lists with list comprehension? > > For example, if I have x=[ [1,2], [3,4] ] > > What I want is a new list of list that has four sub-lists: > > [[1,2], [f(1), f(2)],

Debugging a curses application in python

2007-08-25 Thread [EMAIL PROTECTED]
Hello all, I'm trying to debug a python application which uses the curses module under Linux. I'm having trouble, since I can't get any debugger to work. Is there a way to separate the output of an application from the debugger. In gdb, the tty command would allow me to specify a separate tty to w

How can I use python for file processing

2007-08-25 Thread [EMAIL PROTECTED]
Hi, I am trying to use python for file processing. Suppose I have a file like this: I want to build a Hashmap between the line "begin_QOS_statistics" and "end_QOS_statistics" and for each line I want to put the first text as the key of the hash table and the second text as the value. Received R

Re: lisper learning python, ... could you please comment my first python program?

2007-08-26 Thread [EMAIL PROTECTED]
Michele Simionato wrote: > On Aug 26, 5:56 pm, [EMAIL PROTECTED] wrote: > > Hi, > > to extend my skills, I am learning python. I have written small > > program which computes math expression like "1+2*sin(y^10)/cos(x*y)" > > and similar, so far only + - * /

Re: Debugging a curses application in python

2007-08-26 Thread [EMAIL PROTECTED]
Just to let anyone know who runs across this post, winpdb from (http:// www.digitalpeers.com/pythondebugger/) solved my issue. --Chris -- http://mail.python.org/mailman/listinfo/python-list

Best open source Python online *CHAT* apps?

2007-08-27 Thread [EMAIL PROTECTED]
Best open source Python online chat apps? I believe there are a few PHP online chat apps to allow people to have conversation via a web server but a Python one would soothe the soul. Any available? Thanks, Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: convert non-delimited to delimited

2007-08-27 Thread [EMAIL PROTECTED]
On Aug 27, 1:35 pm, Mark Elston <[EMAIL PROTECTED]> wrote: > * RyanL wrote (on 8/27/2007 10:59 AM): > > > > > > > I'm a newbie! I have a non-delimited data file that I'd like to > > convert to delimited. > > > Example... > > Line

[PyQt] Help on resizing a custom widget

2007-08-27 Thread [EMAIL PROTECTED]
Ok, here's what's going on. I've just created a custom widget. it works great. I'm having some trouble, however, figuring out how to allow the said widget to resize. For example, when I throw the widget into a new dialog (using Qt Designer), I want to be able to drag it larger/smaller and have widg

Re: sorting a list of lists

2007-08-27 Thread [EMAIL PROTECTED]
On Aug 27, 2:41 pm, iapain <[EMAIL PROTECTED]> wrote: > ... It is always better to adopt a generic approach. The above statement is incorrect. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help on resizing a custom widget

2007-08-27 Thread [EMAIL PROTECTED]
On Aug 27, 4:40 pm, Phil Thompson <[EMAIL PROTECTED]> wrote: > On Monday 27 August 2007, [EMAIL PROTECTED] wrote: > > > Ok, here's what's going on. I've just created a custom widget. it > > works great. I'm having some trouble, however, figuring out how

Re: Biased random?

2007-08-27 Thread [EMAIL PROTECTED]
On Aug 27, 3:42 pm, Ivan Voras <[EMAIL PROTECTED]> wrote: > Hi, > > I have a list of items, and need to choose several elements from it, > "almost random". The catch is that the elements from the beginning > should have more chance of being selected than those at th

Re: Table update

2007-08-28 Thread [EMAIL PROTECTED]
On Aug 28, 2:57 pm, "Ahmed, Shakir" <[EMAIL PROTECTED]> wrote: > I am trying to use python script to update a table by incremental value > based on struc_No but having problem to get right result on the value > field for the 3rd and 4th same number of struc_no. > > I

Re: wxpython:how to minimize to taskbar

2007-08-28 Thread [EMAIL PROTECTED]
On Aug 28, 9:10 am, Jimmy <[EMAIL PROTECTED]> wrote: > I'm kinda newbie to python and wxPython. Now I'm confronting a thorny > problem: how can I make my program minimize to the taskbar > represented as an ico, and when there is some message from network > coming, i

Re: tempfile.mkstemp and os.fdopen

2007-08-28 Thread [EMAIL PROTECTED]
On Aug 28, 1:55 pm, billiejoex <[EMAIL PROTECTED]> wrote: > In conjunction I used os.fdopen() to get a wrapper around file > properties (write & read methods, and so on...) but 'name' attribute > does not contain the correct file name. Why? > > >>>

Re: strange list comprehension on generator

2007-08-29 Thread [EMAIL PROTECTED]
On Aug 29, 6:50 am, Roland Puntaier <[EMAIL PROTECTED] automation.com> wrote: > def changeOne(aa,idx): > aa[idx]=not aa[idx] > yield aa > for i in range(idx): > for x in changeOne(aa,i): > yield x > > def changeOneOrder(aa): > yield aa > for

Re: We need PIGs :)

2007-08-30 Thread [EMAIL PROTECTED]
On Aug 30, 12:10 am, "Martin Marcher" <[EMAIL PROTECTED]> wrote: [snip!] > > My idea was to define "Python Implementation Guidelines" (PIGs) that > specify a problem formalize it enough so that implementations are > interchangeable (in this example creat

Trouble using sys.settrace

2007-08-30 Thread [EMAIL PROTECTED]
The code below produces no output. I would expect to see: tracing... tracing... tracing... tracing... tracing... I was wondering if anyone had any experience with this. = import sys def mytrace(frame, event, arg): print "tracing..." sys.settrace(mytrace) d

Re: Trouble using sys.settrace

2007-08-30 Thread [EMAIL PROTECTED]
On Aug 31, 5:31 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > The code below produces no output. I would expect to see: > > tracing... > tracing... > tracing... > tracing... > tracing... > > I was wondering if anyone had any exp

Setting a read-only attribute

2007-08-30 Thread [EMAIL PROTECTED]
I have an object and wish to set an attribute on it which, unfortunately for me, is read-only. How can I go about this? Cheers. -T -- http://mail.python.org/mailman/listinfo/python-list

Automation and scheduling of front page publishing using python

2007-08-30 Thread [EMAIL PROTECTED]
Good afternoon, We have numerous web sites which are currently being manually published via Front Page. Doing one or two sites on an ad-hoc basis was not too bad but we are now over 20 or thirty at set times during a business day. What I would love to do is find a way of automating this task, id

Re: list index()

2007-08-30 Thread [EMAIL PROTECTED]
On Aug 30, 9:26 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > <[EMAIL PROTECTED]> wrote: > >... > > > In my case of have done os.listdir() on two directories. I want to see > > what files are in directory A that are not in directory B. > > So why would you

Coding Standards

2007-08-30 Thread [EMAIL PROTECTED]
'Good code' is code that works, is bug free, and is readable and maintainable. Standards need to be followed for coding. Read more... http://brsx.co.uk/SWtesting/FAQs/FAQs012.asp -- http://mail.python.org/mailman/listinfo/python-list

Re: Setting a read-only attribute

2007-08-31 Thread [EMAIL PROTECTED]
On Aug 31, 6:14 pm, Alexandre Badez <[EMAIL PROTECTED]> wrote: > On Aug 30, 11:35 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > I have an object and wish to set an attribute on it which, > > unfortunately for me, is read-only. > >

Re: Registering a python function in C

2007-08-31 Thread [EMAIL PROTECTED]
On Aug 31, 3:33 pm, fernando <[EMAIL PROTECTED]> wrote: > Thanks for the responses. To be more specific, this code is part of a > Maya plugin. The funcion MFnPlugin::registerUI takes a pointer to a > PyObject which is the function that will set up the UI for that > plugin. The c

Re: Looking for Delaunay triangulation module...

2007-09-01 Thread [EMAIL PROTECTED]
On Sep 1, 12:24 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2007-09-01, Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > > In message <[EMAIL PROTECTED]>, Grant Edwards wrote: > > >> So for lack of a delaunay module, I'm stuck trying to port m

Re: Automation and scheduling of FrontPage publishing using Python

2007-09-01 Thread [EMAIL PROTECTED]
On Sep 1, 3:19 am, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: > In message <[EMAIL PROTECTED]>, Steve > > Holden wrote: > > Lawrence D'Oliveiro wrote: > > >> If they were using FrontPage extensions, they deserve everythin

Re: Automation and scheduling of FrontPage publishing using Python

2007-09-02 Thread [EMAIL PROTECTED]
On Sep 1, 10:48 pm, Jerry <[EMAIL PROTECTED]> wrote: > andrew, > > I would try looking into Windows automation with > Python.http://www.google.com/search?q=windows+automation+pythonshould get > you started. The winGuiAuto package may help you out as it is like > hav

Re: Automation and scheduling of FrontPage publishing using Python

2007-09-03 Thread [EMAIL PROTECTED]
On Sep 2, 4:22 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Sep 1, 10:48 pm, Jerry <[EMAIL PROTECTED]> wrote: > > > andrew, > > > I would try looking into Windows automation with > > Python.http://www.google.com/search?q=windows

python exec behaves inconsistent with respect to module imports

2007-09-05 Thread [EMAIL PROTECTED]
Hello I am completely puzzled why the following exec code does not work: mycode = "import math\ndef f(y):\nprint math.floor(y)\nf(3.14)" def execute(): exec mycode execute() I get the error: [EMAIL PROTECTED]:/opt/qbase# python error1.py Traceback (most recent call las

Re: python exec behaves inconsistent with respect to module imports

2007-09-05 Thread [EMAIL PROTECTED]
Hi Thank you for the explanation It seems that python behaves different for variables created in the toplevel namespace, versus deeper namespaces. CODE: def g(): a=2 print "a in LOC:",locals().has_key('a') print "a in GLO:",globals().has_key('a') def f(): print "a in LOC:",locals().

Text processing and file creation

2007-09-05 Thread [EMAIL PROTECTED]
I have a text source file of about 20.000 lines. >From this file, I like to write the first 5 lines to a new file. Close that file, grab the next 5 lines write these to a new file... grabbing 5 lines and creating new files until processing of all 20.000 lines is done. Is there an efficient way to d

Re: Text processing and file creation

2007-09-05 Thread [EMAIL PROTECTED]
On Sep 5, 1:28 pm, Paddy <[EMAIL PROTECTED]> wrote: > On Sep 5, 5:13 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > I have a text source file of about 20.000 lines.>From this file, I like to > > write the first 5 lines to a new file. Clos

Re: Registering a python function in C

2007-09-05 Thread [EMAIL PROTECTED]
On Sep 3, 7:11 pm, fernando <[EMAIL PROTECTED]> wrote: > > Is Maya a different python build than what is contained at python.org? > > If so, I suggest you get your C program to work with the latest python > > build > > from python.org. Then see if you can get it to

Give List to Format String - How To

2007-09-05 Thread [EMAIL PROTECTED]
I might just be being dumb tonight, but why doesn't this work: >>> '%s aaa %s aa %s' % ['test' for i in range(3)] Traceback (most recent call last): File "", line 1, in ? TypeError: not enough arguments for format string (I'm in Python 2.4 if that matters) Thanks, Greg -- http://mail.python

Re: Give List to Format String - How To

2007-09-05 Thread [EMAIL PROTECTED]
On Sep 5, 10:47 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I might just be being dumb tonight, but why doesn't this work: > > >>> '%s aaa %s aa %s' % ['test' for i in range(3)] > > Traceback (most recent call last): >

Re: Using wild character

2007-09-05 Thread [EMAIL PROTECTED]
i hope this may help you. countries = ["india","africa","atlanta","artica","nigeria"] filtered = filter(lambda item: item.startswith('a'), l) -- http://mail.python.org/mailman/listinfo/python-list

Re: Using wild character

2007-09-05 Thread [EMAIL PROTECTED]
i will this may help you. countries = ["india","africa","atlanta","artica","nigeria"] filter(lambda country: country.startswith('a'), countries) -- http://mail.python.org/mailman/listinfo/python-list

Re: startswith( prefix[, start[, end]]) Query

2007-09-06 Thread [EMAIL PROTECTED]
On Sep 6, 7:09 am, [EMAIL PROTECTED] wrote: > Hi > > startswith( prefix[, start[, end]]) States: > > Return True if string starts with the prefix, otherwise return False. > prefix can also be a tuple of suffixes to look for. However when I try > and add a tuple of suffixe

Re: Help setting default class attributes

2007-09-06 Thread [EMAIL PROTECTED]
On Sep 6, 10:26 am, rh0dium <[EMAIL PROTECTED]> wrote: > Hi all, > > I have the following piece of code and I wanted to set the default > attributes based on a dictionary. What I am looking for is a way to > take PIPODEFAULTS and assign each one as an attribute for the class

Re: exponential float formmating

2007-09-07 Thread [EMAIL PROTECTED]
On Sep 7, 6:08 am, [EMAIL PROTECTED] wrote: > Hi, > > For compatibility reasons with an old program I have to format string > in exponential > format with the following format > > 0.xE-yy > > This means that the number start always by 0 and after the exponent >

Re: why should I learn python

2007-09-07 Thread [EMAIL PROTECTED]
On Sep 6, 10:32 pm, windandwaves <[EMAIL PROTECTED]> wrote: > Can someone tell me why I should learn python? I am a webdeveloper, > but I often see Python mentioned and I am curious to find out what I > am missing out on. > > Thank you > > Nicolaas - You never really

Re: Beginners Query - Simple counter problem

2007-09-06 Thread [EMAIL PROTECTED]
On Sep 6, 1:44 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Thu, 2007-09-06 at 11:24 -0700, Ian Clark wrote: > > Carsten Haese wrote: > > > def d6(count): > > > return sum(random.randint(1, 6) for die in range(count)) > > > My stab at it

Re: Modul (%) in python not like in C?

2007-09-09 Thread [EMAIL PROTECTED]
On Sep 9, 2:15�pm, "J. Cliff Dyer" <[EMAIL PROTECTED]> wrote: > Dotan Cohen wrote: > > FIrst of all, how is the % symbol (as in 70%6=4) called in English? > > > Second, in Turbo C -111%10=-1 however in python -111%10=9. Is one or > > the other in error? I

Re: Modul (%) in python not like in C?

2007-09-09 Thread [EMAIL PROTECTED]
On Sep 9, 11:43?pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Mon, 10 Sep 2007 01:06:59 GMT, Bryan Olson <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > They also disagree about integer division. C rounds toward zero; > > P

Re: How can I test 'warnings' from testsuite?

2007-09-10 Thread [EMAIL PROTECTED]
On Sep 10, 7:08 am, billiejoex <[EMAIL PROTECTED]> wrote: > Hi there, > into a module of mine I 'warn' a message if a certain situation > occurs: > > def add_anonymous_user(permissions=('r'): > if 'w' in p: > import

Re: Modul (%) in python not like in C?

2007-09-10 Thread [EMAIL PROTECTED]
On Sep 10, 1:38 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Sun, 09 Sep 2007 22:57:24 -0700, "[EMAIL PROTECTED]" > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > > > > But, in general, doesn't (-11,-4) also satisfy

Re: How do I disable warnings?

2007-09-10 Thread [EMAIL PROTECTED]
On Sep 10, 12:34 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > I've read the documentation for the warnings module, but I'm > still unable to figure out how to disable a warning. > > I'd like to disable this warning: > > Warning: 'with' will b

Python Database Apps

2007-09-10 Thread [EMAIL PROTECTED]
Kindof a poll, kindof curiosity... What is your favorite python - database combination? I'm looking to make an app that has a local DB and a server side DB. I'm looking at python and sqlite local side and sql server side. Any suggestions Darien -- http://mail.python.org/mailman/listinfo/

Re: Mac OSX sqlite problem. Missing?

2007-09-10 Thread [EMAIL PROTECTED]
On Sep 10, 1:51 pm, [EMAIL PROTECTED] wrote: > Diez B. Roggisch wrote: > > > Are you by any chance using the python 2.3 when issuing that import > > statement? > > > Diez > > Unfortunately not :( > > ibook:~/project1$ python -V > Python 2.5 > ibook:~/

Re: function to do dynamic import?

2007-09-10 Thread [EMAIL PROTECTED]
On Sep 10, 10:52 pm, "bambam" <[EMAIL PROTECTED]> wrote: > import works in the main section of the module, but does > not work as I hoped when run inside a function. > > That is, the modules import correctly, but are not visible to > the enclosing (global) scope. &

Re: Python Database Apps

2007-09-11 Thread [EMAIL PROTECTED]
On Sep 11, 9:25 am, Ed Leafe <[EMAIL PROTECTED]> wrote: > On Sep 10, 2007, at 10:52 PM, [EMAIL PROTECTED] wrote: > > > Kindof a poll, kindof curiosity... > > > What is your favorite python - database combination? I'm looking to > > make an app that has

Get Only the Last Items in a Traceback

2007-09-11 Thread [EMAIL PROTECTED]
I'm running code via the "exec in context" statement within a much larger program. What I would like to do is capture any possible errors and show a pretty traceback just like the Python interactive interpreter does, but only show the part of the traceback relating to the code sent to exec. For e

Re: need scsh in a wikip article

2007-09-12 Thread [EMAIL PROTECTED]
> someone please add scsh there. Why can't YOU add scsh or I am missing something?? Andrey -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Database Apps

2007-09-12 Thread [EMAIL PROTECTED]
On Sep 12, 8:39 am, Ed Leafe <[EMAIL PROTECTED]> wrote: > On Sep 11, 2007, at 2:56 PM, [EMAIL PROTECTED] wrote: > > > It's gonna be a desktop app. The > > database engine is going to be the critical component. I like sqlite > > so that I don't need a datab

Re: Get Only the Last Items in a Traceback

2007-09-12 Thread [EMAIL PROTECTED]
On Sep 12, 5:17 am, Peter Otten <[EMAIL PROTECTED]> wrote: > > Your assessment is wrong. You only get the extra lines in the traceback if > you don't immediately wrap the exec statement in a try ... except block: > > $ cat snip_traceback1.py > import traceba

Re: Get Only the Last Items in a Traceback

2007-09-12 Thread [EMAIL PROTECTED]
On Sep 12, 11:35 am, Peter Otten <[EMAIL PROTECTED]> wrote: > Am Wed, 12 Sep 2007 15:09:02 + schrieb [EMAIL PROTECTED]: > > > > > On Sep 12, 5:17 am, Peter Otten <[EMAIL PROTECTED]> wrote: > > >> Your assessment is wrong. You only get the extr

Implementing a fixed size stack for an RPN Calculator

2007-09-12 Thread [EMAIL PROTECTED]
I have implemented an RPN calculator in python but now I would like to make the stack size fixed. how can I transform the user's RPN expression from a stack overflow to a computable expression. For instance, if my stack size is 2 then the some expression can't be computed but could be transformed

Re: Implementing a fixed size stack for an RPN Calculator

2007-09-12 Thread [EMAIL PROTECTED]
On Sep 12, 2:55 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Wed, 12 Sep 2007 20:55:22 +0000, [EMAIL PROTECTED] wrote: > > I have implemented an RPN calculator in python but now I would like to > > make the stack size fixed. how can I transform the u

Re: need scsh in a wikip article

2007-09-12 Thread [EMAIL PROTECTED]
On 12 сент, 13:32, [EMAIL PROTECTED] (Timofei Shatrov) wrote: > On Wed, 12 Sep 2007 02:10:09 -0700, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > tried to confuse everyone with this message: > > >> someone please add scsh there. > > >Why can't YOU add

Re: newbie: self.member syntax seems /really/ annoying

2007-09-13 Thread [EMAIL PROTECTED]
Why not use '_' as the self variable. It is minimal and achieves close to '.var', as '_.var' isn't that different. I know its a little perl-esque, but its not a bad convention if you are aiming to up readability of your code. class test: def __init__(self): _ = self; _.a = 0;

Re: newbie: self.member syntax seems /really/ annoying

2007-09-13 Thread [EMAIL PROTECTED]
On Sep 12, 10:05 am, [EMAIL PROTECTED] (Alex Martelli) wrote: ... > into a function and a call to it: > > def f(): > with implicit_self(t): > print a > print b > a = 40 > b = a * 2 > f() > > ...e

Re: An ordered dictionary for the Python library?

2007-09-13 Thread [EMAIL PROTECTED]
On Sep 13, 1:27 am, Mark Summerfield <[EMAIL PROTECTED]> wrote: > On 13 Sep, 00:03, Paul Rubin <http://[EMAIL PROTECTED]> wrote: > > > Mark Summerfield <[EMAIL PROTECTED]> writes: > > > I feel that Python lacks one useful data structure: an ordered

Re: Decimal formatting

2007-09-13 Thread [EMAIL PROTECTED]
On Sep 13, 3:50 pm, Harlin Seritt <[EMAIL PROTECTED]> wrote: > Cant believe I have to post this and get help... and can't believe I > couldnt Google it reasonably well enough... I need to take a float > variable and have it display as a string to always have two decimal &

Sorting strings containing special characters (german 'Umlaute')

2007-03-02 Thread [EMAIL PROTECTED]
Hi ! I know that this topic has been discussed in the past, but I could not find a working solution for my problem: sorting (lists of) strings containing special characters like "ä", "ü",... (german umlaute). Consider the following list: l = ["Aber", "Beere", "Ärger"] For sorting the letter "Ä" i

Re: Sorting strings containing special characters (german 'Umlaute')

2007-03-02 Thread [EMAIL PROTECTED]
On 2 Mrz., 15:25, Peter Otten <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > For sorting the letter "Ä" is supposed to be treated like "Ae", There are several way of defining the sorting order. The variant "ä equals ae" follows DINDIN 5007 (

How *extract* data from XHTML Transitional web pages? got xml.dom.minidom troubles..

2007-03-02 Thread [EMAIL PROTECTED]
I'm trying to extract some data from an XHTML Transitional web page. What is best way to do this? xml.dom.minidom.parseString("text of web page") gives errors about it not being well formed XML. Do I just need to add something like or what? Chris -- http://mail.python.org/mailman/listinfo/py

Re: A more navigable Python Library Reference page

2007-03-03 Thread [EMAIL PROTECTED]
> > Google doesn't seem to let you add attachments so I've put a sample of > the output here:http://www.qtrac.eu/libindex.html > at the bottom of the page there is a link to the ~100 line libindex.py > script that generated it. I like it. thanks. -- http://mail.python.org/mailman/listinfo/pyth

Randomizing in Python

2007-03-03 Thread [EMAIL PROTECTED]
I want to randomize a certain calculation in Python but haven't figured it out yet. To explain what i mean, I' m going to use an example: I want to get the numbers to do a random experience database for a game. What would be necessary to do so? -- http://mail.python.o

distutils - script install check file existence before copy?

2007-03-03 Thread [EMAIL PROTECTED]
Not sure if it is possible to do this - I know distutils has "force" option that can be turned on/off for install_data, but is it possible to do something somewhat complicated - have a data file named YYY, need to copy it to share/script/YYY only if share/script/YYY does not already exist, otherwis

How use XML parsing tools on this one specific URL?

2007-03-04 Thread [EMAIL PROTECTED]
I understand that the web is full of ill-formed XHTML web pages but this is Microsoft: http://moneycentral.msn.com/companyreport?Symbol=BBBY I can't validate it and xml.minidom.dom.parseString won't work on it. If this was just some teenager's web site I'd move on. Is there any hope avoiding re

Re: Randomizing in Python

2007-03-04 Thread [EMAIL PROTECTED]
On Mar 3, 1:56 pm, Mark Nenadov <[EMAIL PROTECTED]> wrote: > On Sat, 03 Mar 2007 08:46:09 -0800, [EMAIL PROTECTED] wrote: > > I want to randomize a certain calculation in Python but haven't > > figured it out yet. To explain what i mean, I'

Re: Project organization and import

2007-03-05 Thread [EMAIL PROTECTED]
On 5 mar, 01:21, "Martin Unsal" <[EMAIL PROTECTED]> wrote: > I'm using Python for what is becoming a sizeable project and I'm > already running into problems organizing code and importing packages. > I feel like the Python package system, in particular the i

Re: list-like behaviour of etree.Element

2007-03-05 Thread [EMAIL PROTECTED]
On Mar 5, 1:00 am, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: > Raymond Hettinger wrote: > > On Mar 4, 12:48 pm, "Daniel Nogradi" <[EMAIL PROTECTED]> wrote: > >> The etree.Element (or ElementTree.Element) supports a number of > >> list-l

Re: Newbie question

2007-03-05 Thread [EMAIL PROTECTED]
On Mar 5, 9:03 am, Stargaming <[EMAIL PROTECTED]> wrote: > Tommy Grav schrieb: > > For this case, there are list comprehensions (or map, but you shouldn't > use it any longer): I didn't see anything in the docs about this. Is map going away or is it considered un-P

New to Python

2007-03-05 Thread [EMAIL PROTECTED]
I am trying to get a program to add up input from the user to get to the number 100 using a loop. However, I am having some issues. Here is what I have so far. I know I am just trying to hard, but I am stuck. Thank you for any help. print "We need to count to 100" high_number = 100 total = 0

Re: New to Python

2007-03-05 Thread [EMAIL PROTECTED]
On Mar 5, 1:14 pm, "Arnaud Delobelle" <[EMAIL PROTECTED]> wrote: > On Mar 5, 6:33 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > > > > > I am trying to get a program to add up input from the user to get to > > the number 100

Re: ANN: PyDSTool now compatible with numpy 1.0.1, scipy 0.5.2 and 64-bit CPUs.

2007-03-05 Thread [EMAIL PROTECTED]
On Mar 2, 12:07 pm, "Rob Clewley" <[EMAIL PROTECTED]> wrote: > Mike, > > Yes, that is a pretty fair description of our support for symbolics > using Python's own inheritance. Our ModelSpec classes provide only an > elementary form of inheritance, polymorp

Re: CherryPy + Database questions

2007-03-05 Thread [EMAIL PROTECTED]
On Mar 5, 8:44 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Brian Blais wrote: > > Hello, > > > I have more of a conceptual question about the way databases work, in a > > web > > framework, but I will be implementing things with CherryPy an

This web site creates a *popup window* => how fetch contents in a script?

2007-03-05 Thread [EMAIL PROTECTED]
The following web page puts a report in a *popup window* by clicking the "Generate Report" button http://moneycentral.msn.com/investor/research/printrep.asp?Symbol=BBBY How can I grab this pop window page in a python script? (It doesn't seem to have a URL!?!) chris -- http://mail.python.or

Re: ANN: PyDSTool now compatible with numpy 1.0.1, scipy 0.5.2 and 64-bit CPUs.

2007-03-06 Thread [EMAIL PROTECTED]
On Mar 5, 10:17 pm, "Rob Clewley" <[EMAIL PROTECTED]> wrote: > I have a different and admittedly limited view of hybrid systems as > part of dynamical systems theory. In principle, I would love to have > time to write an interface to something like Modelica, but PyDSTo

Re: This web site creates a *popup window* => how fetch contents in a script?

2007-03-06 Thread [EMAIL PROTECTED]
On Mar 5, 10:38 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 06 Mar 2007 03:18:23 -0300, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> escribió: > > > The following web page puts a report in a *popup window* by clicking > >

Re: Project organization and import

2007-03-06 Thread [EMAIL PROTECTED]
On Mar 6, 12:49 pm, "Martin Unsal" <[EMAIL PROTECTED]> wrote: > On Mar 6, 9:19 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > > You do? Or do you only have trouble because you don't like using "from > > foo import Foo" because you

Re: Project organization and import

2007-03-06 Thread [EMAIL PROTECTED]
On Mar 6, 4:58 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > "Martin Unsal" <[EMAIL PROTECTED]> writes: > > I think you should be asking yourselves, "Did we all abandon reload() > > because it is actually an inferior workflow, or just because it&#x

<    26   27   28   29   30   31   32   33   34   35   >