Re: [Tutor] More problems with Learning Python example

2005-08-11 Thread Danny Yoo
> Traceback (most recent call last): >File "timings.py", line 16, in ? > do_timing(100, makezeros.lots_of_appends, makezeros.one_multiply) >File "timings.py", line 12, in do_timing > totals[func] = totals[func] + elapsed > KeyError: > help(KeyError) tells me Mapping key not fou

[Tutor] More problems with Learning Python example

2005-08-11 Thread ->Terry<-
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Thanks Danny and Bob. Your explanations not only helped me solve the error, but understand why i got the error. Unfortunately, I have run into another problem with the same example. Here is where I'm at now: My system is Slackware 10.1 and Python ve

Re: [Tutor] changes made if IDLE not updating when application executed?

2005-08-11 Thread Alan G
Jeff, > Hello, I am running a script I wrote with IDLE. > if I edit the script them hit 'F5' to run it again, > it seems to run the old script prior to the last save. Can you just confirm the sequence here please? 1) You are editing a script in IDLE loaded from a file. 2) You hit Save 3) You hi

Re: [Tutor] changes made if IDLE not updating when application executed?

2005-08-11 Thread Alan G
Jeff, > Hello, I am running a script I wrote with IDLE. > if I edit the script them hit 'F5' to run it again, > it seems to run the old script prior to the last save. Can you just confirm the sequence here please? 1) You are editing a script in IDLE loaded from a file. 2) You hit Save 3) You hi

Re: [Tutor] Problem with Learning Python example

2005-08-11 Thread Bob Gailer
At 02:10 PM 8/11/2005, ->Terry<- wrote: >-BEGIN PGP SIGNED MESSAGE- >Hash: SHA1 > > >Hello, > >I'm working my way through Learning Python 2nd Ed. and >I've ran across something I don't understand in Chapter >27, page 482, in Timing section. I checked the errata on >O'Reilly's web-site and i

Re: [Tutor] Problem with Learning Python example

2005-08-11 Thread Danny Yoo
Hi Terry, Ok, let's take a look at the problem. First, let's look at the error message again: > Traceback (most recent call last): >File "timings.py", line 16, in ? > do_timing(100, (makezeros.lots_of_appends, makezeros.one_multiply)) >File "timings.py", line 9, in do_timing >

[Tutor] Problem with Learning Python example

2005-08-11 Thread ->Terry<-
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello, I'm working my way through Learning Python 2nd Ed. and I've ran across something I don't understand in Chapter 27, page 482, in Timing section. I checked the errata on O'Reilly's web-site and it only mentions a missing comma in the print state

Re: [Tutor] help

2005-08-11 Thread geon
Dan Deternova napsal(a): i am making a simple script to get the hang of Tkinter. i want to use the input of the user from a Entry and calcuate the area. i have tryied many way... as you can see in my script.   the Entry is under def area():  and the output i want is under def cal():  ... please

[Tutor] changes made if IDLE not updating when application executed?

2005-08-11 Thread Jeff Peery
Hello, I am running  a script I wrote with IDLE. if I edit the script them hit 'F5' to run it again, it seems to run the old script prior to the last save. I have to close down the IDLE then start it again and hit 'F5' to get the changes to execute. is there a way to fix this?   Jeff___

Re: [Tutor] Untainting CGI parameters

2005-08-11 Thread Alan G
>>> type = re.search('\d+',a).group() or 'page' Traceback (most recent call last): File "", line 1, in ? AttributeError: 'NoneType' object has no attribute 'group' > If the search does not succeed, the returned object has the value > None, which has no attribute group. Ah yes! I forgot about t

Re: [Tutor] PyChecker: Installing and or Using

2005-08-11 Thread Dick Moores
Kent Johnson wrote at 05:31 8/11/2005: >According to the docs importing pychecker only checks modules that are >imported *after* the module containing the import. If you have a >single-file program try using pychecker from the command line. > >When you insert errors as a test, of course you have

[Tutor] OT: PHP-MySQL, and Python if possible

2005-08-11 Thread Bernard Lebel
Hello, Sorry for off-topic. I'm looking to buy a book about PHP, to build interface for MySQL tables. Since my current script library is in Python, something is also relevant to Python would definitely be nice. Looking for suggestions. Thanks in advance. Bernard

Re: [Tutor] SSH commands in Python on Linux

2005-08-11 Thread Bernard Lebel
Ok thanks everyone for the recommandations, I'll check them out. Bernard On 8/11/05, Jesse Noller <[EMAIL PROTECTED]> wrote: > On 8/10/05, Bernard Lebel <[EMAIL PROTECTED]> wrote: > > Hello, > > > > I'm trying to make a script to send a SSH command from a Linux > > computer to another Linux com

