[Tutor] Re: Tutor digest, Vol 1 #1311 - 16 msgs

Young-Jin Lee ylee12@uiuc.edu
Mon, 7 Jan 2002 13:58:08 -0600


I have touble using IDLE in redhat and I was told I needed to setup the idle
before I using it by "$ cd .../Tools/idle
$ python2.2 ./setup.py".
When I tried the aboves, python asked me to specify the option and command,
but I have no idea what to do.
Here is the message I got:
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2]
or: setup.py --help-commands
or: setup.py cmd --help.

I also tried "python2 ./setup.py idle", but it didn't work, either.

Thanks in advance.

YJ


----- Original Message -----
From: <tutor-request@python.org>
To: <tutor@python.org>
Sent: Saturday, January 05, 2002 9:59 AM
Subject: Tutor digest, Vol 1 #1311 - 16 msgs


> Send Tutor mailing list submissions to
> tutor@python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://mail.python.org/mailman/listinfo/tutor
> or, via email, send a message with subject or body 'help' to
> tutor-request@python.org
>
> You can reach the person managing the list at
> tutor-admin@python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Tutor digest..."
>
>
> Today's Topics:
>
>    1. RE: Learning Programming (alan.gauld@bt.com)
>    2. RE: Learning Programming (alan.gauld@bt.com)
>    3. CGI and ODBC questions (McCarney, James Alexander)
>    4. [Q] using IDLE in redhat (Young-Jin Lee)
>    5. Re: [Q] using IDLE in redhat (dman)
>    6. Re: [Q] using IDLE in redhat (Michael P. Reilly)
>    7. it slices, it dices, it makes BILLIONS and BILLIONS of juliene
fries... (Kirk D Bailey)
>    8. Re: it slices, it dices, it makes BILLIONS and BILLIONS of juliene
fries... (Andy W)
>    9. sliced! (Kirk D Bailey)
>   10. oops! (Kirk D Bailey)
>   11. Re: oops! (Danny Yoo)
>   12. A small math puzzle            [recreational Python] (Danny Yoo)
>   13. Re: A small math puzzle            [recreational Python] (Lloyd Hugh
Allen)
>   14. Re: A small math puzzle            [recreational Python] (Andy W)
>   15. How can handle exception? (A)
>   16. Re: How can handle exception? (Andy W)
>
> --__--__--
>
> Message: 1
> From: alan.gauld@bt.com
> To: e.kotyk@shaw.ca, tutor@python.org
> Subject: RE: [Tutor] Learning Programming
> Date: Fri, 4 Jan 2002 17:39:58 -0000
>
> > Subsequently Python was recommended at a good language for a
> > novice.  I have completed the tutorial by Josh Cogliati and
> > have written a few small modules on my own.
>
> Congratulations, that's the hardest bit over :-)
>
> > 1)  What is a reasonable length of time in which to learn a
> > programming language ?
>
> It depends on the language. Something enormous like C++ can
> take many months or years. In fact I've been learning C++ for
> over 15 years and still only know the basics!
>
> I've been learning Python for about 4 years and know about
> the same amount...
>
> > I'm a little disheartened at my prgress.
>
> Don't be, the more you use a language the more you learn.
> You only need the bare minimum to start using a language
> and that can literally be learnt in a couple of days
> - in the case of Python a couple of hours is enough for
> an experienced programmer to start using Python.
>
> It's the layers of detail that take a long time - like
> all of the modules in Python for example.
>
> > 2)  I think I would learn more quickly if I had a
> > project to work on...how do you choose a project?
>
> Something you need doing but put off coz it'll take too long?
> Or something you already do manually but could automate?
> Or just pick one of the challenges on the Useless Python site.
>
> Alan G.
>
>
> --__--__--
>
> Message: 2
> From: alan.gauld@bt.com
> To: rbl@hal.epbi.cwru.edu, e.kotyk@shaw.ca
> Cc: tutor@python.org
> Subject: RE: [Tutor] Learning Programming
> Date: Fri, 4 Jan 2002 17:47:18 -0000
>
> > From: Robin B. Lake [mailto:rbl@hal.epbi.cwru.edu]
> > learn that you DON'T want to "learn a programming language", but
> > rather should "learn how to program".
>
> This is excellent advice. Its the reason I used 3 languages
> on my web tutor rather than just python: to try to illustrate
> that the same principles apply in all languages.
>
> > children, learn to read before we learn to write.
>
> Thats also good advice, I can read many programming languages
> (around 30 maybe?) but I can only write in about 12...
>
> > Learning to WRITE a program should, in  my experience, be done with
> > "pseudocode" --- that expresses the structures and the logic of
> > the problem,...
> > THEN you can decide which language will best fit your problem.
>
> Also very good advice.
>
> Alan g.
> Author of the 'Learning to Program' web site
> http://www.freenetpages.co.uk/hp/alan.gauld
>
>
> --__--__--
>
> Message: 3
> From: "McCarney, James Alexander"
> <James.Alexander.McCarney@M3iSystems.com>
> To: "'tutor@python.org'" <tutor@python.org>
> Date: Fri, 4 Jan 2002 14:40:02 -0500
> Subject: [Tutor] CGI and ODBC questions
>
> Hail noble Python gurus!
>
> Well Py is way cool, but I am sure you all knew that long before I ever
> found out. ;-)
>
> I am turning my attention to server-side cgi-bin processing.
>
> What I have is this:
>
> -platform: W 2000
> -web server: (either Apache or IIS[gag]): would like to go w Apache, but
may
> have to port to IIS
> - Python (yay!) v 2.1.1
> - Access Database (ODBC driver) (Could go with mySQL, but Access is what I
> have right now.)
>
> What I want is this:
>
> Reader/reviewer has some comments about nifty documents I may have penned.
>
> Script serves a form he can fill in and commit to the dB.
>
> Script also e-mails me and tells me that this event has occurred.
>
>
> There is ample documentation on the cgi module, so I will do my homework
> there.
> But where is it written in Python/server cyberland about setting up Python
> with the server on NT? Likely with the http server docs you may claim.
>
> So has anyone gone down this road before? Does anyone have knowledge on
> setting up Python with one or other of these servers?
>
> And can anyone tell me how to get there from here?
>
> Best regards to all of you and thanks for any constructive help you may
> provide.
>
>
> James Alexander McCarney, Technical Writer
> M3i Systems Inc., 1111 Saint-Charles Avenue West
> 11th Floor, East Tower, Longueuil, Quebec, J4K 5G4
> Canada
> Telephone: (450) 928-3386 x2262
> Fax: (450) 442-5076
> http://www.m3isystems.com
>
>
> --__--__--
>
> Message: 4
> From: "Young-Jin Lee" <ylee12@uiuc.edu>
> To: <tutor@python.org>
> Date: Fri, 4 Jan 2002 15:24:59 -0600
> Subject: [Tutor] [Q] using IDLE in redhat
>
> Hi, I'm new to redhat and I'm looking for a help on how to use IDLE in
> redhat.
> I installed Python 2.2 the other day and tried to learn IDLE by typing it
> "idle", but it didn't work at all.
> I thought I should add a path to the idle so I added
> "PATH=$PATH:/usr/lib/python2.2/Tools; export PATH".
> But when I typed "idle" at my home directory, I got "bash:idle: command
not
> found". I have never used bash shell. (I have used csh in IRIX, but I
> decided to use bash because bash seems to be a standard in Linux).
> When I tried it with a full path, "/usr/lib/python2.2/Tools/idle/idle", I
> got the following python exception.
> Traceback (innermost last):
>     File "/usr/lib/python2.2/Tools/idle/idle", line 5, in ?
>         from idlelib import IdleConf
> ImportError: No module named idlelib
>
> The configuration seems to be not correct, but I have no idea. Is there a
> good tutorial or guide on how to use IDLE in redhat (or Linux)?
>
> Thanks in advance.
>
> YJ
>
>
>
> --__--__--
>
> Message: 5
> Date: Fri, 4 Jan 2002 16:44:20 -0500
> From: dman <dsh8290@rit.edu>
> To: tutor@python.org
> Subject: Re: [Tutor] [Q] using IDLE in redhat
>
> On Fri, Jan 04, 2002 at 03:24:59PM -0600, Young-Jin Lee wrote:
> | Hi, I'm new to redhat and I'm looking for a help on how to use IDLE in
> | redhat.
> | I installed Python 2.2 the other day and tried to learn IDLE by typing
it
> | "idle", but it didn't work at all.
> | I thought I should add a path to the idle so I added
> | "PATH=$PATH:/usr/lib/python2.2/Tools; export PATH".
>
> $PATH is what the shell uses to find commands.  $PYTHONPATH is what
> python uses to find modules.
>
> | But when I typed "idle" at my home directory, I got "bash:idle: command
not
> | found". I have never used bash shell. (I have used csh in IRIX, but I
> | decided to use bash because bash seems to be a standard in Linux).
> | When I tried it with a full path, "/usr/lib/python2.2/Tools/idle/idle",
I
> | got the following python exception.
> | Traceback (innermost last):
> |     File "/usr/lib/python2.2/Tools/idle/idle", line 5, in ?
> |         from idlelib import IdleConf
> | ImportError: No module named idlelib
>
> This means you need to set $PYTHONPATH correctly.  I don't know what
> is correct for a redhat system, but the debian packages work
> out-of-the-box.
>
> -D
>
> --
>
> If you hold to [Jesus'] teaching, you are really [Jesus'] disciples.
> Then you will know the truth, and the truth will set you free.
>         John 8:31-32
>
>
>
> --__--__--
>
> Message: 6
> Date: Fri, 4 Jan 2002 18:52:27 -0500
> From: "Michael P. Reilly" <arcege@speakeasy.net>
> To: tutor@python.org
> Subject: Re: [Tutor] [Q] using IDLE in redhat
> Reply-To: arcege@speakeasy.net
>
> On Fri, Jan 04, 2002 at 03:24:59PM -0600, Young-Jin Lee wrote:
> > Hi, I'm new to redhat and I'm looking for a help on how to use IDLE in
> > redhat.
> > I installed Python 2.2 the other day and tried to learn IDLE by typing
it
> > "idle", but it didn't work at all.
> > I thought I should add a path to the idle so I added
> > "PATH=$PATH:/usr/lib/python2.2/Tools; export PATH".
> > But when I typed "idle" at my home directory, I got "bash:idle: command
not
> > found". I have never used bash shell. (I have used csh in IRIX, but I
> > decided to use bash because bash seems to be a standard in Linux).
> > When I tried it with a full path, "/usr/lib/python2.2/Tools/idle/idle",
I
> > got the following python exception.
> > Traceback (innermost last):
> >     File "/usr/lib/python2.2/Tools/idle/idle", line 5, in ?
> >         from idlelib import IdleConf
> > ImportError: No module named idlelib
> >
> > The configuration seems to be not correct, but I have no idea. Is there
a
> > good tutorial or guide on how to use IDLE in redhat (or Linux)?
> >
> > Thanks in advance.
>
> Unfortunately, Idle got screwed when they tried to get it into Python 2.1
> with the new distutils.  You must now install IDLE before you can use it;
> you cannot use it in its place like you could with earlier releases.
>
> You need to install it by running the setup.py file in the Tools/idle
> directory.
> $ cd .../Tools/idle
> $ python2.2 ./setup.py
>
>   -Arcege
>
>
>
> --__--__--
>
> Message: 7
> Date: Sat, 5 Jan 00:39:28 2002 -0500
> From: "Kirk D Bailey" <highprimate@howlermonkey.net>
> To: tutor@python.org
> Subject: [Tutor] it slices, it dices, it makes BILLIONS and BILLIONS of
juliene fries...
>
> But more importantly, I want to take a string of seceral words and
> chop it into a list with each word an item in the list.
>
> Among other things. But let's talk about the other things later.
>
>
> end
>
> In total confusion,
>                    Kirk D Bailey
>
>  +----------------------------------------------------+
>  |   Providing Excellent email service for free!!     |
>  |    Webmaster, Howlermonkey Email services Co.      |
>  | highprimate@howlermonkey.net www.howlermonkey.net/ |
>  +----------------------------------------------------+
>
> ODD#1.8.01/kdb/sigme
>
> <a
href="http://www.totallyfreepaging.com/checksource.asp?ID=89212&PT=AZC1XT"
target="_top"><IMG
> SRC="amtfp2.gif" WIDTH=468 HEIGHT=60 alt="Totally Free Paging!"></a>
>
>
>
> --__--__--
>
> Message: 8
> From: "Andy W" <toodles@yifan.net>
> To: <tutor@python.org>
> Subject: Re: [Tutor] it slices, it dices, it makes BILLIONS and BILLIONS
of juliene fries...
> Date: Sat, 5 Jan 2002 14:09:34 +0800
>
> > But more importantly, I want to take a string of seceral words and
> > chop it into a list with each word an item in the list.
> >
> > Among other things. But let's talk about the other things later.
>
> several_words_string="Scooby Dooby Doo"
> several_words_list=several_words.split()
>
> That is, as long as the words are separated by spaces. Otherwise
> several_words.split(separator)
>
> >
> >
> > end
> >
> > In total confusion,
> >                    Kirk D Bailey
> >
> >  +----------------------------------------------------+
> >  |   Providing Excellent email service for free!!     |
> >  |    Webmaster, Howlermonkey Email services Co.      |
> >  | highprimate@howlermonkey.net www.howlermonkey.net/ |
> >  +----------------------------------------------------+
> >
> > ODD#1.8.01/kdb/sigme
> >
> > <a
> href="http://www.totallyfreepaging.com/checksource.asp?ID=89212&PT=AZC1XT"
> target="_top"><IMG
> > SRC="amtfp2.gif" WIDTH=468 HEIGHT=60 alt="Totally Free Paging!"></a>
> >
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor@python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
>
>
>
> --__--__--
>
> Message: 9
> Date: Sat, 5 Jan 01:17:03 2002 -0500
> From: "Kirk D Bailey" <highprimate@howlermonkey.net>
> To: tutor@python.org
> Subject: [Tutor] sliced!
>
> OK, I tripped over string.replace(subject, search, replacement) in
> string module, and also string.split, so that part is finished, it
> now digests the subject line nicely.
>
> Got another question.
>
> ---------------------------------------------------------
> Def writependings(omitme, list):        # write back the pendings,
>         f6.open('./lists/pending','w')  # OMITTING one item.
>         for item in list:
>                 if item != omitme:
>                         f6.write(item)+CRLF
>         f6.close()
> ----------------------------------------------------------
> This code creates a error message;
>
> ------------------------------------------------------------
> ns# ./TLlistmaster.py < testfile
>   File "./TLlistmaster.py", line 201
>     Def writependings(omitme, list):    # write back the pendings,
>                     ^
> SyntaxError: invalid syntax
> ns#_
> --------------------------------------------------------------
>
> Now, whofore would it do an evil thing like that?
>
>
>
>
>
>
> end
>
> In total confusion,
>                    Kirk D Bailey
>
>  +----------------------------------------------------+
>  |   Providing Excellent email service for free!!     |
>  |    Webmaster, Howlermonkey Email services Co.      |
>  | highprimate@howlermonkey.net www.howlermonkey.net/ |
>  +----------------------------------------------------+
>
> ODD#1.8.01/kdb/sigme
>
> <a
href="http://click.linksynergy.com/fs-bin/stat?id=Jy/DqAOH/SU&offerid=2161.1
00
> 00026&type=1&subid=0">Return to the Forgotten Realms on a visually
dazzling role-playing adventure that brings to
> life the grand tradition of Advanced
> Dungeons & Dragons through cutting edge art and technology. Now available
for
> pre-order. Only $39.95 from Outpost.com. FREE SHIPPING. OVERNIGHT.
> </a><IMG border=0 width=1 height=1
src="http://ad.linksynergy.com/fs-bin/show?id=Jy/DqAOH/SU&bids=2161.10000026
&
> type=1&subid=0">
>
>
>
> --__--__--
>
> Message: 10
> Date: Sat, 5 Jan 01:25:34 2002 -0500
> From: "Kirk D Bailey" <highprimate@howlermonkey.net>
> To: tutor@python.org
> Subject: [Tutor] oops!
>
> OK, noticed an oops. incorrect open statement, was f6.open(foo),
> not f6=open(foo).
>
> open statement is fixed, but it still barks like a dog.
>
> Here's the New and improved code:
>
> #
> Def writependings(omitme, list):        # write back the pendings,
>         f6=open('./lists/pending','w')  # OMITTING one item.
>         for item in list:
>                 if item != omitme:
>                         f6.write(item)+CRLF
>         f6.close()
> #
> Gives this result:
>
>                                                     [ Wrote 266 lines
> ]
>
> ns# ./TLlistmaster.py < testfile
>   File "./TLlistmaster.py", line 201
>     Def writependings(omitme, list):      # write back the pendings,
>                     ^
> SyntaxError: invalid syntax
> ns#_
>
> COULD IT BE this function name is simply too long?
>
>
>
>
>
>
>
>
> end
>
> In total confusion,
>                    Kirk D Bailey
>
>  +----------------------------------------------------+
>  |   Providing Excellent email service for free!!     |
>  |    Webmaster, Howlermonkey Email services Co.      |
>  | highprimate@howlermonkey.net www.howlermonkey.net/ |
>  +----------------------------------------------------+
>
> ODD#1.8.01/kdb/sigme
>
> <a
href="http://click.linksynergy.com/fs-bin/stat?id=Jy/DqAOH/SU&offerid=18076.
10
> 000002&type=1&subid=0">http://www.winfreestuff.com</a><IMG border=0
width=1 height=1
>
src="http://ad.linksynergy.com/fs-bin/show?id=Jy/DqAOH/SU&bids=18076.1000000
2
> &type=1&subid=0" >
>
>
>
> --__--__--
>
> Message: 11
> Date: Fri, 4 Jan 2002 22:40:05 -0800 (PST)
> From: Danny Yoo <dyoo@hkn.eecs.berkeley.edu>
> To: Kirk D Bailey <highprimate@howlermonkey.net>
> cc: tutor@python.org
> Subject: Re: [Tutor] oops!
>
> On Sat, 5 Jan 2002, Kirk D Bailey wrote:
>
> > Def writependings(omitme, list):        # write back the pendings,
> >         f6=open('./lists/pending','w')  # OMITTING one item.
> >         for item in list:
> >                 if item != omitme:
> >                         f6.write(item)+CRLF
> >         f6.close()
> >
> > ns# ./TLlistmaster.py < testfile
> >   File "./TLlistmaster.py", line 201
> >     Def writependings(omitme, list):      # write back the pendings,
> >                     ^
> > SyntaxError: invalid syntax
> > ns#_
> >
> > COULD IT BE this function name is simply too long?
>
>
> Function names can be pretty long:
>
> ###
> >>> def salutatiousGreeting(): print "salutations!"
> ...
> >>> salutatiousGreeting()
> salutations!
> ###
>
> What you're running into is the case sensitivity of Python keywords:
>
> ###
> >>> Def hello():
>   File "<string>", line 1
>     Def hello():
>             ^
> SyntaxError: invalid syntax
> ###
>
> The error's pointing at the "hello", but it's really the 'Def' that's
> confusing Python.  Lowercase the 'Def', and you should be ok.
>
>
>
>
> --__--__--
>
> Message: 12
> Date: Sat, 5 Jan 2002 01:53:04 -0800 (PST)
> From: Danny Yoo <dyoo@hkn.eecs.berkeley.edu>
> To: tutor@python.org
> Subject: [Tutor] A small math puzzle            [recreational Python]
>
> Hi everyone,
>
> I ran across this puzzle while browsing the the 'alt.math.undergrad'
> newsgroup.  I thought it might make a fun programming exercise, so here's
> my paraphrase of the puzzle:
>
>
> A "rearrangement without fixed letters" of a given word is a mixup of the
> letters so that, if one were to overlap the original with the
> rearrangement, no letters should match.  For example, given the word:
>
>     'TERESA'
>
> here are a two "rearrangements without fixed letters":
>
>     ['RTESAE', 'SATREE']
>
> However, here's an example that is a rearrangement but doesn't work
> because it has a fixed letter:
>
>     'TRESAE'
>      ^
>
> In this example, the 'T' makes this rearrangement inacceptable, since
> 'TERESA' itself begins with a 'T' too.
>
>
> The puzzle is to write a program that counts all the possible
> rearrangements without fixed letters.
>
>
> Have fun!
>
>
>
> --__--__--
>
> Message: 13
> Date: Sat, 05 Jan 2002 08:32:15 -0500
> From: Lloyd Hugh Allen <l.h.allen@verizon.net>
> Reply-To: lha2@columbia.edu
> To: tutor@python.org
> Subject: Re: [Tutor] A small math puzzle            [recreational Python]
>
> Danny Yoo wrote:
> > However, here's an example that is a rearrangement but doesn't work
> > because it has a fixed letter:
> >
> >     'TRESAE'
> >      ^
> >
> > In this example, the 'T' makes this rearrangement inacceptable, since
> > 'TERESA' itself begins with a 'T' too.
> >
> > The puzzle is to write a program that counts all the possible
> > rearrangements without fixed letters.
> >
> > Have fun!
>
> Is it necessary to actually construct the list of rearrangements, or do
> you just want a function that will compute how many rearrangements
> exist?
>
>
> --__--__--
>
> Message: 14
> From: "Andy W" <toodles@yifan.net>
> To: "Danny Yoo" <dyoo@hkn.eecs.berkeley.edu>,
> <tutor@python.org>
> Subject: Re: [Tutor] A small math puzzle            [recreational Python]
> Date: Sat, 5 Jan 2002 22:26:20 +0800
>
> Here's a solution, albeit a cruddy one :-)
> It uses permutations, so therefore gets dreadfully slow from about 8
letters
> onwards.
> I knew this would happen, I just couldn't get my mind around the
> mathematical approach...
>
> Andy W.
>
> PS. The function actually returns all the rearrangements, not the number
of
> them. Of course that can easily be changed...
>
> #Code
>
> def perm(set,n):
>   """
>   By Kirby Urner.
>   Return all permutations of a set.  Thanks to
>   Daniel Ajoy for sharing his Logo version with me.
>   """
>
>   set=listify(set)
>
>   if len(set)==0:  return []
>   elif len(set)==1:  return set
>   answ = []
>
>   for i in range(len(set)):
>     base = [set[0]]
>     rest = set[1:]
>     answ = answ + [base + listify(i) for i in perm(rest,n-1)]
>     set = [set[-1]]+set[:-1]
>
>   return answ
>
> def listify(obj):
>   "Used in conjunction with perm()"
>   if type(obj) is not type([]):
>     try:
>       l=list(obj)
>     except:
>       l=[obj]
>     return l
>   else: return obj
>
> def get_rearrangements(word):
>   word=word.upper()
>   perms=perm([char for char in word],len(word))  #Get the permutations of
> the letters
>   rearrangements=perms[:] #Copy for keeping the good ones in
>   for p in perms:
>     ok=1
>     for n in range(len(p)):
>       if p[n]==word[n]: #Check whether the character is the same...
>         ok=0
>     if not ok:
>       rearrangements.remove(p) #If it is, remove it!
>   return [''.join(r) for r in rearrangements]
>
> ----- Original Message -----
> From: "Danny Yoo" <dyoo@hkn.eecs.berkeley.edu>
> To: <tutor@python.org>
> Sent: Saturday, January 05, 2002 5:53 PM
> Subject: [Tutor] A small math puzzle [recreational Python]
>
>
> > Hi everyone,
> >
> > I ran across this puzzle while browsing the the 'alt.math.undergrad'
> > newsgroup.  I thought it might make a fun programming exercise, so
here's
> > my paraphrase of the puzzle:
> >
> >
> > A "rearrangement without fixed letters" of a given word is a mixup of
the
> > letters so that, if one were to overlap the original with the
> > rearrangement, no letters should match.  For example, given the word:
> >
> >     'TERESA'
> >
> > here are a two "rearrangements without fixed letters":
> >
> >     ['RTESAE', 'SATREE']
> >
> > However, here's an example that is a rearrangement but doesn't work
> > because it has a fixed letter:
> >
> >     'TRESAE'
> >      ^
> >
> > In this example, the 'T' makes this rearrangement inacceptable, since
> > 'TERESA' itself begins with a 'T' too.
> >
> >
> > The puzzle is to write a program that counts all the possible
> > rearrangements without fixed letters.
> >
> >
> > Have fun!
> >
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor@python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
>
>
>
> --__--__--
>
> Message: 15
> From: "A" <printers@sendme.cz>
> To: python-list@python.org, tutor@python.org,
>    activepython@listserv.ActiveState.com
> Date: Sat, 5 Jan 2002 16:21:59 +0100
> Reply-to: printers@sendme.cz
> Subject: [Tutor] How can handle exception?
>
>
>
> Hello,
> My program sometimes raise the exception
>
> socket.error: (10061, 'Connection refused')
>
> How can I handle this kind of exception?
> Thank you for help.
> Ladislav
>
>
>
> --__--__--
>
> Message: 16
> From: "Andy W" <toodles@yifan.net>
> To: <python-list@python.org>,
> <tutor@python.org>,
> <activepython@listserv.ActiveState.com>
> Subject: Re: [Tutor] How can handle exception?
> Date: Sat, 5 Jan 2002 23:57:53 +0800
>
> Hi Ladislav
>
> > Hello,
> > My program sometimes raise the exception
> >
> > socket.error: (10061, 'Connection refused')
> >
> > How can I handle this kind of exception?
>
> Enclose it in try, except socket.error. ie.:-
>
> try:
>   #do stuff here
> except socket.error:
>   #handle exception here
>
> Andy
>
> > Thank you for help.
> > Ladislav
> >
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor@python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
>
>
>
>
> --__--__--
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
> End of Tutor Digest
>