[Tutor] Error 403 when accessing wikipedia articles?

2007-10-26 Thread Alex Ryu
Hi all I'm trying to use python to automatically download and process a (small) number of wikipedia articles. However, I keep getting a 403 (Forbidden Error), when using urllib2: >>> import urllib2 >>> ip = urllib2.urlopen("http://en.wikipedia.org/wiki/Pythonidae";) which gives this: Traceback (

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-26 Thread Dick Moores
At 05:00 AM 10/26/2007, bhaaluu wrote: >Greetings, > >On 10/26/07, Dick Moores <[EMAIL PROTECTED]> wrote: > > At 09:33 AM 10/25/2007, Dick Moores wrote: > > >Please give me constructive criticism of > > > > > > > Hmm. Nothing. One problem may be t

Re: [Tutor] Pythonic way to "try a few times, then raise exception"?

2007-10-26 Thread johnf
On Friday 26 October 2007 03:17:47 pm Alan Gauld wrote: > "Allen Fowler" <[EMAIL PROTECTED]> wrote > > > I have a block of code buried deep in a module > > that I expect to fail periodically. > > (Calls to other machines over slow network, and such.) > > > > Generally, though, trying it a second /

Re: [Tutor] Pythonic way to "try a few times, then raise exception"?

2007-10-26 Thread Alan Gauld
"Allen Fowler" <[EMAIL PROTECTED]> wrote > I have a block of code buried deep in a module > that I expect to fail periodically. > (Calls to other machines over slow network, and such.) > > Generally, though, trying it a second / third will work. > > Is there clean way to write this on Python

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-26 Thread Alan Gauld
"bhaaluu" <[EMAIL PROTECTED]> wrote > I certainly think this is something that Newbies (like myself) > should learn. > But without a MS-Windows computer handy, I don't know? Is there a > place that has this information? The Module documentation tells you which platforms are supported. But its m

[Tutor] Pythonic way to "try a few times, then raise exception"?

2007-10-26 Thread Allen Fowler
Hello, I have a block of code buried deep in a module that I expect to fail periodically. (Calls to other machines over slow network, and such.) Generally, though, trying it a second / third will work. Is there clean way to write this on Python? Thanks _

Re: [Tutor] How can isfile really do what it claims

2007-10-26 Thread Kent Johnson
Sandip Bhattacharya wrote: > $ ls -l /usr/lib/xulrunner/libfreebl3.so > lrwxrwxrwx 1 root root 20 2007-10-20 12:13 /usr/lib/xulrunner/libfreebl3.so > -> ../nss/libfreebl3.so > > $ python > Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32) > [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2

[Tutor] How can isfile really do what it claims

2007-10-26 Thread Sandip Bhattacharya
$ ls -l /usr/lib/xulrunner/libfreebl3.so lrwxrwxrwx 1 root root 20 2007-10-20 12:13 /usr/lib/xulrunner/libfreebl3.so -> ../nss/libfreebl3.so $ python Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 Type "help", "copyright", "c

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-26 Thread bhaaluu
Greetings, On 10/26/07, Dick Moores <[EMAIL PROTECTED]> wrote: > At 09:33 AM 10/25/2007, Dick Moores wrote: > >Please give me constructive criticism of > > > > Hmm. Nothing. One problem may be that only people using Windows can > run the script.

Re: [Tutor] How to implement function like this?

2007-10-26 Thread Kent Johnson
Ricardo Aráoz wrote: > Kent Johnson wrote: >> funcB(len(a)-L) does not do what the OP requested. For example if len(a) >> is 10, L will be 3 and you will call funcB(7). >> > > Don't get it. The 3 is because the len(a) is 3, notice that a is hard > coded and not a parameter. If you change 'a' then

Re: [Tutor] Using dictionary to find the mode of a list

2007-10-26 Thread Kent Johnson
Conor Leister wrote: > I'm just trying to get the mode of a list. > Here's the code I have that gathers the data and sorts it. i just need > to be able to get the mode of a using a dictionary and i can't seem to > figure out anything. i'm completely lost. this code works fine, i just > need to

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-26 Thread Dick Moores
At 09:33 AM 10/25/2007, Dick Moores wrote: >Please give me constructive criticism of > Hmm. Nothing. One problem may be that only people using Windows can run the script. I've developed chessTimer a bit further:

Re: [Tutor] about Tix

2007-10-26 Thread Alan Gauld
Linda, >I run the following code in Python 2.5 and got the error (when I do > "import Tix", no error). Congratulations I think this might just be the first Tix question on the tutor list! :-) > Traceback (most recent call last): > File "2.py", line 54, in >tkRoot = Tix.Tk( ) > File > "/L

Re: [Tutor] trouble with if

2007-10-26 Thread Alan Gauld
"Bryan Fodness" <[EMAIL PROTECTED]> wrote >I cannot get this to work either. Brian, when you post please tell us exactly what does not work. If there is an error message send the whole error there is a lot of useful information in them. Otherwise we have to read your code and guess what might be