Re: [Tutor] SSH commands in Python on Linux

2005-08-11 Thread Jesse Noller
On 8/10/05, Bernard Lebel <[EMAIL PROTECTED]> wrote: > Hello, > > I'm trying to make a script to send a SSH command from a Linux > computer to another Linux compter. > > The Python syntax I'm using... > > > import os > os.system( 'ssh [EMAIL PROTECTED] "ls"' ) > > > Now the problem is that I'

Re: [Tutor] PyChecker: Installing and or Using

2005-08-11 Thread Kent Johnson
Dick Moores wrote: > But how do I move on? All I get is the above warning. > > For example, I put "import pychecker.checker" at the top of mycalc.py, my > collection of functions. Does getting only that warning mean that > mycalc.py has no problems? I've tried inserting some obvious errors, but

Re: [Tutor] Default class in module

2005-08-11 Thread Kent Johnson
Jan Eden wrote: > Hi, > > I'd like to pack some modules in a package. Each module contains a single > class, which forces me to > > from Pythonsite.Show import Page > page = Page() > ... > > class Page(Site.DB): #class DB from module Site in package Pythonsite > ... > > Is there a way

[Tutor] Python hosting again

2005-08-11 Thread Jorge Louis De Castro
  Hello,   I'm interested in writing with my own Python implementation of a Jabber IM server and client. Anyone knows where I could host my Python Jabber IM server for a reasonable monlthy fee? It doesn't need to be a top-notch place since my goal is to test something else, not the scalabili

Re: [Tutor] PyChecker: Installing and or Using

2005-08-11 Thread Dick Moores
Kent Johnson wrote at 04:55 8/11/2005: >Dick Moores wrote: > > It appears to me that I've found a bug in PyChecker (see below). Am I > > correct? > > Warning (from warnings module): > > File "C:\Python24\lib\site-packages\pychecker\checker.py", line 609 > > m = imp.init_builtin(moduleName

Re: [Tutor] PyChecker: Installing and or Using

2005-08-11 Thread Kent Johnson
Dick Moores wrote: > It appears to me that I've found a bug in PyChecker (see below). Am I > correct? > Warning (from warnings module): > File "C:\Python24\lib\site-packages\pychecker\checker.py", line 609 > m = imp.init_builtin(moduleName) > DeprecationWarning: the regex module is depre

Re: [Tutor] pls. help me in sorting and choosing

2005-08-11 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > If you can do this, then it is easy to ask python to sort it for you. > > data = [("NM_004619.2", 4910.8), ("NM_004619.2", 2716.3), ("NM_145759.1", > > 4805.7), ("NM_14 5759.1", 2716.3), ("XM_378692.1", 56.00)] > data.sort(key=lambda x: x[1], reverse=True) Yo

Re: [Tutor] Untainting CGI parameters

2005-08-11 Thread Jan Eden
Hi Alan, Alan G wrote on 11.08.2005: >> I will combine Kent's and your suggestion, because he included a >> check for an AttributeError: >> > >OK, as a slightly more perl-ish solution to the no Attribute problem >you could also do this: > >try: >type = re.search('\w+', parameters['type'].val

[Tutor] (no subject)

2005-08-11 Thread Hazel Bard
Hi, ive not been programming in python very long, but im using the wxPython to do GUI stuff. Ive been looking at some basic applications, and ive been having some funny problems with them. First of all, which is the best way to import wxPython, because some people seem to use 'import wx' and s

Re: [Tutor] Untainting CGI parameters

2005-08-11 Thread Alan G
> I will combine Kent's and your suggestion, because he included a > check for an AttributeError: > OK, as a slightly more perl-ish solution to the no Attribute problem you could also do this: try: type = re.search('\w+', parameters['type'].value).group() or 'page' except KeyError: type

Re: [Tutor] Untainting CGI parameters

2005-08-11 Thread Jan Eden
Hi Kent, hi Alan, Kent Johnson wrote on 10.08.2005: >OK, I don't know much Perl but I don't think these two snippets do >the same thing. For one thing the regexes are different, second in >the Python you need to check if the match succeeds. > >>my $type = ($parameters{type} && ($parameters{type}

Re: [Tutor] pls. help me in sorting and choosing

2005-08-11 Thread Danny Yoo
On Wed, 10 Aug 2005, Srinivas Iyyer wrote: > There is no cutoff. I would choose top 20% of the all the scores. Hi Srinivas, Those are GenBank accessions, aren't they? > 2. I know how to read a tab delim txt file as list but not into the > tupeles. Can you write a function that takes a line