From Heiko.Kuhrt@t-online.de Sun Aug 1 10:47:44 1999 From: Heiko.Kuhrt@t-online.de (Heiko) Date: Sun, 1 Aug 1999 11:47:44 +0200 (MEST) Subject: [Tutor] A beginner's question In-Reply-To: <19990728123644.9271.rocketmail@web204.mail.yahoo.com> Message-ID: Hi Martin! Try to start with Guidos Python-Tutorial. Begin with chapter 3 informal introduction, 4 Flow Control and 7 Input / Output. Get some development-environment into action, so you can change code and try out without too mutch of typing. That means write your Python-code with an editor into filex and make that editor execute python with filex. ?)) Don´t play arround with Pythons interactive interpreter. That´s frustrating as you allways have to start from begining. ( But think about using it as your personal on-screen-calculator. ) Start with small software development projects like 1) add 2 numbers and print result 2) 1+1= 1+2= ... 1+9= 3) 1+1= ... 9+9= Ask more qs here ;) --Heiko From eroubinc@u.washington.edu Sun Aug 1 18:36:06 1999 From: eroubinc@u.washington.edu (Evgeny Roubinchtein) Date: Sun, 1 Aug 1999 10:36:06 -0700 (PDT) Subject: [Tutor] Getting current path In-Reply-To: <19990726101029.A5832@pooh.frostnet.net> Message-ID: On Mon, 26 Jul 1999, Chris Frost wrote: >How could I tell if the user simply entered a filename, or if they gave >the entire path (assuming unix if that helps)? Maybe something like: >>> import os >>> os.path.split('foo.bar') ('', 'foo.bar') >>> os.path.split('/home/me/mysubdir/foo.bar') ('/home/me/mysubdir', 'foo.bar') >>> os.path.split('foo.bar')[0] == '' 1 >>> os.path.split('/home/me/mysubdir/foo.bar')[0] == '' 0 os and os.path modules seem to have tons of goodies like that. -- Evgeny Roubinchtein, eroubinc@u.washington.edu ................... I used to have a life, then I got v32bis! From deirdre@deirdre.net Tue Aug 3 08:35:14 1999 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Tue, 3 Aug 1999 00:35:14 -0700 (PDT) Subject: [Tutor] Two-Dimensional arrays Message-ID: I have a problem that needs two-dimensional arrays, but NumPy really seems like overkill. I had solved it another way, then realized I really *needed* two-dimensional arrays. Here's my constraints (for a knitwear design project I'm working on): 1) typically an array will contain between 10k and 50k elements. Each element will have a stitch attribute and a color attribute (think two bytes). 2) the most mathematically advanced thing I need to do with the elements is copy one row to the next (and apply patterning, which I don't expect to do for a while). Ideas? -- _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net Indeed, when I design my killer language, the identifiers "foo" and "bar" will be reserved words, never used, and not even mentioned in the reference manual. Any program using one will simply dump core without comment. Multitudes will rejoice. -- Tim Peters From M.Faassen@vet.uu.nl Tue Aug 3 15:16:36 1999 From: M.Faassen@vet.uu.nl (Martijn Faassen) Date: Tue, 03 Aug 1999 16:16:36 +0200 Subject: [Tutor] Two-Dimensional arrays References: Message-ID: <37A6F9C4.8DD98876@pop.vet.uu.nl> Deirdre Saoirse wrote: > > I have a problem that needs two-dimensional arrays, but NumPy really seems > like overkill. I had solved it another way, then realized I really > *needed* two-dimensional arrays. Will an array of arrays do, then? > Here's my constraints (for a knitwear design project I'm working on): > > 1) typically an array will contain between 10k and 50k elements. Each > element will have a stitch attribute and a color attribute (think two > bytes). Okay, so your arrays are big but each element is of the same type. I'd suggest you look into the array module for this. > 2) the most mathematically advanced thing I need to do with the elements > is copy one row to the next (and apply patterning, which I don't expect to > do for a while). My knowledge of knitwear is absent. But it looks like a Python list of array modules could do the trick. Regards, Martijn From da@ski.org Tue Aug 3 17:49:43 1999 From: da@ski.org (David Ascher) Date: Tue, 3 Aug 1999 09:49:43 -0700 (Pacific Daylight Time) Subject: [Tutor] Two-Dimensional arrays In-Reply-To: Message-ID: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --2373553-9255-933698983=:145 Content-Type: TEXT/PLAIN; charset=US-ASCII On Tue, 3 Aug 1999, Deirdre Saoirse wrote: > I have a problem that needs two-dimensional arrays, but NumPy really seems > like overkill. I had solved it another way, then realized I really > *needed* two-dimensional arrays. > > Here's my constraints (for a knitwear design project I'm working on): > > 1) typically an array will contain between 10k and 50k elements. Each > element will have a stitch attribute and a color attribute (think two > bytes). > > 2) the most mathematically advanced thing I need to do with the elements > is copy one row to the next (and apply patterning, which I don't expect to > do for a while). Here's a little something based, as was suggested, on a list of arrays. It's incomplete, but it should be a start -- while it only deals with 'single-attribute arrays', it shouldn't be too hard to make a "multiattributemat' which builds on Mat to deal w/ multivalued arrays. --david usage: x = Mat((10,10), 'i') x[0] = [4]*10 x[1][4:10] = x[0][:6] x[2] = x[0] etc. --2373553-9255-933698983=:145 Content-Type: TEXT/plain; name="mat.py" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename="mat.py" ZnJvbSBhcnJheSBpbXBvcnQgYXJyYXkNCmltcG9ydCBzdHJpbmcNCg0KY2xh c3MgTWF0Og0KICAgIGRlZmF1bHRzID0ge30NCiAgICBmb3IgZCBpbiAoJ2JC aEhpSWxMZmQnKTogZGVmYXVsdHNbZF0gPSAwLjANCiAgICBkZWZhdWx0c1sn YyddID0gJyAnDQoNCiAgICBkZWYgX19pbml0X18oc2VsZiwgKHdpZHRoLCBo ZWlnaHQpLCB0eXBlY29kZSwgZGVmYXVsdD1Ob25lKToNCglhc3NlcnQgTWF0 LmRlZmF1bHRzLmhhc19rZXkodHlwZWNvZGUpDQoNCglzZWxmLnJvd3MgPSBb Tm9uZV0qaGVpZ2h0DQoJc2VsZi53aWR0aCA9IHdpZHRoDQoJc2VsZi5oZWln aHQgPSBoZWlnaHQNCglzZWxmLnR5cGVjb2RlID0gdHlwZWNvZGUNCglmb3Ig aSBpbiByYW5nZShoZWlnaHQpOg0KCSAgICBpZiBkZWZhdWx0IGlzIE5vbmU6 DQoJCWluaXQgPSBbTWF0LmRlZmF1bHRzW3R5cGVjb2RlXV0qd2lkdGgNCgkg ICAgZWxzZToNCgkJaWYgdHlwZShkZWZhdWx0KSBpbiAodHlwZSgoKSksIHR5 cGUoW10pKToNCgkJICAgIGFzc2VydCBsZW4oZGVmYXVsdCkgPT0gd2lkdGgN CgkJICAgIGluaXQgPSBkZWZhdWx0DQoJCWVsc2U6DQoJCSAgICBpbml0ID0g ZGVmYXVsdCp3aWR0aA0KCSAgICBzZWxmLnJvd3NbaV0gPSBhcnJheSh0eXBl Y29kZSwgaW5pdCkNCg0KICAgIGRlZiBfX2dldHNsaWNlX18oc2VsZiwgc3Rh cnQsIGVuZCk6DQoJcmV0dXJuIHNlbGYucm93c1tzdGFydDplbmRdDQoNCiAg ICBkZWYgX19nZXRpdGVtX18oc2VsZiwgaXRlbSk6DQoJaWYgdHlwZShpdGVt KSA9PSB0eXBlKCgpKToNCgkgICAgYXNzZXJ0IGxlbihpdGVtKSA9PSAyDQoJ ICAgIGksaiA9IGl0ZW0NCgkgICAgcmV0dXJuIHNlbGYucm93c1tpXVtqXQ0K CWVsaWYgdHlwZShpdGVtKSA9PSB0eXBlKDApOg0KCSAgICByZXR1cm4gc2Vs Zi5yb3dzW2l0ZW1dICAjIHNoYXJlZCByZWZlcmVuY2UhDQoJZWxpZiB0eXBl KGl0ZW0pID09IHR5cGUoc2xpY2UoMCwxLDEpKToNCgkgICAgIyBkZWFsIHdp dGggZXh0ZW5kZWQgc2xpY2VzDQoJICAgIHJhaXNlICJVbmltcGxlbWVudGVk Ig0KDQogICAgZGVmIF9fc2V0aXRlbV9fKHNlbGYsIGl0ZW0sIHZhbHVlKToN CglpZiB0eXBlKGl0ZW0pID09IHR5cGUoKCkpOg0KCSAgICBhc3NlcnQgbGVu KGl0ZW0pID09IDINCgkgICAgaSxqID0gaXRlbQ0KCSAgICBzZWxmLnJvd3Nb aV1bal0gPSB2YWx1ZQ0KCWVsaWYgdHlwZShpdGVtKSA9PSB0eXBlKDApOg0K CSAgICBhc3NlcnQgbGVuKHZhbHVlKSA9PSBzZWxmLndpZHRoDQoJICAgIHZh bHVlID0gbGlzdCh2YWx1ZSkNCgkgICAgc2VsZi5yb3dzW2l0ZW1dID0gYXJy YXkoc2VsZi50eXBlY29kZSwgdmFsdWUpDQoJZWxpZiB0eXBlKGl0ZW0pID09 IHR5cGUoc2xpY2UoMCwxLDEpKToNCgkgICAgIyBkZWFsIHdpdGggZXh0ZW5k ZWQgc2xpY2VzDQoJICAgIHJhaXNlICJVbmltcGxlbWVudGVkIg0KDQogICAg ZGVmIF9fcmVwcl9fKHNlbGYpOg0KCXJvd3MgPSBbXQ0KCWZvciByIGluIHNl bGYucm93czoNCgkgICAgcm93cy5hcHBlbmQoc3RyKHIpW2xlbigiYXJyYXko J2knLCAiKTotMV0pDQoJcmV0dXJuIHN0cmluZy5qb2luKHJvd3MsICcsXG4n KQ0KDQp4ID0gTWF0KCgxMCwxMCksICdpJykNCnByaW50IHgNCg== --2373553-9255-933698983=:145-- From deirdre@deirdre.net Tue Aug 3 18:16:06 1999 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Tue, 3 Aug 1999 10:16:06 -0700 (PDT) Subject: [Tutor] Two-Dimensional arrays In-Reply-To: Message-ID: On Tue, 3 Aug 1999, David Ascher wrote: > Here's a little something based, as was suggested, on a list of arrays. I had considered this approach, but hadn't really through through it. > It's incomplete, but it should be a start -- while it only deals with > 'single-attribute arrays', it shouldn't be too hard to make a > "multiattributemat' which builds on Mat to deal w/ multivalued arrays. It's great! Thanks! -- _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net Indeed, when I design my killer language, the identifiers "foo" and "bar" will be reserved words, never used, and not even mentioned in the reference manual. Any program using one will simply dump core without comment. Multitudes will rejoice. -- Tim Peters From KShao@AstralPoint.com Thu Aug 5 00:34:58 1999 From: KShao@AstralPoint.com (Ke-Hsiang Shao) Date: Wed, 4 Aug 1999 19:34:58 -0400 Subject: [Tutor] Does expy-4.0a works on NT 4.0 platform ? Message-ID: <8F1BE54DECC1D211BB2500105A9CA4211546D6@ADMIN1> Hi there, I found the expect 5.21 on http://expect.nist.gov/ works with TCL 8.0. The expy-0.4a.tar.gz I got from string-SIG coordinator has been tested with Python 1.2, Tcl 7.3 and Expect 5.13.0. My questions are 1) Is this version expy-0.4a works on NT 4.0 ? (I found the installation instruction ask me to recompile the Pathon. But I failed to run it on NT 4.0. All the instructions looks like UNIX/Linux platform to me.) If the answer is no, is that means so far there is no way to run EXPECT on Python under NT 4.0 platform ? 2) If this version works on NT 4.0, do I have to run this with "Python 1.2, Tcl 7.3 and Expect 5.13.0" ? --------------------- I also found expectpy 1.8.2 has been ported to Linux (please see http://x23.deja.com/[ST_rn=ps]/getdoc.xp?AN=497964257&CONTEXT=933804116.1882 915025&hitnum=9). Does anyone know is any expect running on Python NT platform ? --------------------- Another place (http://x23.deja.com/[ST_rn=ps]/getdoc.xp?AN=498341988.11&CONTEXT=933804116. 1882915025&hitnum=43) mentioned a pre-release Python PIPE can play the expect-like function. Is this work on NT platform ? Thanks in advance Cary Kehsiang email: Shao cary_shao@yahoo.com Astral Point Communications, Inc. kshao@astralpoint.com 27 Industrial Ave., Chelmsford, MA 01824 Phone: (978) 256-9984 Fax: (978) 256-6128 From arcege@shore.net Thu Aug 5 02:32:43 1999 From: arcege@shore.net (Michael P. Reilly) Date: Wed, 4 Aug 1999 21:32:43 -0400 (EDT) Subject: [Tutor] Does expy-4.0a works on NT 4.0 platform ? In-Reply-To: <8F1BE54DECC1D211BB2500105A9CA4211546D6@ADMIN1> from Ke-Hsiang Shao at "Aug 4, 99 07:34:58 pm" Message-ID: <199908050132.VAA20617@northshore.shore.net> [Charset iso-8859-1 unsupported, filtering to ASCII...] > > Hi there, > > I found the expect 5.21 on http://expect.nist.gov/ works with TCL 8.0. The > expy-0.4a.tar.gz I got from string-SIG coordinator has been tested with > Python 1.2, Tcl 7.3 and Expect 5.13.0. > > My questions are > > 1) Is this version expy-0.4a works on NT 4.0 ? > (I found the installation instruction ask me to recompile the Pathon. But > I failed to run it on NT 4.0. All the instructions looks like UNIX/Linux > platform to me.) > > If the answer is no, is that means so far there is no way to run EXPECT > on Python under NT 4.0 platform ? The expy module is quite old (Jun 21 1994), so I don't think it will work with NT. Specifically, it is not that the Python extensions are not for NT; it is that Expect (5.28.1 is the latest release) does not run on NT, mostly because it relies on pseudoterminals which I don't believe exist on NT. Someone did write an unofficial NT port for Expect (with a link from the nist.gov website). > 2 If this version works on NT 4.0, do I have to run this with "Python 1.2, > Tcl 7.3 and Expect 5.13.0" ? > I also found expectpy 1.8.2 has been ported to Linux (please see > http://x23.deja.com/[ST_rn=ps]/getdoc.xp?AN=497964257&CONTEXT=933804116.1882 > 915025&hitnum=9). Does anyone know is any expect running on Python NT > platform ? I can safely say that ExpectPy does not run on NT - I'm the author. I have no plans to port it to this unofficial NT port mentioned above. > Another place > (http://x23.deja.com/[ST_rn=ps]/getdoc.xp?AN=498341988.11&CONTEXT=933804116. > 1882915025&hitnum=43) mentioned a pre-release Python PIPE can play the > expect-like function. Is this work on NT platform ? I don't remember this, but you could look at the source for the standard module telnetlib to see how the expect() method where works and see about wrapping it around a pipe. There are other Python-only modules available from the Contributed page. -Arcege -- ------------------------------------------------------------------------ | Michael P. Reilly, Release Engineer | Email: arcege@shore.net | | Salem, Mass. USA 01970 | | ------------------------------------------------------------------------ From scott@endall.com Fri Aug 6 03:21:42 1999 From: scott@endall.com (Scotty Michael) Date: Thu, 5 Aug 1999 22:21:42 -0400 Subject: [Tutor] FW: Retrieving a text file with a URL call Message-ID: <01BEDF90.E5C796E0@ABD788D3.ipt.aol.com> I apologize for how totally ignorant I am with respect to your product. I am an Xbase developer of a distributed business management application written using Foxpro for Windows. We have recently experienced the need to pull down text files created with a URL call over the Internet and save them to a predetermined location on the users hard drive. We have found that using DDE we can complete this task with users that have NetScape; however, IE does not support the parameter to specify where the file needs to be saved. I do a lot of work with NeoMedia and they suggested that Python could address our problems. Let me know if it sounds like python is the tool that I need to put together a piece of code that could be distributed to our users and called from their application to retrieve this file and save it to their hard drive. Thanks Scott Michael scott@endall.com From bwinton@tor.dhs.org Fri Aug 6 13:46:37 1999 From: bwinton@tor.dhs.org (Blake Winton) Date: Fri, 6 Aug 1999 08:46:37 -0400 (EDT) Subject: [Tutor] FW: Retrieving a text file with a URL call In-Reply-To: <01BEDF90.E5C796E0@ABD788D3.ipt.aol.com> from "Scotty Michael" at Aug 05, 1999 10:21:42 PM Message-ID: <199908061246.IAA31388@tor.dhs.org> > We have recently experienced the need to pull down text files created > with a URL call over the Internet and save them to a predetermined > location on the users hard drive. We have found that using DDE we can > complete this task with users that have NetScape; however, IE does not > support the parameter to specify where the file needs to be saved. Have you tried sending a Content-Type header? It would look like "Content-Type: inline;filename=pathtofile" (I'm not sure whether or not you can put a path in, but it's worth a try.) > Let me know if it sounds like python is the tool that I need to put > together a piece of code that could be distributed to our users and > called from their application to retrieve this file and save it to > their hard drive. Odd that you would mention this. I've hacked up a couple of scripts that do pretty much exactly that. The relevant parts are: #!/usr/bin/python # Set up the proxy server for Sympatico. # (They don't let us out on port 80). import os os.environ['http_proxy']="http://choco.bellglobal.com:80/" import urllib # Gets an arbitrary url. I forget why I did this... def geturl( url ): session = urllib.urlopen( url ) return session # Get objects for the two files. urlfile = geturl( "http://tor.dhs.org/~bwinton/urls" ) localfile = open( "whateverfilenameyouwant.txt", "w" ) for line in urlfile.readlines(): localfile.write( line ) # I think this whole for loop could also be written as # localfile.write( urlfile.read() ) Hope this helped, Blake. From arcege@shore.net Fri Aug 6 13:36:57 1999 From: arcege@shore.net (Michael P. Reilly) Date: Fri, 6 Aug 1999 08:36:57 -0400 (EDT) Subject: [Tutor] FW: Retrieving a text file with a URL call In-Reply-To: <01BEDF90.E5C796E0@ABD788D3.ipt.aol.com> from Scotty Michael at "Aug 5, 99 10:21:42 pm" Message-ID: <199908061236.IAA01385@northshore.shore.net> > I apologize for how totally ignorant I am with respect to your product. I > am an Xbase developer of a distributed business management application > written using Foxpro for Windows. > > We have recently experienced the need to pull down text files created with > a URL call over the Internet and save them to a predetermined location on > the users hard drive. We have found that using DDE we can complete this > task with users that have NetScape; however, IE does not support the > parameter to specify where the file needs to be saved. > > I do a lot of work with NeoMedia and they suggested that Python could > address our problems. > > Let me know if it sounds like python is the tool that I need to put > together a piece of code that could be distributed to our users and called > from their application to retrieve this file and save it to their hard > drive. There is a nice standard module for this called "urllib". def download_url(url, pathname): from urllib import urlopen infile = urlopen(url) outfile = open(pathname, 'w') while 1: line = infile.readline() if not line: break; outfile.write(line) outfile.close You will probably want to check the "headers" attribute of the url object returned from urlopen to make sure that it _is_ a text file that you are retrieving. You can get more info from: http://www.python.org/doc/current/lib/internet.html -Arcege -- ------------------------------------------------------------------------ | Michael P. Reilly, Release Engineer | Email: arcege@shore.net | | Salem, Mass. USA 01970 | | ------------------------------------------------------------------------ From alan.gauld@bt.com Fri Aug 6 15:02:25 1999 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Fri, 6 Aug 1999 15:02:25 +0100 Subject: [Tutor] FW: Retrieving a text file with a URL call Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB24E0AC2@mbtlipnt02.btlabs.bt.co.uk> > the users hard drive. We have found that using DDE we can > complete this > task with users that have NetScape; however, IE does not support the > parameter to specify where the file needs to be saved. > Aargh! Using DDE for that is a poor way forward. Its slow, unreliable and very fragile in the face of changes to Netscape. A much better approach is to simply use a socket interface (or prebuilt HTTP one and suck the raw HTML back from the server, parse and format it up yourself(using an html component) and save as a file. This will typically be 4-5 times faster than the DDE route and less liable to damage if Netscape changes. You can do this in VB, Delphi, Perl or, of course, Python. They all support components which can help you do that. If you know C then you can do it from scratch using straight sockets too. Alan G. From stalnaker@acm.org Fri Aug 6 17:49:35 1999 From: stalnaker@acm.org (Max M. Stalnaker) Date: Fri, 06 Aug 1999 09:49:35 -0700 Subject: [Tutor] RE: retrieving a text file from a url References: <199908060508.BAA00864@python.org> Message-ID: <37AB121F.A4FC2E0D@acm.org> While python can retrieve a text file nicely, and there is some support for single-file executables, (see freeze and also the cgipython project), it is possible you will not like this approach since you may need to have an executable for each processor family/os combination. This may be a problem with other parts of your company. You may want to look at the doc on embedding python in another language, for instance, C. > Subject: [Tutor] FW: Retrieving a text file with a URL call > Date: Thu, 5 Aug 1999 22:21:42 -0400 > From: Scotty Michael > To: "'tutor@python.org'" > > I apologize for how totally ignorant I am with respect to your product. I > am an Xbase developer of a distributed business management application > written using Foxpro for Windows. > > We have recently experienced the need to pull down text files created with > a URL call over the Internet and save them to a predetermined location on > the users hard drive. We have found that using DDE we can complete this > task with users that have NetScape; however, IE does not support the > parameter to specify where the file needs to be saved. > > I do a lot of work with NeoMedia and they suggested that Python could > address our problems. > > Let me know if it sounds like python is the tool that I need to put > together a piece of code that could be distributed to our users and called > from their application to retrieve this file and save it to their hard > drive. > > Thanks > > Scott Michael > scott@endall.com > > ------------------------------------------------------------------------ > _______________________________________________ > Tutor maillist - Tutor@python.org > http://www.python.org/mailman/listinfo/tutor From stormavik@radikal.net Sat Aug 7 16:25:15 1999 From: stormavik@radikal.net (Stormavik) Date: Sat, 7 Aug 1999 17:25:15 +0200 Subject: [Tutor] (no subject) Message-ID: <000701bee0e9$0d0cd860$928a4382@nidaros1> This is a multi-part message in MIME format. ------=_NextPart_000_0004_01BEE0F9.D03279C0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable hi i want to know what i can programm in Python and could i use it on = win98 ------=_NextPart_000_0004_01BEE0F9.D03279C0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
hi i want to know what i can = programm in Python=20 and could i use it on win98
------=_NextPart_000_0004_01BEE0F9.D03279C0-- From ivanlan@callware.com Sat Aug 7 16:45:18 1999 From: ivanlan@callware.com (Ivan Van Laningham) Date: Sat, 07 Aug 1999 09:45:18 -0600 Subject: [Tutor] (no subject) References: <000701bee0e9$0d0cd860$928a4382@nidaros1> Message-ID: <37AC548E.CD171B89@callware.com> Hi All-- Stormavik wrote: > > hi i want to know what i can programm in Python and could i use it on win98 > Yes, and yes. Anyone can program anythin in Python, and if you have Win98 you can simply download it from http://www.python.org (click on "Downloads" and follow the instructions there) and install it. That means that once you download it to your hard drive, you must double-click on the python1.5.2.exe file. It will install itself on your computer. Answer "yes" to all the questions. It's free, so your only investment is your learning time. Once you install it, use your web browser to visit the tutorial at http://www.python.org ("Tutorial"), and open a DOS box. cd to the place where you installed python: this should be "c:\Program Files\Python", so you would type 'cd "c:\Program Files\Python" into your DOS box. Then type 'python', and start reading the tutorial. Do what it says. Once you've done the tutorial, you should have a better idea of what you might want to program. But we can't tell you what to program, because we have no idea what your interests are. If you have trouble, send more questions to this mailing list. -ly y'rs, Ivan;-) ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan@callware.com ivanlan@home.com http://www.pauahtun.org See also: http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 ---------------------------------------------- From deirdre@deirdre.net Sat Aug 7 21:11:06 1999 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Sat, 7 Aug 1999 13:11:06 -0700 (PDT) Subject: [Tutor] (no subject) In-Reply-To: <000701bee0e9$0d0cd860$928a4382@nidaros1> Message-ID: On Sat, 7 Aug 1999, Stormavik wrote: > hi i want to know what i can programm in Python and could i use it on win98 Python is a fully-featured programming language suitable for programming most anything (a few exceptions, like every language). I know it runs on Windows though I don't use it on Windows myself. I just finished the .01 version of MagiKnit, knitwear design software, which was written entirely in Python. http://www.magiknit.org (thanks to David Ascher for the help too!) -- _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net From JBCourt007@aol.com Tue Aug 10 15:39:28 1999 From: JBCourt007@aol.com (JBCourt007@aol.com) Date: Tue, 10 Aug 1999 10:39:28 EDT Subject: [Tutor] (no subject) Message-ID: Hi my name is John, Recently I have download Python 1.5. I read through the tutorial and need alittle bit of help understanding and learning the commands. If anyone is willing to help me learn the program I will be more than grateful and please E-mail me at John. Thank you From da@ski.org Tue Aug 10 20:55:20 1999 From: da@ski.org (David Ascher) Date: Tue, 10 Aug 1999 12:55:20 -0700 (Pacific Daylight Time) Subject: [Tutor] Accessing C library (".a") functions from Python? In-Reply-To: <3.0.6.32.19990728193800.007c79b0@mail.in-gen.net> Message-ID: On Wed, 28 Jul 1999 sessile@in-gen.net wrote: > I have read the Extending and Embedding Tutorial, but still > don't see how to get started. I take it that I'm missing Did you get any advice? --david From sifl-olly@usa.net Wed Aug 11 02:34:39 1999 From: sifl-olly@usa.net (webby armstrong) Date: 10 Aug 99 21:34:39 EDT Subject: [Tutor] help? Message-ID: <19990811013439.10190.qmail@nwcst277.netaddress.usa.net> hello there, I would like to start learning computer programming and understand that python is the easiest to start with. I have downloaded python 1.5.2 , but I cannot figue how to get going or to install it (if nessasary) I am using windows 98 for the time being. when I try to run a program like Deirdre kniting thing, and not thing came up accept a winzip box say that the file cannot be unzipped? am I too far ahead of myself, (or besides it for that matter)? the last time I ever written any kind of program was about 15 years ago on a commadore 64 (I was ten then) Jymbo From da@ski.org Thu Aug 12 04:17:19 1999 From: da@ski.org (David Ascher) Date: Wed, 11 Aug 1999 20:17:19 -0700 (Pacific Daylight Time) Subject: [Tutor] Accessing C library (".a") functions from Python? In-Reply-To: <3.0.6.32.19990811232131.007aaa80@mail.in-gen.net> Message-ID: On Wed, 11 Aug 1999 sessile@in-gen.net wrote: > No. Your response is the first that I have received. > Guess I'm just opening a big 'ol can of worms here... > but I still haven't managed to solve the problem(s) > on my own. Drat. It's not a can of worms as much as a big hairy worm. It's also not very specific to Python. Can you make your problem a little more concrete? Let's start with: 1) describing a single function you want to call. What matters here is the so-called signature -- what is the name, what are the arguments, and how the function does input and output processing. 2) the platform -- from your mention of a .a, I assume a Unix of some kind. Which one? --david From deirdre@deirdre.net Fri Aug 13 23:03:28 1999 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Fri, 13 Aug 1999 15:03:28 -0700 (PDT) Subject: [Tutor] help? In-Reply-To: <19990811013439.10190.qmail@nwcst277.netaddress.usa.net> Message-ID: You know, this message made my whole day. :) There's several standard compression programs. On unix, they tend to end with .tar.gz or .tgz. For Windows, it ends in .exe or .zip, for Macintosh, .sit is the ending. You may have downloaded the Python 1.52 for Unix rather than the Windows version? See: http://www.python.org/download/download_windows.html I'd be happy to put up a .zip version of the current stuff I'm working on up on www.magiknit.org -- however I hadn't yet! I do have a more recent version to put up too. On 10 Aug 1999, webby armstrong wrote: > I would like to start learning computer programming > and understand that python is the easiest to start with. > I have downloaded python 1.5.2 , but I cannot figue how > to get going or to install it (if nessasary) I am using > windows 98 for the time being. when I try to run a > program like Deirdre kniting thing, and not thing came up > accept a winzip box say that the file cannot be unzipped? > am I too far ahead of myself, (or besides it for that matter)? > the last time I ever written any kind of program was about > 15 years ago on a commadore 64 (I was ten then) -- _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net Indeed, when I design my killer language, the identifiers "foo" and "bar" will be reserved words, never used, and not even mentioned in the reference manual. Any program using one will simply dump core without comment. Multitudes will rejoice. -- Tim Peters From stephen@webadmins.com Sat Aug 14 08:14:17 1999 From: stephen@webadmins.com (Stephen) Date: Sat, 14 Aug 1999 03:14:17 -0400 (EDT) Subject: [Tutor] help? In-Reply-To: Message-ID: What is this list for anyway? It hasn't budged since I've been here ;) /***************************************************************\ * Stephen ("xinu") Klassen -- Unix Systems Administrator * * Website: http://stephen.webadmins.com/ UIN: 19224641 (wk) * \***************************************************************/ On Fri, 13 Aug 1999, Deirdre Saoirse wrote: > You know, this message made my whole day. :) > > There's several standard compression programs. On unix, they tend to end > with .tar.gz or .tgz. For Windows, it ends in .exe or .zip, for Macintosh, > .sit is the ending. > > You may have downloaded the Python 1.52 for Unix rather than the Windows > version? See: http://www.python.org/download/download_windows.html > > I'd be happy to put up a .zip version of the current stuff I'm working on > up on www.magiknit.org -- however I hadn't yet! I do have a more recent > version to put up too. > > On 10 Aug 1999, webby armstrong wrote: [snipped for brevity] > From DOUGS@oceanic.com Sat Aug 14 10:07:34 1999 From: DOUGS@oceanic.com (Doug Stanfield) Date: Fri, 13 Aug 1999 23:07:34 -1000 Subject: [Tutor] help? Message-ID: <5650A1190E4FD111BC7E0000F8034D26A0EF77@huina.oceanic.com> From the home page, http://www.python.org : tutor@python.org: for folks who want to ask questions regarding how to learn computer programming with the Python language. But then you knew that... In the past it has generated some good exchanges. Go to http://www.python.org/pipermail/tutor/ to catch up. It is useful as a way to connect with those who can and are willing to get a beginner past a stuck point in learning or development of a program. Its also been helpful for me in lurk mode to get insights to Python concepts that hadn't sunk in; its like seeing an example done in class. It is primarily geared to those in learning mode, not production mode, where comp.lang.python tends to be more "professional programmer" discussion. The lack of traffic is symptomatic of poor marketing, newness, and other resouce availability. Stick around and ask a question if there's something you need to learn. -Doug- > -----Original Message----- > From: Stephen [mailto:stephen@webadmins.com] > Sent: Friday, August 13, 1999 9:14 PM > To: tutor@python.org > Subject: Re: [Tutor] help? > > > What is this list for anyway? It hasn't budged since I've been here ;) > > /***************************************************************\ > * Stephen ("xinu") Klassen -- Unix Systems Administrator * > * Website: http://stephen.webadmins.com/ UIN: 19224641 (wk) * > \***************************************************************/ > > On Fri, 13 Aug 1999, Deirdre Saoirse wrote: > > > You know, this message made my whole day. :) > > > > There's several standard compression programs. On unix, > they tend to end > > with .tar.gz or .tgz. For Windows, it ends in .exe or .zip, > for Macintosh, > > .sit is the ending. > > > > You may have downloaded the Python 1.52 for Unix rather > than the Windows > > version? See: http://www.python.org/download/download_windows.html > > > > I'd be happy to put up a .zip version of the current stuff > I'm working on > > up on www.magiknit.org -- however I hadn't yet! I do have a > more recent > > version to put up too. > > > > On 10 Aug 1999, webby armstrong wrote: > > [snipped for brevity] > > > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://www.python.org/mailman/listinfo/tutor > From jcosby@wolfenet.com Sat Aug 14 14:18:05 1999 From: jcosby@wolfenet.com (Jon Cosby) Date: Sat, 14 Aug 1999 06:18:05 -0700 Subject: [Tutor] Embedding Python scripts in web pages Message-ID: <000501bee657$8e591aa0$b3159fce@wolfenet.com> How do I embed a Python script on a web page? I'm trying to write an access counter, but can't even see how to print data to the page. Jon Cosby E-mail: jcosby@wolfenet.com Web Site: http://www.wolfenet.com/~jcosby/ From stephen@webadmins.com Sat Aug 14 20:39:59 1999 From: stephen@webadmins.com (Stephen) Date: Sat, 14 Aug 1999 15:39:59 -0400 (EDT) Subject: [Tutor] Embedding Python scripts in web pages In-Reply-To: <000501bee657$8e591aa0$b3159fce@wolfenet.com> Message-ID: Have you ever written a CGI before? (perl/python/shell?) The kind of advice you receive would depend on that. /***************************************************************\ * Stephen ("xinu") Klassen -- Unix Systems Administrator * * Website: http://stephen.webadmins.com/ UIN: 19224641 (wk) * \***************************************************************/ On Sat, 14 Aug 1999, Jon Cosby wrote: > How do I embed a Python script on a web page? I'm trying to write an access > counter, but can't even see how to print data to the page. > > Jon Cosby > > E-mail: jcosby@wolfenet.com > Web Site: http://www.wolfenet.com/~jcosby/ > > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://www.python.org/mailman/listinfo/tutor > From jcosby@wolfenet.com Sat Aug 14 21:17:42 1999 From: jcosby@wolfenet.com (Jon Cosby) Date: Sat, 14 Aug 1999 13:17:42 -0700 Subject: [Tutor] Embedding Python scripts in web pages References: Message-ID: <000a01bee692$117d7180$ca1c9fce@wolfenet.com> Yes, I have, I've written a search engine in Python. Jon Cosby Stephen Klassen wrote: > Have you ever written a CGI before? (perl/python/shell?) The kind of advice you > receive would depend on that. > > /***************************************************************\ > * Stephen ("xinu") Klassen -- Unix Systems Administrator * > * Website: http://stephen.webadmins.com/ UIN: 19224641 (wk) * > \***************************************************************/ > > On Sat, 14 Aug 1999, Jon Cosby wrote: > > > How do I embed a Python script on a web page? I'm trying to write an access > > counter, but can't even see how to print data to the page. > > > > Jon Cosby > > > > E-mail: jcosby@wolfenet.com > > Web Site: http://www.wolfenet.com/~jcosby/ > > > > > > > > _______________________________________________ > > Tutor maillist - Tutor@python.org > > http://www.python.org/mailman/listinfo/tutor > > > From andyquake@hotmail.com Sun Aug 15 05:23:55 1999 From: andyquake@hotmail.com (Andy Quake) Date: Sat, 14 Aug 1999 23:23:55 CDT Subject: [Tutor] books for python internet Message-ID: <19990815042356.28147.qmail@hotmail.com> i was wandering what book would yall recommend for ALL the details in python INTERNET programming.....i mean, a book that goes in to all the details on internet programming using python....and can you tell me where i can get this book, also... thanks, Andy _______________________________________________________________ Get Free Email and Do More On The Web. Visit http://www.msn.com From stephen@webadmins.com Sun Aug 15 06:52:19 1999 From: stephen@webadmins.com (Stephen) Date: Sun, 15 Aug 1999 01:52:19 -0400 (EDT) Subject: [Tutor] books for python internet In-Reply-To: <19990815042356.28147.qmail@hotmail.com> Message-ID: I second that. 'Programming Python' is definitely not it. It has ONE script for formmail that doesn't even work correctly at first glance. /***************************************************************\ * Stephen ("xinu") Klassen -- Unix Systems Administrator * * Website: http://stephen.webadmins.com/ UIN: 19224641 (wk) * \***************************************************************/ On Sat, 14 Aug 1999, Andy Quake wrote: > i was wandering what book would yall recommend for ALL the details in python > INTERNET programming.....i mean, a book that goes in to all the details on > internet programming using python....and can you tell me where i can get > this book, also... > thanks, > Andy > > > > _______________________________________________________________ > Get Free Email and Do More On The Web. Visit http://www.msn.com > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://www.python.org/mailman/listinfo/tutor > From deirdre@deirdre.net Sun Aug 15 07:56:18 1999 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Sat, 14 Aug 1999 23:56:18 -0700 (PDT) Subject: [Tutor] help? In-Reply-To: Message-ID: On Sat, 14 Aug 1999, Stephen wrote: > What is this list for anyway? It hasn't budged since I've been here ;) Bah, you just joined five minutes before I posted then had to razz me in private. :) -- _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net Indeed, when I design my killer language, the identifiers "foo" and "bar" will be reserved words, never used, and not even mentioned in the reference manual. Any program using one will simply dump core without comment. Multitudes will rejoice. -- Tim Peters From deirdre@deirdre.net Sun Aug 15 08:17:32 1999 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Sun, 15 Aug 1999 00:17:32 -0700 (PDT) Subject: [Tutor] books for python internet In-Reply-To: <19990815042356.28147.qmail@hotmail.com> Message-ID: On Sat, 14 Aug 1999, Andy Quake wrote: > i was wandering what book would yall recommend for ALL the details in python > INTERNET programming.....i mean, a book that goes in to all the details on > internet programming using python....and can you tell me where i can get > this book, also... There's always Aaron & Guido's book "Internet Programming With Python." -- _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net Indeed, when I design my killer language, the identifiers "foo" and "bar" will be reserved words, never used, and not even mentioned in the reference manual. Any program using one will simply dump core without comment. Multitudes will rejoice. -- Tim Peters From Moshe Zadka Sun Aug 15 08:38:09 1999 From: Moshe Zadka (Moshe Zadka) Date: Sun, 15 Aug 1999 10:38:09 +0300 (GMT+0300) Subject: [Tutor] books for python internet In-Reply-To: Message-ID: On Sun, 15 Aug 1999, Deirdre Saoirse wrote: > > i was wandering what book would yall recommend for ALL the details in python > > INTERNET programming.....i mean, a book that goes in to all the details on > > internet programming using python....and can you tell me where i can get > > this book, also... > > There's always Aaron & Guido's book "Internet Programming With Python." Well, being unemployed until recently, I always favoured the electronical to the dead tree for purely economic reasons. So, after wading through the tutorial, the best resource is your library reference. I'm never sure what people mean by "internet programmming". Socket programming is something which is very similar in Python and C, and so any relevant book will do, plus some documentation reading. CGI programming is well covered on the Python site, under topics/cgi -- I learned enough there to build my first CGI-based site in one day. HTTP client programming is usually done through httplib/urllib: POST fill-ups were never easier. In short, Python's web-site, and documentation area are quite enough, even for newbies. -- Moshe Zadka . I'm not anti-Microsoft -- Microsoft is anti-me (Anonymous Coward on /.) From stephen@webadmins.com Mon Aug 16 06:04:31 1999 From: stephen@webadmins.com (Stephen) Date: Mon, 16 Aug 1999 01:04:31 -0400 (EDT) Subject: [Tutor] help? In-Reply-To: Message-ID: Always... always... Never needed to join a list for programming before. /***************************************************************\ * Stephen ("xinu") Klassen -- Unix Systems Administrator * * Website: http://stephen.webadmins.com/ UIN: 19224641 (wk) * \***************************************************************/ On Sat, 14 Aug 1999, Deirdre Saoirse wrote: > On Sat, 14 Aug 1999, Stephen wrote: > > > What is this list for anyway? It hasn't budged since I've been here ;) > > Bah, you just joined five minutes before I posted then had to razz me in > private. :) > > -- > _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net > Indeed, when I design my killer language, the identifiers "foo" and "bar" > will be reserved words, never used, and not even mentioned in the > reference manual. Any program using one will simply dump core without > comment. Multitudes will rejoice. -- Tim Peters > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://www.python.org/mailman/listinfo/tutor > From alan.gauld@bt.com Tue Aug 17 11:22:51 1999 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 17 Aug 1999 11:22:51 +0100 Subject: [Tutor] (no subject) Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF5D91@mbtlipnt02.btlabs.bt.co.uk> > simply download it from http://www.python.org (click on > "Downloads" and > follow the instructions there) and install it. That means > Once you install it, use your web browser to visit the tutorial at > http://www.python.org ("Tutorial"), and open a DOS box. cd to the > place where you installed python: this should be "c:\Program > Files\Python", so you would type 'cd "c:\Program > Files\Python" into your > DOS box. Then type 'python', and start reading the tutorial. Do what > it says. You shouldn't need to do that, Python should be placed in the PATH by the install. Certainly I just type python from anywhere (usually from my E:\projects\xxx heirarchy :) Alan g. From alan.gauld@bt.com Tue Aug 17 13:32:54 1999 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 17 Aug 1999 13:32:54 +0100 Subject: [Tutor] books for python internet Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF5D93@mbtlipnt02.btlabs.bt.co.uk> > INTERNET programming.....i mean, a book that goes in to all > the details on internet programming using python.... 'Internet Programming with Python' by Guido VR(the language inventor) and others. Its OK but not wholly successful IMHO. What exactly do you mean by Internet programming? Web, socket ipc, ftp, gopher, mail, etc etc... There is no book on the planet that explains how to program all aspects of the net. Steven's 2 volumes on Unix network programming probably come closest but they are all in C. > and can you tell me where i can get > this book As ever amazon.com or most other online bookstores. In fact I think you can order it from the Python web site too... Alan G. From alan.gauld@bt.com Tue Aug 17 13:35:30 1999 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 17 Aug 1999 13:35:30 +0100 Subject: [Tutor] Embedding Python scripts in web pages Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF5D94@mbtlipnt02.btlabs.bt.co.uk> > Yes, I have, I've written a search engine in Python. > > > How do I embed a Python script on a web page? I'm trying > to write an access counter, but can't even see how to print data to the page. So what exactly is the problem? How did you display the search results? Presumably by writing HTML... Do the same for the counter, possibly jazzing it up with a table and some fancy text affects. Store the count value in a file somewhere. Alan G. From 915602@candseek.com Tue Aug 17 17:10:59 1999 From: 915602@candseek.com (915602@candseek.com) Date: Tue, 17 Aug 1999 12:10:59 -0400 (EDT) Subject: [Tutor] JOBOP Java Developer Message-ID: <199908171610.MAA01175@python.org> Since your email address was listed on a related web site page or database, I thought you might help. I am seeking an individual within the following conditions: I represent a fast growing, venture backed Java product company in New York. Currently, they are looking for a Java programmer to assist in the development of their Internet software products. In this role, an individual will work with an internal development team and with clients to customize the software. The ideal candidate will have at least 3 years of experience with Object Oriented programming and at least 1 year of Java. The individual must also be experienced with Solaris, NT, Netscape, Oracle, or other RDBMS. For the right person, the salary can go as high as $110,000 with a generous bonus plan and benefits package. Geographic Location of Position: New York If you know anyone that might be interested, please forward this to them or contact: Megan McCullough Diedre Moire Corporation Voice: 609-584-9000 ext 275 Fax: 609-584-9575 Email: 915602@candseek.com To permanently discontinue receiving employment opportunity notices from any and all help wanted advertisers using the Candidate Seeker system, click your "Reply" button and type the word "re- move" without spaces between the letters into the SUBJECT field then click the "Send" button. Your email address will be permanently filtered from ALL future job opportunity notifications sent via the Candidate Seeker system. To temporarily filter employment opportunity notices sent via the Candidate Seeker system, type the acronym "JOBOP" into your subject filter. All employment opportunity notices sent via the Candidate Seeker system contain the acronym "JOBOP" in the subject so they may be easily filtered or blocked if so desired. Other email addresses may be permanently deleted from future contact by emailing a single blank message from the desired address to nomail@candseek.com. Enter additional addresses into the body of the message and they will also be added to the "nomail" list Please feel free to contact the candidateseeker.com feedback line at 609-584-5499. Do not use this number for job related questions. All job related questions should be directed to the employer by replying to contact addresses or phone numbers indicated at the end of the job description message. From teroc@zianet.com Tue Aug 17 18:28:41 1999 From: teroc@zianet.com (K P) Date: Tue, 17 Aug 1999 12:28:41 -0500 Subject: [Tutor] ping a ping ping ping Message-ID: <18534514085487@zianet.com> could anyone give me some suggsetions how to code a ping utility in Python? Maybe direct me to the RFC on ping? My knowledge of it is minimal and I thought this would be a fun project. Ken From rayr@cats.ucsc.edu Tue Aug 17 21:08:05 1999 From: rayr@cats.ucsc.edu (Raymund Ramos) Date: Tue, 17 Aug 1999 13:08:05 -0700 (PDT) Subject: [Tutor] looking for vacation utility Message-ID: Hello. I am looking for a vacation utility. Something that will send "I am on vacation" messages to mailsenders but is smart enough to identify mailing list messages. If there isn't anything like that out there, how do you use the Mailbox class? -ray From deirdre@deirdre.net Tue Aug 17 21:04:51 1999 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Tue, 17 Aug 1999 13:04:51 -0700 (PDT) Subject: [Tutor] looking for vacation utility In-Reply-To: Message-ID: On Tue, 17 Aug 1999, Raymund Ramos wrote: > I am looking for a vacation utility. > Something that will send "I am on vacation" messages to > mailsenders but is smart enough to identify mailing list > messages. It's called "vacation" on Unix systems. I don't think it has been implemented in Python (yet). -- _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net "I must say that I was really happy to see _Linux for Dummies_ -- that's when you know you've arrived." -- Linus Torvalds From stephen@webadmins.com Wed Aug 18 03:52:57 1999 From: stephen@webadmins.com (Stephen) Date: Tue, 17 Aug 1999 22:52:57 -0400 (EDT) Subject: [Tutor] looking for vacation utility In-Reply-To: Message-ID: Procmail recipies can be pretty elaborate... but at the very least they'll handle that: http://www.voicenet.com/~dfma/intro.html /***************************************************************\ * Stephen ("xinu") Klassen -- Unix Systems Administrator * * Website: http://stephen.webadmins.com/ UIN: 19224641 (wk) * \***************************************************************/ On Tue, 17 Aug 1999, Deirdre Saoirse wrote: > On Tue, 17 Aug 1999, Raymund Ramos wrote: > > > I am looking for a vacation utility. > > Something that will send "I am on vacation" messages to > > mailsenders but is smart enough to identify mailing list > > messages. > > It's called "vacation" on Unix systems. I don't think it has been > implemented in Python (yet). > > -- > _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net > "I must say that I was really happy to see _Linux for Dummies_ -- that's > when you know you've arrived." -- Linus Torvalds > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://www.python.org/mailman/listinfo/tutor > From DOUGS@oceanic.com Wed Aug 18 09:20:56 1999 From: DOUGS@oceanic.com (Doug Stanfield) Date: Tue, 17 Aug 1999 22:20:56 -1000 Subject: [Tutor] ping a ping ping ping Message-ID: <5650A1190E4FD111BC7E0000F8034D26A0EF87@huina.oceanic.com> Jeremy Hylton has written one, available at: http://the-tech.mit.edu/~jeremy/python/ -Doug- > -----Original Message----- > From: K P [mailto:teroc@zianet.com] > Sent: Tuesday, August 17, 1999 7:29 AM > To: tutor@python.org > Subject: [Tutor] ping a ping ping ping > > > could anyone give me some suggsetions how to code a ping utility > in Python? Maybe direct me to the RFC on ping? My knowledge of > it is minimal and I thought this would be a fun project. > Ken > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://www.python.org/mailman/listinfo/tutor > From strat_addict@yahoo.com Thu Aug 19 01:42:07 1999 From: strat_addict@yahoo.com (G. Norton) Date: Wed, 18 Aug 1999 17:42:07 -0700 (PDT) Subject: [Tutor] Installation and "PATH?" Message-ID: <19990819004207.26269.rocketmail@web1405.mail.yahoo.com> I am new to programming and have seen similar questions to mine on the board but I'm still confused and could use a little help.Here goes: I downloaded Python1.5,installed it and everything seemed fineconsidering I didn't know what the heck I was doing.When I installedPython I already had Tcl/Tk 8.0 loaded so I didn't load the programfrom Python.I then downloaded Winall32 and everything fell into place.Using PythonWin, I was doing simple programming and felt that I was onright track(yea..I'm rambling)The question is, "Am I missing something by just using PythonWin?"When I go to the file, there is: Python(command line) and IDLE (Python GUI) The "IDLE" won't open.I open the command line and a DOS type screen opens.I put in a few 2+2 commands and get the answers but when I try to open the other screen through the DOS--MADNESS ENSUES!.After many four-letter words,countless preformances of "Illegal Operations" and novice troubleshooting,it tells me that Tcl/Tk was not installed properly.I tried uninstalling Tcl/Tk and Python and reinstalled Python with the Tcl/Tk that came with it.Nothing!.Is this due to it not being in my "path".I am totally in the dark on this andif the path is the problem, I definitely need my hand held through this procedure. Any help would be greatly appreciated, The strat_addict _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com From infody@earthlink.net Thu Aug 19 02:42:06 1999 From: infody@earthlink.net (Dempsey) Date: Wed, 18 Aug 1999 21:42:06 -0400 Subject: [Tutor] Help with the code for an exercise in, "Instant Hacking" Message-ID: <000001bee9e4$0b722d80$b40c2526@p400> This is a multi-part message in MIME format. ------=_NextPart_000_0001_01BEE9C2.84608D80 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit The following exercise is found in the, "Instant Hacking". I'm having trouble visualizing this exercise shown below. Could someone show me what the code would look like? Thanks, Bob infody@earthlink.net -------------------------------------------------- --------------- Exercise 2 Write a function that implements Euklid's method for finding a common factor of two numbers. It works like this: You have two numbers, a and b, where a is larger than b You repeat the following until b becomes zero: a is changed to the value of b b is changed to the remainder when a (before the change) is divided by b (before the change) You then return the last value of a Hints: * Use a and b as parameters to the function * Simply assume that a is greater than b * The remainder when x is divided by z is calculated by the expression x % z * Two variables can be assigned to simultaneously like this: x, y = y, y+1. Here x is given the value of y (that is, the value y had before the assignment) and y is incremented by one ------=_NextPart_000_0001_01BEE9C2.84608D80 Content-Type: application/ms-tnef; name="winmail.dat" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="winmail.dat" eJ8+IgYBAQaQCAAEAAAAAAABAAEAAQeQBgAIAAAA5AQAAAAAAADoAAEIgAcAGAAAAElQTS5NaWNy b3NvZnQgTWFpbC5Ob3RlADEIAQ2ABAACAAAAAgACAAEGgAMADgAAAM8HCAASABUAKgAAAAMAMgEB A5AGAFwIAAAnAAAACwACAAEAAAALACMAAAAAAAMAJgAAAAAACwApAAAAAAADADYAAAAAAB4AcAAB AAAAOQAAAEhlbHAgd2l0aCB0aGUgY29kZSBmb3IgYW4gZXhlcmNpc2UgaW4sICJJbnN0YW50IEhh Y2tpbmciAAAAAAIBcQABAAAAFgAAAAG+6eQJJoxqYfFVtRHTklAAYGcId/sAAAIBHQwBAAAAGgAA AFNNVFA6SU5GT0RZQEVBUlRITElOSy5ORVQAAAALAAEOAAAAAEAABg4A5HYH5Om+AQIBCg4BAAAA GAAAAAAAAABLBL3y5VHSEZJNAGBnCHf7woAAAAsAHw4BAAAAAwAGEFAQ6h0DAAcQNAMAAB4ACBAB AAAAZQAAAFRIRUZPTExPV0lOR0VYRVJDSVNFSVNGT1VORElOVEhFLCJJTlNUQU5USEFDS0lORyJJ TUhBVklOR1RST1VCTEVWSVNVQUxJWklOR1RISVNFWEVSQ0lTRVNIT1dOQkVMT1dDT1UAAAAAAgEJ EAEAAADgAwAA3AMAANMGAABMWkZ186UWxgMACgByY3BnMTI1FjIA+Atgbg4QMDMz/QH3IAKkA2QH bQKDAFAD1X8IVQeyAoMOUAPVBxMCgzMTA8UCAGNoCsBzZXTaMBQ5NALjFWcyBgAGw2UCgH0KgXVj AFALA3V0bG4CIGUMIQEwENBodGUgAhBsCQAD8A8gIPRleASQYwQAGfAEABoBWHVuZBswA6B0GeAs OCAiSQCAAZACMCBI5QDQaxpxIi4KogqECoBQSSdtIBWQdhpydJ0DYHUCYBnwHpBzdQdANGl6HqNo G0Eat3NokxpQA6BiZRpBLiASompsG7BzA3BlGUEg8yC5B4AgdxWQBUAcASAFoE8BACMwIfMJAG9r JHBpOGtlPx16GdAAcGtz8iwdekJvDDAdgwuAAhDwZHlAZQrAHAAfsCYQ6i4ZUHQddC0pTypfK2/b LEsdekUaxg5QYgFAHYNqVwUQdBnwYRoAG5BjfHRpAiAb8SNhB3ALUGVHB4ACMAQgRXVrH7BkficE IAeAHAAEcBoBBcBm3QuAZBpyL6AFoG0EYAOgymYA0HQFsW9mG/AkIFggbnUG0ASQcyGwSbsFQCQg ciYgJMMgEzoK48cKhAswMpAtMzYBQB+w+QHBIFkIYB5iNdE0WBww9y+gAHAbsGIcMCNABJAvgvMb QQtgcmcTATBRIUE2Rfs34glwcCgQI3QaGBuQMABfAyA7QCFgMzEHkXoEkG/jNj83RDE0NAFADNBA An86JBWBDyAJgBvwNGAjknb/B0AKUDQCO0Y7QEDvO/EAwN8yoRMBOdEDoC+gKCFgMlH3NdIjsUEj KRsyMsAekAEA/TmBeTsxRW9GcT6/N2ocAfsDoAlwdAhwG+M6cRyAQfi3L6BI6jtASAuAMSA6LrH3 IcBI6RARcAIwGrAo0BahbicBsAyCApEqTxFPEWz8dmwCYCjRJ7AWsE8gRJL/AjA3QU8DT2AMME/B GDBJnL5VGxE5RS+QBCAKsWEx4b80wUGGL8cddE8PUBFTMKL/R2BLwB+AIxEwUzozCcEjYP86zlcP UBEZ0gxAREgMQE4R10TzEgQ3sXgLpTQhwEas1V33el6bYwdAYxkQWfH3RzMjkhqwcAlwBBBWY14H /CAlYJpav1vINFFCAAchzx8hYWIhQliiaWcZUEFznQCQbRkQHJEicHVzWIFvNapeBxwwR2A9atBq wSt3EiFetSGwSDnyXf9fBGevRuBFEUHLbId5XpgoMFT/ORFByG8vXwEVkDmBR8hnxP8w8kaAOWJx r18EC4AFADDj/0ckIoJI6xOyDAFI+hTgHYMFGEEAeiADABAQAAAAAAMAERAAAAAACwAAgAggBgAA AAAAwAAAAAAAAEYAAAAAA4UAAAAAAAADAAKACCAGAAAAAADAAAAAAAAARgAAAAAQhQAAAAAAAAMA BYAIIAYAAAAAAMAAAAAAAABGAAAAAFKFAADwEwAAHgAlgAggBgAAAAAAwAAAAAAAAEYAAAAAVIUA AAEAAAAEAAAAOC41AAMAJoAIIAYAAAAAAMAAAAAAAABGAAAAAAGFAAAAAAAACwAvgAggBgAAAAAA wAAAAAAAAEYAAAAADoUAAAAAAAADADCACCAGAAAAAADAAAAAAAAARgAAAAARhQAAAAAAAAMAMoAI IAYAAAAAAMAAAAAAAABGAAAAABiFAAAAAAAAHgBBgAggBgAAAAAAwAAAAAAAAEYAAAAANoUAAAEA AAABAAAAAAAAAB4AQoAIIAYAAAAAAMAAAAAAAABGAAAAADeFAAABAAAAAQAAAAAAAAAeAEOACCAG AAAAAADAAAAAAAAARgAAAAA4hQAAAQAAAAEAAAAAAAAACwDGgAsgBgAAAAAAwAAAAAAAAEYAAAAA AIgAAAAAAAALAMiACyAGAAAAAADAAAAAAAAARgAAAAAFiAAAAAAAAAsA1YAIIAYAAAAAAMAAAAAA AABGAAAAAAaFAAAAAAAACwDZgAggBgAAAAAAwAAAAAAAAEYAAAAAgoUAAAEAAAACAfgPAQAAABAA AABLBL3y5VHSEZJNAGBnCHf7AgH6DwEAAAAQAAAASwS98uVR0hGSTQBgZwh3+wIB+w8BAAAASAAA AAAAAAA4obsQBeUQGqG7CAArKlbCAABQU1RQUlguRExMAAAAAAAAAABOSVRB+b+4AQCqADfZbgAA AEU6XG91dGxvb2sucHN0AAMA/g8FAAAAAwANNP03AAACAX8AAQAAADEAAAAwMDAwMDAwMDRCMDRC REYyRTU1MUQyMTE5MjREMDA2MDY3MDg3N0ZCQzRCMTI0MDAAAAAAufQ= ------=_NextPart_000_0001_01BEE9C2.84608D80-- From stalnaker@acm.org Thu Aug 19 07:26:00 1999 From: stalnaker@acm.org (Max M. Stalnaker) Date: Wed, 18 Aug 1999 23:26:00 -0700 Subject: [Tutor] Re: help for code from instant hacking References: <199908190506.BAA14102@python.org> Message-ID: <37BBA377.71ECAD26@acm.org> I would guess the reason it is hard to visualize is that it involves *recursion* def func(a,b): #manipulations of a,b if b=0 return a else return func(a,b) print func(a,b) I believe this is called tail-recursion, a special case of recursion. Recursion pushes successive execution frames onto a stack. Eventually it completes. At that time it returns a. The value of the a migrates up the stack and eventually is printed. All the stack stuff is handled by the language transparently, but if you need to visualize what is happening, I think you need to visual the execution frames on the stack. Feel free to draw pictures of the execution frames. These hold the state of one level of recursion of func(a,b). tutor-admin@python.org wrote: > Subject: [Tutor] Help with the code for an exercise in, "Instant Hacking" > Date: Wed, 18 Aug 1999 21:42:06 -0400 > From: "Dempsey" > To: > > The following exercise is found in the, "Instant > Hacking". > > I'm having trouble visualizing this exercise shown > below. Could someone show me what the code would > look like? > > Thanks, > > Bob > infody@earthlink.net > -------------------------------------------------- > --------------- > > Exercise 2 > Write a function that implements Euklid's method > for finding a common factor of two numbers. It > works like this: > You have two numbers, a and b, where a is larger > than b > You repeat the following until b becomes zero: > a is changed to the value of b > b is changed to the remainder when a (before the > change) is divided by b (before the change) > You then return the last value of a > Hints: > * Use a and b as parameters to the function > * Simply assume that a is greater than b > * The remainder when x is divided by z is > calculated by the expression x % z > * Two variables can be assigned to simultaneously > like this: x, y = y, y+1. Here x is given the > value of y (that is, the value y had before the > assignment) and y is incremented by one > > ------------------------------------------------------------------------ > Name: winmail.dat > winmail.dat Type: application/ms-tnef > Encoding: base64 > > ------------------------------------------------------------------------ > _______________________________________________ > Tutor maillist - Tutor@python.org > http://www.python.org/mailman/listinfo/tutor -- Max M. Stalnaker mailto:stalnaker@acm.org http://www.astarcc.com 253-565-2366 fax 253-565-0892 From deirdre@deirdre.net Fri Aug 20 22:19:18 1999 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Fri, 20 Aug 1999 14:19:18 -0700 (PDT) Subject: [Tutor] Re: Python question (when you have a free moment) (fwd) Message-ID: A friend of mine, a molecular biologist, has a problem. He has a file, approximately 1.5mb, that has a bunch of returns in it (which interfere with his ability to perform raw searches). I suggested that, instead of using regex.gsub after thwapping the file into memory that he try: #!/usr/local/bin/python input = open('~/yeast/chromosome04', 'r') lines = 0 S = '' while 1: s = input.readline() if s: S = S + s[:-1] lines = lines + 1 else: break (Which eliminates the need for a regex) ...but that, per him, didn't speed up significantly over his first approach. Any ideas? -- _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net "I must say that I was really happy to see _Linux for Dummies_ -- that's when you know you've arrived." -- Linus Torvalds ---------- Forwarded message ---------- Date: Fri, 20 Aug 1999 14:17:04 -0700 From: Bernard To: Deirdre Saoirse Subject: Re: Python question (when you have a free moment) 20Aug1999 12:18AM (-0700) From [deirdre@deirdre.net] deirdre [Deirdre] > Actually, with your permission, I'd like to pose the question to the Tutor > list -- they can come up with some amazing speed optimizations. Ok? Sure! I'd love to hear of anything that will speed things up. As I said, I'm reluctant to dump Python if I think there's a chance that it could be better. Just a quick reminder; 1.5 Mb of plain text 50 characters per line (so ca. 30,000 lines) I want it all in one continuous string In Perl: If I read one line at a time, chomp and concatenate it takes a total of about 6 minutes. If I read the entire file in one go and then perform a global substitution it all takes ca. 0.1 s In Python: If I read one line at a time, discard the last character and concatenate it takes a total of 4 minutes. If I read the entire file it takes only about 0.1 s but the regex.gsub takes 4 minutes. Timings are on a PII/350 on a vanilla Red Hat 5.2 box (Perl 5, Python 1.5 - I can give you the minor versions if you need them) So, I'm assuming the speed-up would be at the level of the regex.gsub Thanks for any tips, Bernard Bernard P. Murray, PhD nutella@zork.net (Department of Desserts and Toppings, San Francisco, USA) From da@ski.org Fri Aug 20 23:08:34 1999 From: da@ski.org (David Ascher) Date: Fri, 20 Aug 1999 15:08:34 -0700 (Pacific Daylight Time) Subject: [Tutor] Re: Python question (when you have a free moment) (fwd) In-Reply-To: Message-ID: On Fri, 20 Aug 1999, Deirdre Saoirse wrote: > A friend of mine, a molecular biologist, has a problem. He has a file, > approximately 1.5mb, that has a bunch of returns in it (which interfere > with his ability to perform raw searches). 1.5M isn't that big. Why not just: data = open('~/yeast/chromosome04', 'r').read() data = string.replace(data, '\r', '') This takes negligible time on my machine. --david From python-tutor@teleo.net Fri Aug 20 23:00:11 1999 From: python-tutor@teleo.net (Patrick Phalen) Date: Fri, 20 Aug 1999 15:00:11 -0700 Subject: [Tutor] Re: Python question (when you have a free moment) (fwd) References: Message-ID: <99082015103709.00619@quadra.teleo.net> How much RAM does he have? import string input = open('~/yeast/chromosome04', 'r') input = string.join(string.split(input, '\012')) # or \012\015 or whatever On Fri, 20 Aug 1999, Deirdre Saoirse wrote: > A friend of mine, a molecular biologist, has a problem. He has a file, > approximately 1.5mb, that has a bunch of returns in it (which interfere > with his ability to perform raw searches). > > I suggested that, instead of using regex.gsub after thwapping the file > into memory that he try: > > #!/usr/local/bin/python > > input = open('~/yeast/chromosome04', 'r') > lines = 0 > S = '' > while 1: > s = input.readline() > if s: > S = S + s[:-1] > lines = lines + 1 > else: > break > > (Which eliminates the need for a regex) > > ...but that, per him, didn't speed up significantly over his first > approach. Any ideas? > > -- > _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net > "I must say that I was really happy to see _Linux for Dummies_ -- that's > when you know you've arrived." -- Linus Torvalds > > ---------- Forwarded message ---------- > Date: Fri, 20 Aug 1999 14:17:04 -0700 > From: Bernard > To: Deirdre Saoirse > Subject: Re: Python question (when you have a free moment) > > 20Aug1999 12:18AM (-0700) From [deirdre@deirdre.net] deirdre [Deirdre] > > Actually, with your permission, I'd like to pose the question to the Tutor > > list -- they can come up with some amazing speed optimizations. Ok? > > Sure! I'd love to hear of anything that will speed things up. > As I said, I'm reluctant to dump Python if I think there's a > chance that it could be better. > Just a quick reminder; > > 1.5 Mb of plain text > 50 characters per line (so ca. 30,000 lines) > I want it all in one continuous string > > In Perl: If I read one line at a time, chomp and concatenate it takes > a total of about 6 minutes. If I read the entire file in one go and > then perform a global substitution it all takes ca. 0.1 s > > In Python: If I read one line at a time, discard the last character > and concatenate it takes a total of 4 minutes. If I read the entire > file it takes only about 0.1 s but the regex.gsub takes 4 minutes. > > Timings are on a PII/350 on a vanilla Red Hat 5.2 box (Perl 5, > Python 1.5 - I can give you the minor versions if you need them) > > So, I'm assuming the speed-up would be at the level of the regex.gsub > > Thanks for any tips, > Bernard > > Bernard P. Murray, PhD > nutella@zork.net (Department of Desserts and Toppings, San Francisco, USA) > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://www.python.org/mailman/listinfo/tutor From deirdre@deirdre.net Fri Aug 20 23:05:08 1999 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Fri, 20 Aug 1999 15:05:08 -0700 (PDT) Subject: [Tutor] Re: Python question (when you have a free moment) (fwd) In-Reply-To: Message-ID: On Fri, 20 Aug 1999, David Ascher wrote: > On Fri, 20 Aug 1999, Deirdre Saoirse wrote: > > > A friend of mine, a molecular biologist, has a problem. He has a file, > > approximately 1.5mb, that has a bunch of returns in it (which interfere > > with his ability to perform raw searches). > > 1.5M isn't that big. Well, that was where he was starting. :) > Why not just: > > data = open('~/yeast/chromosome04', 'r').read() > data = string.replace(data, '\r', '') > > This takes negligible time on my machine. Interesting! I'm always amazed by this list. :) (though what is replaced is somewhat OS-dependent; I believe he's running on Unix) -- _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net "I must say that I was really happy to see _Linux for Dummies_ -- that's when you know you've arrived." -- Linus Torvalds From python-tutor@teleo.net Fri Aug 20 23:19:45 1999 From: python-tutor@teleo.net (Patrick Phalen) Date: Fri, 20 Aug 1999 15:19:45 -0700 Subject: [Tutor] Re: Python question (when you have a free moment) (fwd) References: <99082015103709.00619@quadra.teleo.net> Message-ID: <9908201522460A.00619@quadra.teleo.net> duh. missed a step ... make that import string input = open('~/yeast/chromosome04', 'r') input = input.read() input = string.join(string.split(input, '\012')) # or to preserve white space between lines input = string.join(string.split(input, '\n'), ' ') On Fri, 20 Aug 1999, I wrote: > How much RAM does he have? > > import string > input = open('~/yeast/chromosome04', 'r') > input = string.join(string.split(input, '\012')) # or \012\015 or > whatever > > On Fri, 20 Aug 1999, Deirdre Saoirse wrote: > > A friend of mine, a molecular biologist, has a problem. He has a file, > > approximately 1.5mb, that has a bunch of returns in it (which interfere > > with his ability to perform raw searches). > > > > I suggested that, instead of using regex.gsub after thwapping the file > > into memory that he try: > > > > #!/usr/local/bin/python > > > > input = open('~/yeast/chromosome04', 'r') > > lines = 0 > > S = '' > > while 1: > > s = input.readline() > > if s: > > S = S + s[:-1] > > lines = lines + 1 > > else: > > break > > > > (Which eliminates the need for a regex) > > > > ...but that, per him, didn't speed up significantly over his first > > approach. Any ideas? > > > > -- > > _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net > > "I must say that I was really happy to see _Linux for Dummies_ -- that's > > when you know you've arrived." -- Linus Torvalds > > > > ---------- Forwarded message ---------- > > Date: Fri, 20 Aug 1999 14:17:04 -0700 > > From: Bernard > > To: Deirdre Saoirse > > Subject: Re: Python question (when you have a free moment) > > > > 20Aug1999 12:18AM (-0700) From [deirdre@deirdre.net] deirdre [Deirdre] > > > Actually, with your permission, I'd like to pose the question to the Tutor > > > list -- they can come up with some amazing speed optimizations. Ok? > > > > Sure! I'd love to hear of anything that will speed things up. > > As I said, I'm reluctant to dump Python if I think there's a > > chance that it could be better. > > Just a quick reminder; > > > > 1.5 Mb of plain text > > 50 characters per line (so ca. 30,000 lines) > > I want it all in one continuous string > > > > In Perl: If I read one line at a time, chomp and concatenate it takes > > a total of about 6 minutes. If I read the entire file in one go and > > then perform a global substitution it all takes ca. 0.1 s > > > > In Python: If I read one line at a time, discard the last character > > and concatenate it takes a total of 4 minutes. If I read the entire > > file it takes only about 0.1 s but the regex.gsub takes 4 minutes. > > > > Timings are on a PII/350 on a vanilla Red Hat 5.2 box (Perl 5, > > Python 1.5 - I can give you the minor versions if you need them) > > > > So, I'm assuming the speed-up would be at the level of the regex.gsub > > > > Thanks for any tips, > > Bernard > > > > Bernard P. Murray, PhD > > nutella@zork.net (Department of Desserts and Toppings, San Francisco, USA) > > > > > > _______________________________________________ > > Tutor maillist - Tutor@python.org > > http://www.python.org/mailman/listinfo/tutor > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://www.python.org/mailman/listinfo/tutor From bowman@montana.com Sat Aug 21 17:31:13 1999 From: bowman@montana.com (bowman) Date: Sat, 21 Aug 1999 10:31:13 -0600 Subject: [Tutor] re versus regex Message-ID: <37BED451.B90DB5B0@montana.com> Deirdre Saoirse wrote: > > I suggested that, instead of using regex.gsub after thwapping the file > into memory that he try: It is my impression that the newer 're' package was designed from scratch to get Python's performance up to par. I don't know if this implies speed, or just the expressiveness, but it might be interesting to see what effect in makes on this app. I'm fairly new to Python, so I haven't used the deprecated regex, since re was available when I started. -- Bear Technology Making Montana safe for Grizzlies http://people.montana.com/~bowman/ From seanconway@home.com Sun Aug 22 08:03:03 1999 From: seanconway@home.com (Sean Conway) Date: Sun, 22 Aug 1999 00:03:03 -0700 Subject: [Tutor] File object, r/w (simple) Message-ID: <001401beec6c$60cfb240$0528a8c0@home> Hello everyone. I just recently started programming, and have decided to use Python after looking at C and Perl. I have encounted a simple problem that I can't seem to solve. This problem occurs in this situation - I am trying to read an integer from a file, add 1 to the integer, and then write the modified value back to the same file. Here is the code I am using (btw, the file will initially be "0", that is all): import string dataFile = open('/home/nconway/python/data', 'r') data = dataFile.read() dataFile.close() dataFile = open('/home/nconway/python/data', 'w') print data dataFile.write(string.atoi(data) + 1) dataFile.close() This generates the following error: Traceback (innermost last): File "file-rw.py", line 8, in ? dataFile.write(string.atoi(data) + 1) What am I doing wrong? Can someone tell me how to fix this? Furthermore, what is the best way to do what I am trying to do? (i.e. most efficient, or whatever). Thanks in advance, Sean Conway From python-tutor@teleo.net Sun Aug 22 05:33:05 1999 From: python-tutor@teleo.net (Patrick Phalen) Date: Sat, 21 Aug 1999 21:33:05 -0700 Subject: [Tutor] File object, r/w (simple) References: <001401beec6c$60cfb240$0528a8c0@home> Message-ID: <9908212141280D.00619@quadra.teleo.net> On Sun, 22 Aug 1999, Sean Conway wrote: > Hello everyone. > > I just recently started programming, and have decided to use Python after > looking at C and Perl. I have encounted a simple problem that I can't seem > to solve. This problem occurs in this situation - I am trying to read an > integer from a file, add 1 to the integer, and then write the modified value > back to the same file. Here is the code I am using (btw, the file will > initially be "0", that is all): > > import string > dataFile = open('/home/nconway/python/data', 'r') > data = dataFile.read() > dataFile.close() > dataFile = open('/home/nconway/python/data', 'w') > print data > dataFile.write(string.atoi(data) + 1) > dataFile.close() > > This generates the following error: > > Traceback (innermost last): > File "file-rw.py", line 8, in ? > dataFile.write(string.atoi(data) + 1) Sean, The python interactive interpreter is your friend when you're first learning to manipulate files and their contents. Try entering this *from the interactive interpreter*: >>>data = open('/home/nconway/python/data', 'r').read() >>>data Take a look at what you get and then think about what you might need to do in your program. From strat_addict@yahoo.com Sun Aug 22 11:11:51 1999 From: strat_addict@yahoo.com (G. Norton) Date: Sun, 22 Aug 1999 03:11:51 -0700 (PDT) Subject: [Tutor] Need help with Tkinter! Message-ID: <19990822101151.18079.rocketmail@web1401.mail.yahoo.com> When I try to import Tkinter this is the message I get: Traceback (innermost last): File "", line 1, in ? File "C:\Program Files\Python\Lib\lib-tk\Tkinter.py", line 1123, in __init__ Widget.__init__(self, master, 'button', cnf, kw) File "C:\Program Files\Python\Lib\lib-tk\Tkinter.py", line 1078, in __init__ BaseWidget._setup(self, master, cnf) File "C:\Program Files\Python\Lib\lib-tk\Tkinter.py", line 1055, in _setup _default_root = Tk() File "C:\Program Files\Python\Lib\lib-tk\Tkinter.py", line 886, in __init__ self.tk = _tkinter.create(screenName, baseName, className) TclError: Can't find a usable init.tcl in the following directories: {} ./lib/tcl8.0 C:/tcl8.0/library {C:/Program Files/library} This probably means that Tcl wasn't installed properly. Can anyone help in this? Thanks, G.Norton (strat_addict!) __________________________________________________ Do You Yahoo!? Bid and sell for free at http://auctions.yahoo.com From super_fez@yahoo.com Sun Aug 22 14:47:16 1999 From: super_fez@yahoo.com (=?iso-8859-1?q?Daniel=20Mitchell?=) Date: Sun, 22 Aug 1999 14:47:16 +0100 (BST) Subject: [Tutor] (no subject) Message-ID: <19990822134716.1307.rocketmail@web1302.mail.yahoo.com> Hey there, OK, I am just starting out and am finding all this stuff VERY confusing. Could anyone help by suggesting a site where I could learn python. One that starts at a really easy level coz I can't figure any of this shit out. Much appreciated, Isegoria _____________________________________________________________ DO YOU YAHOO!? Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk From bowman@montana.com Sun Aug 22 18:20:17 1999 From: bowman@montana.com (bowman) Date: Sun, 22 Aug 1999 11:20:17 -0600 Subject: [Tutor] Re: file r/w References: <199908220504.BAA22885@python.org> Message-ID: <37C03151.A7DA6352@montana.com> > From: "Sean Conway" > dataFile.write(string.atoi(data) + 1) > What am I doing wrong? Can someone tell me how to fix this? "In all cases, file text takes the form of strongs in Python programs: reading a file returns its text in strings, and text is passed to the write methods as strings." _Learning Python_, Mark Lutz & David Ascher pg. 56 , or see the Tutorial, 7.2 one fix : str(string.atoi(data)+1) In the long run you'll need to think about newlines, CSV formats, and so forth. The pickle module will also be helpful, though by default it also uses strings for serialization. From deirdre@deirdre.net Sun Aug 22 23:57:24 1999 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Sun, 22 Aug 1999 15:57:24 -0700 (PDT) Subject: [Tutor] re versus regex In-Reply-To: <37BED451.B90DB5B0@montana.com> Message-ID: On Sat, 21 Aug 1999, bowman wrote: > Deirdre Saoirse wrote: > > > > I suggested that, instead of using regex.gsub after thwapping the file > > into memory that he try: > > It is my impression that the newer 're' package was designed from > scratch to get Python's performance up to par. I don't know if this > implies speed, or just the expressiveness, but it might be interesting > to see what effect in makes on this app. I'm fairly new to Python, so I > haven't used the deprecated regex, since re was available when I > started. I knew regex was quasi-deprecated, but I didn't know why. I find re harder to use for REALLY simple tasks. -- _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net "I must say that I was really happy to see _Linux for Dummies_ -- that's when you know you've arrived." -- Linus Torvalds From tim_one@email.msn.com Mon Aug 23 06:58:27 1999 From: tim_one@email.msn.com (Tim Peters) Date: Mon, 23 Aug 1999 01:58:27 -0400 Subject: [Tutor] re versus regex In-Reply-To: Message-ID: <000401beed2c$84ecadc0$352d2399@tim> [Deirdre Saoirse] > I knew regex was quasi-deprecated, but I didn't know why. I find re > harder to use for REALLY simple tasks. Alas, the same problem is at the root of both: the regex interface wasn't thread-safe. Introducing a separate "match object" makes re thread-safe, but the extra object also means more teensy steps are required to get a really simple task done. regex is wholly deprecated (lack of thread safety was a bad design error); re partly makes up for it by offering many more regular expression features. otoh-whenever-you-can-use-a-string-method-go-for-it-ly y'rs - tim From m.faassen@vet.uu.nl Mon Aug 23 13:25:04 1999 From: m.faassen@vet.uu.nl (Martijn Faassen) Date: Mon, 23 Aug 1999 14:25:04 +0200 Subject: [Tutor] Re: Python question (when you have a free moment) (fwd) References: Message-ID: <37C13DA0.480779AD@vet.uu.nl> David Ascher wrote: > > On Fri, 20 Aug 1999, Deirdre Saoirse wrote: > > > A friend of mine, a molecular biologist, has a problem. He has a file, > > approximately 1.5mb, that has a bunch of returns in it (which interfere > > with his ability to perform raw searches). > > 1.5M isn't that big. > > Why not just: [string.split based code snipped] If you're still interested in why your old method didn't provide much of a speedup, I think the cause may lie in the continuous use of string concatenation; a new string needs to be created all the time, and the (possibly vast) contents of the old string would have to be copied over. A quicker way is to use the array module, which has an array of characters to which you can add strings. This uses smart allocation code (like Python's list internally does), and isn't as heavy in memory use as using a straight list. Regards, Martijn From jblake@stamp-coin.com Wed Aug 25 04:10:57 1999 From: jblake@stamp-coin.com (Jonathon) Date: Wed, 25 Aug 1999 03:10:57 +0000 (UTC) Subject: [Tutor] Initializing Tupples Message-ID: I'm trying, unsuccessfully, to initialize a tupple. The code is as follows: blank_string = " " blank_number = 0 new_tupple = ( blank_string, blank_string, blank_string, blank_number, blank_string, blank_number, blank_number ) # actually, it is 90 items long - the first 50 are blank_string, then the rest are a mix of strings and numbers The error message I get is: "TypeError: object does not support item assignment" Thinking perhaps I needed braces, rather than parenthesis I used them instead, with the same error message. My specific aim is to initialize a tupple to a set of default values then change the value of various items, according to needs. I'm making perhaps three fatal assumptions: #1: tupple is to python as record is to Pascal. #2: strings and numbers in a tupple can be changed. #3: the number of elements in a tupple can not change. FWIW, I also tried curlyques, but that gave the standard SyntaxError message. Which is what I expected, given that they are for dictionaries, and I wasn't setting one up here. Basically, I am using tupples exactly as if they were the same as Pascal's Record type. Which means that i can change the data in them, so long as the type of data is not changed. xan jonathon From dyoo@uclink4.berkeley.edu Wed Aug 25 06:54:49 1999 From: dyoo@uclink4.berkeley.edu (Danny Yoo) Date: Tue, 24 Aug 1999 22:54:49 -0700 Subject: [Tutor] Re: Tutor digest, Vol 1 #108 - 1 msg References: <199908250507.BAA26883@python.org> Message-ID: <99082423065200.02970@localhost.localdomain> On Tue, 24 Aug 1999, you wrote: > Today's Topics: > > 1. Initializing Tuples (Jonathon) > > Basically, I am using tuples exactly as if they were the same as > Pascal's Record type. Which means that i can change the data > in them, so long as the type of data is not changed. You might want to try using dictionaries instead of tuples, if you're using the data structure as a record like that: student = { 'name':"John Doe", 'age', 42 } However, I think it might be better to use a class as a way to collect your data into a structure. Classes are very much like records: class student: name = "John Doe" age = 42 mystudent = student() # This will create a new "instance" of the class print mystudent.name # you're able to access it like a record # Also note that it has the default values we want mystudent.name = "blah" mystudent2 = student() print mystudent2.name # Changing mystudent has no effect on mystudent2 The class method is cleaner, I think, and is closer in effect to what pascal records do. Hope this helps! -- *** dyoo@uclink4.berkeley.edu *** From bowman@montana.com Wed Aug 25 14:16:45 1999 From: bowman@montana.com (bowman) Date: Wed, 25 Aug 1999 07:16:45 -0600 Subject: [Tutor] Initializing Tupples (Jonathon) References: <199908250507.BAA26883@python.org> Message-ID: <37C3ECBD.30E27D24@montana.com> > I'm making perhaps three fatal assumptions: > #1: tupple is to python as record is to Pascal. > #2: strings and numbers in a tupple can be changed. > #3: the number of elements in a tupple can not change. Yes, you are. Tuples are immutable; they cannot be changed after the initial assignment. > FWIW, I also tried curlyques, but that gave the standard SyntaxError > message. Have you tried the list? myList=[blank_string, blank_number.........] A reading of the tutorial will help. Python is not Pascal. From joe@strout.net Wed Aug 25 15:38:25 1999 From: joe@strout.net (Joseph J. Strout) Date: Wed, 25 Aug 1999 07:38:25 -0700 Subject: [Tutor] Initializing Tupples In-Reply-To: References: Message-ID: At 3:10 AM +0000 08/25/99, Jonathon wrote: > I'm trying, unsuccessfully, to initialize a tupple. It's 'tuple' (pronounced "two-pull"), not 'tupple'. > The code is as follows: > blank_string = " " > blank_number = 0 > new_tupple = ( blank_string, blank_string, blank_string, >blank_number, blank_string, blank_number, blank_number ) > > The error message I get is: > "TypeError: object does not support item assignment" Something's wrong; I just tried equivalent code, and it works just fine: bs = " " bn = 0 mytuple = (bs, bs, bs, bn, bn) print mytuple ...This results in the output: (' ', ' ', ' ', 0, 0) So there must be a difference between what you're telling us, and what you're actually trying (did you copy & paste?). Or else your copy of Python is seriously screwed up (unlikely). Or, this error occurs not on the code you gave us, but on later code where you try to... > My specific aim is to initialize a tupple to a set of default values > then change the value of various items, according to needs. Well, you can't. You need to use a list for that; tuples are immutable. > I'm making perhaps three fatal assumptions: > #1: tupple is to python as record is to Pascal. I don't think so, but I don't remember enough Pascal to say. > #2: strings and numbers in a tupple can be changed. Wrong and wrong. :) Strings and tuples are both immutable, and numbers are special (but basically, also immutable). So you can't change a string that's in a tuple, nor can you replace it with another string entirely. Use a list. Then you still can't change a string in place, but you can replace an element of a list with a new string or number or whatever. > #3: the number of elements in a tupple can not change. This is true. > Basically, I am using tupples exactly as if they were the same as > Pascal's Record type. Which means that i can change the data > in them, so long as the type of data is not changed. Nope. Python is weakly typed; the type of data does not matter. What matters is whether the container is mutable are not. Lists are mutable, tuples are not. Going through the Python tutorial should be enlightening on this point. Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From skip@mojam.com (Skip Montanaro) Wed Aug 25 16:09:06 1999 From: skip@mojam.com (Skip Montanaro) (Skip Montanaro) Date: Wed, 25 Aug 1999 10:09:06 -0500 (CDT) Subject: [Tutor] Re: Initializing Tupples In-Reply-To: <199908250507.BAA26903@python.org> References: <199908250507.BAA26903@python.org> Message-ID: <14276.376.754869.235733@dolphin.mojam.com> Jonathon> I'm trying, unsuccessfully, to initialize a tupple. Jonathon> The code is as follows: Jonathon> blank_string = " " Jonathon> blank_number = 0 Jonathon> new_tupple = ( blank_string, blank_string, blank_string, blank_number, blank_string, blank_number, blank_number ) Jonathon> # actually, it is 90 items long - the first 50 are blank_string, then the rest are a mix of strings and numbers Jonathon> The error message I get is: Jonathon> "TypeError: object does not support item assignment" Jonathon, The above code worked for me. You might find tuple creation easier to do with the multiplication and addition operators. Instead of the above, you could use something like new_tuple = ("",) * 50 + (0, "") * 20 which would create a 90-element tuple whose first 50 elemets are "" and whose next 40 elements alternate between 0 and "". Jonathon> My specific aim is to initialize a tupple to a set of Jonathon> default values then change the value of various items, Jonathon> according to needs. This you can't do. Tuples are immutable. Once created, they can't be modified. I suspect the TypeError you got was actually from trying to assign to an element of the tuple instead of its initialization. You can modify lists. Lists and tuples behave pretty much alike except for the immutability bit. You could use new_list = [""] * 50 + [0, ""] * 20 to create a list that you can then modify. You can also convert between lists and tuples, so you might find it useful to use a tuple as a default value and then make a list that's a copy. The immutability of the tuple would serve as a reinforcement that it's to be used as a default and the list is the version that you dink with, e.g.: class Spam: default_settings = ( 0, 1, 2 ) def __init__(self): self.settings = list(default_settings) def fiddle_setting(self, index, value): self.settings[index] = value Jonathon> I'm making perhaps three fatal assumptions: Jonathon> #1: tupple is to python as record is to Pascal. Jonathon> #2: strings and numbers in a tupple can be changed. Jonathon> #3: the number of elements in a tupple can not change. A Python tuple is more like an immutable array (though an array whose elements can be of different types). You'd normally use it where you have a group of values that makes sense to consider as a whole. For instance, 3D Cartesian coordinates are commonly represented as 3-element tuples. Note that since a tuple is immutable, neither its length nor its values can change. Also, the elements of a tuple can reference any kind of Python object, not just strings and numbers. I could reference instances of the above Spam class, for instance: moe = Spam() larry = Spam() curly = Spam() stooges = (moe, larry, curly) shemp = Spam() stooges.append(shemp) # wrong! stooges = stooges + (shemp,) # stooges = [moe, larry, curly] # a list ... stooges.append(shemp) # ... to which we can append stuff The moe, larry, curly and shemp elements of the stooges tuple can themselves be modified: moe.fiddle_setting(2, 7) stooges[2].fiddle_setting(0, -1) Neither operation tries to modify the tuple itself. A Pascal record is more akin to a Python dictionary or class instance, though the underlying addressing is quite different (hash table instead of direct offset into a chunk of memory). Skip Montanaro | http://www.mojam.com/ skip@mojam.com | http://www.musi-cal.com/~skip/ 847-971-7098 | Python: Programming the way Guido indented... From sifl-olly@usa.net Wed Aug 25 16:26:21 1999 From: sifl-olly@usa.net (webby armstrong) Date: 25 Aug 99 11:26:21 EDT Subject: [Tutor] new bie help Message-ID: <19990825152621.2224.qmail@nw175.netaddress.usa.net> Hello everyone, I have been going through the tutorial and have encounter a few gliches or bugs. After repeating steps over and over again I have found no fault of my own. I have noticed that some of the steps performed word only in the command line mode while others only work in the GUI mode (python shell) why is this? the other weird occurance was that I was unable to turn off the command line mode or even continue after entering this script: >>> while 1: ... pass # Busy-wait for keyboard interrupt ... this is found in the 4.5 section of the tutorial, defining functions Control 'Z' would not work either, and I have to shut it down using MS "X" close page button exiting with out saving. is this normal? Sincerely James ____________________________________________________________________ Get free email and a permanent address at http://www.netaddress.com/?N=1 From joe@strout.net Wed Aug 25 16:46:41 1999 From: joe@strout.net (Joseph J. Strout) Date: Wed, 25 Aug 1999 08:46:41 -0700 Subject: [Tutor] new bie help In-Reply-To: <19990825152621.2224.qmail@nw175.netaddress.usa.net> References: <19990825152621.2224.qmail@nw175.netaddress.usa.net> Message-ID: At 11:26 AM -0400 08/25/99, webby armstrong wrote: >I have been going through the tutorial and have encounter a few >gliches or bugs. After repeating steps over and over again I >have found no fault of my own. Well, what are they? You'll have to ask a specific question to get a specific answer. ;) > I have noticed that some of the >steps performed word only in the command line mode while others >only work in the GUI mode (python shell) why is this? Without an example, I have no idea. That shouldn't be. >the other weird occurance was that I was unable to turn off the >command line mode or even continue after entering this script: > > >>> while 1: >... pass # Busy-wait for keyboard interrupt This is an infinite loop. The "keyboard interrupt" it's waiting for very busily is a control-C on most machines, or a command-period on the Mac. This is a very bad thing to do, as in many circumstances even these won't work. We should suggest a different example to Guido... e.g., trapping and ignoring an error: try: foo = grebblebarb except: pass # ignore any errors in the 'try' block which is also not a good idea in general, but sometimes useful. Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From da@ski.org Wed Aug 25 18:14:50 1999 From: da@ski.org (David Ascher) Date: Wed, 25 Aug 1999 10:14:50 -0700 (Pacific Daylight Time) Subject: [Tutor] Initializing Tupples In-Reply-To: Message-ID: On Wed, 25 Aug 1999, Joseph J. Strout wrote: > At 3:10 AM +0000 08/25/99, Jonathon wrote: > > > I'm trying, unsuccessfully, to initialize a tupple. > > It's 'tuple' (pronounced "two-pull"), not 'tupple'. I hear 50% two-pull, 50% tupple. I think both are acceptable. Probably a british-american split. --david (not that that helps anyone solve any real problem =) From markm@lineo.com Wed Aug 25 18:38:38 1999 From: markm@lineo.com (Mark C. Mason) Date: Wed, 25 Aug 1999 11:38:38 -0600 Subject: [Tutor] Python question for beginners... Message-ID: <37C42A1D.4FE4BFD1@lineo.com> I am doing a cgi script. I need the script to execute a program and return the program output as a variable preferably. I tried using os.system("/usr/local/bin/program") but that doesn't seem to work from within the script. It works in the python interpretor directly, but not within the script. Maybe the os.execv command???I don't know how to use that. any help would be greatly appreciated... Mark From DOUGS@oceanic.com Wed Aug 25 19:00:27 1999 From: DOUGS@oceanic.com (Doug Stanfield) Date: Wed, 25 Aug 1999 08:00:27 -1000 Subject: [Tutor] Python question for beginners... Message-ID: <5650A1190E4FD111BC7E0000F8034D26A0EFAD@huina.oceanic.com> Look at the os.popen command: http://www.python.org/doc/current/lib/os-newstreams.html#l2h-819. An example use: def snmp_get(host,community="public",node="system.1.0"): command = "snmpget %s %s %s" % (host, community, node) answer = os.popen(command, 'r').readlines() return answer[0] -Doug- > -----Original Message----- > From: Mark C. Mason [mailto:markm@lineo.com] > Sent: Wednesday, August 25, 1999 7:39 AM > To: tutor@python.org > Subject: [Tutor] Python question for beginners... > > > I am doing a cgi script. I need the script to execute a program and > return the program output as a variable preferably. > I tried using os.system("/usr/local/bin/program") but that > doesn't seem > to work from within the script. It works in the python interpretor > directly, but > not within the script. Maybe the os.execv command???I don't > know how to > use that. > any help would be greatly appreciated... > > Mark > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://www.python.org/mailman/listinfo/tutor > From tore.ericsson@telia.com Thu Aug 26 00:04:40 1999 From: tore.ericsson@telia.com (Tore Ericsson) Date: Thu, 26 Aug 1999 01:04:40 +0200 Subject: [Tutor] Nested list item assignment Message-ID: <000a01beef4e$541e1de0$7be043c3@scandic2-018616> Can anybody explain line 6 in this: >>> A = [[0]*3]*3 >>> A [[0, 0, 0], [0, 0, 0], [0, 0, 0]] >>> A[0][0] = 1 >>> A [[1, 0, 0], [1, 0, 0], [1, 0, 0]] >>> # One assigned, three updated!? >>> Thanks / Tore From joe@strout.net Thu Aug 26 00:26:05 1999 From: joe@strout.net (Joseph J. Strout) Date: Wed, 25 Aug 1999 16:26:05 -0700 Subject: [Tutor] Nested list item assignment In-Reply-To: <000a01beef4e$541e1de0$7be043c3@scandic2-018616> References: <000a01beef4e$541e1de0$7be043c3@scandic2-018616> Message-ID: At 1:04 AM +0200 08/26/99, Tore Ericsson wrote: >Can anybody explain line 6 in this: > > >>> A = [[0]*3]*3 > >>> A >[[0, 0, 0], [0, 0, 0], [0, 0, 0]] > >>> A[0][0] = 1 > >>> A >[[1, 0, 0], [1, 0, 0], [1, 0, 0]] > >>> # One assigned, three updated!? You have to watch out for lists; being mutable objects, if A is a list, and you do B=A, then A and B refer to the *same* list, and changing one immediately appears to change the other. You've run into the same here; your list contains three references to the *same* sub-list. Probably you want to use Numeric.array for this sort of thing anyway, or at least the built-in array module. Otherwise, try: A = map(lambda x:[0]*3, range(3)) which is considerably more cryptic, but does get you a list of three unique sub-lists. If anybody can suggest a clearer way to accomplish this, I'd like to hear it too! Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From davidscards@hotmail.com Thu Aug 26 02:34:11 1999 From: davidscards@hotmail.com (david dumore) Date: Wed, 25 Aug 1999 18:34:11 PDT Subject: [Tutor] Teach Me Message-ID: <19990826013411.75276.qmail@hotmail.com> You said that if I wanted to learn how to hack to e-mail you at this address. I am curious. can you help? Thanks David _______________________________________________________________ Get Free Email and Do More On The Web. Visit http://www.msn.com From tim_one@email.msn.com Thu Aug 26 06:06:52 1999 From: tim_one@email.msn.com (Tim Peters) Date: Thu, 26 Aug 1999 01:06:52 -0400 Subject: [Tutor] new bie help In-Reply-To: Message-ID: <000101beef80$cf3d3560$522d153f@tim> [webby armstrong] > the other weird occurance was that I was unable to turn off the > command line mode or even continue after entering this script: > > >>> while 1: > ... pass # Busy-wait for keyboard interrupt [Joseph J. Strout] > This is an infinite loop. The "keyboard interrupt" it's waiting for > very busily is a control-C on most machines, or a command-period on > the Mac. If webby was running this under IDLE, the control-C would never be seen -- Tk takes over the keyboard, so Python doesn't see the control-C until Tk passes it on, but Tk never gets a chance to run because Python is too busy running the loop. The solution is simple: don't run infinite loops under IDLE . decent-advice-even-outside-of-idle-ly y'rs - tim From egancoad@nor.com.au Thu Aug 26 08:38:47 1999 From: egancoad@nor.com.au (Geoff Coady) Date: Thu, 26 Aug 1999 17:38:47 +1000 Subject: [Tutor] um i downloaded all the python and it does not work can u tell me why? and i so much want to know how to hack so can u send me a manual for it with a reason why it does not work please i really need to know!!! i love everything that all hackers do that's why i want to be one so if u could send me stuff i would be happy Message-ID: <37C4EF07.242AE174@nor.com.au> From joe@strout.net Thu Aug 26 15:48:36 1999 From: joe@strout.net (Joseph J. Strout) Date: Thu, 26 Aug 1999 07:48:36 -0700 Subject: [Tutor] Teach Me In-Reply-To: <19990826013411.75276.qmail@hotmail.com> References: <19990826013411.75276.qmail@hotmail.com> Message-ID: At 6:34 PM -0700 08/25/99, david dumore wrote: >You said that if I wanted to learn how to hack to e-mail you at this >address. I am curious. can you help? Sure we can. But it helps if you ask a specific question. This is a mailing list; ask a question and you'll usually get several answers. Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From joe@strout.net Thu Aug 26 15:57:28 1999 From: joe@strout.net (Joseph J. Strout) Date: Thu, 26 Aug 1999 07:57:28 -0700 Subject: [Tutor] um i put my whole msg in the Subject line In-Reply-To: <37C4EF07.242AE174@nor.com.au> References: <37C4EF07.242AE174@nor.com.au> Message-ID: At 5:38 PM +1000 08/26/99, Geoff Coady wrote: >i downloaded all the python and it does not work can u tell me why? Nope, not unless you provide more detail than "does not work". Presumably something either happened that you didn't expect to happen, or something you expected failed to happen. E.g., you double-clicked "Python" and your monitor exploded (much to your surprise). But without these sorts of details, how could we possibly guess what's going on? > and i so much want to know how to hack so can u send me a manual >for it with a reason why it does not work please No, we can't, but we can point you to http://www.python.org/doc/ where you'll find extensive and excellent documentation. > i really need to know!!! Then tell us what went wrong so we can help. > i love everything that all hackers do that's why i want to be one >so if u could send me stuff i would be happy Well, I suppose this message counts as "stuff", so here you go. ;) Good luck finding your Shift and Return keys, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From davidscards@hotmail.com Thu Aug 26 20:58:10 1999 From: davidscards@hotmail.com (david dumore) Date: Thu, 26 Aug 1999 12:58:10 PDT Subject: [Tutor] Teach Me Message-ID: <19990826195810.68716.qmail@hotmail.com> How in the world could I go into someone elses computer and shut it down without them knowing it was me? How can I just shut it down? _______________________________________________________________ Get Free Email and Do More On The Web. Visit http://www.msn.com From da@ski.org Thu Aug 26 21:02:34 1999 From: da@ski.org (David Ascher) Date: Thu, 26 Aug 1999 13:02:34 -0700 (Pacific Daylight Time) Subject: [Tutor] Teach Me In-Reply-To: <19990826195810.68716.qmail@hotmail.com> Message-ID: On Thu, 26 Aug 1999, david dumore wrote: > How in the world could I go into someone elses computer and shut it down > without them knowing it was me? How can I just shut it down? I recommend simply ignoring such emails. --david From strat_addict@yahoo.com Fri Aug 27 00:36:02 1999 From: strat_addict@yahoo.com (G. Norton) Date: Thu, 26 Aug 1999 16:36:02 -0700 (PDT) Subject: [Tutor] [Tutor]Teach Me Message-ID: <19990826233602.13843.rocketmail@web1403.mail.yahoo.com> O.K. DUDE, This is how you do it: Dial into the cross-platforming PKL system and download their modum's config SLR number. After you have that number, plug it into your mother board's driver series path and reboot your computer. When your operating system comes back up, You will be able to access the other computer through the c:/windows/really/sad/cracker/question.exe file. Hey, Good Luck!! __________________________________________________ Do You Yahoo!? Bid and sell for free at http://auctions.yahoo.com From KShao@AstralPoint.com Fri Aug 27 00:20:40 1999 From: KShao@AstralPoint.com (Ke-Hsiang Shao) Date: Thu, 26 Aug 1999 19:20:40 -0400 Subject: [Tutor] How to manage stdin, stdout on Python NT ? Message-ID: <8F1BE54DECC1D211BB2500105A9CA421154729@ADMIN1> Hi there, In the win32 extension, there is win32pipe. In there, user can use win32pipe.popen2 or popen3, popen4 to start a command/program and the stdin, stdout will be in [0] ans [1] respectively. The statements are like this. p=win32pipe.popen2('extelnet admin2','t') prompt=p[1].readlines() ... when I found the "login:" returned, I issue p[0].write('username\r\n') and after that, the extelnet never response. Where extelnet is a command line telnet.exe which I got from expect package. I can manually run 'extelnet' and works fine. I can run tcl/expect works fine on my NT environment. My question is: Does any one successfully drive telnet on win32 Python ? Is so, how does he/she manage the stdin ? Any example works on win32 environment ? Thanks Cary Kehsiang email: Shao cary_shao@yahoo.com Astral Point Communications, Inc. kshao@astralpoint.com 27 Industrial Ave., Chelmsford, MA 01824 Phone: (978) 256-9984 Fax: (978) 256-6128 From strat_addict@yahoo.com Fri Aug 27 01:18:48 1999 From: strat_addict@yahoo.com (G. Norton) Date: Thu, 26 Aug 1999 17:18:48 -0700 (PDT) Subject: [Tutor] My Apologies Message-ID: <19990827001848.5641.rocketmail@web1405.mail.yahoo.com> I would like to apologize for my response to the the "hacking into email" question. Though I did get a laugh out of it after I sent it, I realized that responding to questions like that is just as bad as posting them.I receive a lot of help in this forum and made a few friends along the way.Mr. Ascher does a fine job with this forum(love the book, by the way)and reponses like mine turn it more towards a Yahoo chat room, and I for one don't want that. My apologizes to all and stay clear of the dark side, G.Norton __________________________________________________ Do You Yahoo!? Bid and sell for free at http://auctions.yahoo.com From stuorpeg@lvcm.com Fri Aug 27 04:03:30 1999 From: stuorpeg@lvcm.com (Stuart/Peggy Powell) Date: Thu, 26 Aug 1999 20:03:30 -0700 Subject: [Tutor] confirmation request Message-ID: <001101bef038$be4859c0$7912ea18@lvcablemodem.com> This is a multi-part message in MIME format. ------=_NextPart_000_000E_01BEEFFE.118DF440 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable confirm 819933 ------=_NextPart_000_000E_01BEEFFE.118DF440 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
confirm = 819933
------=_NextPart_000_000E_01BEEFFE.118DF440-- From malhotra_kapil@hotmail.com Fri Aug 27 07:24:49 1999 From: malhotra_kapil@hotmail.com (Kapil Malhotra) Date: Thu, 26 Aug 1999 23:24:49 PDT Subject: [Tutor] Getting Started Message-ID: <19990827062450.96274.qmail@hotmail.com> This is Kapil Malhotra from India. I need to learn Python for my project. My mail ID is malhotra_kapil@hotmail.com . Please send me any stuff which I might find useful. Regards, Kapil ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com From alan.gauld@bt.com Fri Aug 27 09:50:13 1999 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Fri, 27 Aug 1999 09:50:13 +0100 Subject: [Tutor] Python question for beginners... Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF5DBB@mbtlipnt02.btlabs.bt.co.uk> > I am doing a cgi script. I need the script to execute a program and > return the program output as a variable preferably. > I tried using os.system("/usr/local/bin/program") but that Look at os.popen(...) BUT the other issue in CGI work is that your program will execute as the cgi or www user. Often that user has very restricted access to system commands and files (for good security reasons!) > to work from within the script. It works in the python interpretor That could be the security restriction above.... > not within the script. Maybe the os.execv command???I don't Almost certainly not - unless you os.fork() first. execv will *replace* your Python program with whatever program you execute. Alan G. From joe@strout.net Fri Aug 27 15:33:16 1999 From: joe@strout.net (Joseph J. Strout) Date: Fri, 27 Aug 1999 07:33:16 -0700 Subject: [Tutor] Getting Started In-Reply-To: <19990827062450.96274.qmail@hotmail.com> References: <19990827062450.96274.qmail@hotmail.com> Message-ID: At 11:24 PM -0700 08/26/99, Kapil Malhotra wrote: >This is Kapil Malhotra from India. I need to learn Python for my >project. My mail ID is malhotra_kapil@hotmail.com . Please send me >any stuff which I might find useful. That's not how it works. The "stuff you might find useful" is all at http://www.python.org. This mailing list is for specific topics and questions -- when you have one, ask it, and you'll get an answer. Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From argskate@netzero.net Fri Aug 27 04:15:11 1999 From: argskate@netzero.net (Aaron Marzec) Date: 26 Aug 99 22:15:11 -0500 Subject: [Tutor] help Message-ID: <199908270220.WAA05534@python.org> can you give me some tips on your python software v1.52 P.S Im a newbie ________________________________________________________ NetZero - We believe in a FREE Internet. Shouldn't you? Get your FREE Internet Access and Email at http://www.netzero.net/download/index.html From wilson@chemsun.chem.umn.edu Fri Aug 27 18:47:38 1999 From: wilson@chemsun.chem.umn.edu (Tim Wilson) Date: Fri, 27 Aug 1999 12:47:38 -0500 (CDT) Subject: [Tutor] help In-Reply-To: <199908270220.WAA05534@python.org> Message-ID: On 26 Aug 1999, Aaron Marzec wrote: > can you give me some tips on your python software v1.52 > > P.S Im a newbie You might want to start with the Python Tutorial at http://www.python.org/doc/current/tut/tut.html If you're interested in books, I would recommend "Learning Python" by Lutz, Ascher, and Willison from O'Reilly and Associates. You can get it at Amazon at http://www.amazon.com/exec/obidos/ASIN/1565924649/o/qid=935775937/sr=8-1/002-5025541-6796200 Have fun. -Tim -- Timothy Wilson | "The faster you | Check out: Henry Sibley H.S. | go, the shorter | http://slashdot.org/ W. St. Paul, MN, USA | you are." | http://linux.com/ wilson@chem.umn.edu | -Einstein | http://www.mn-linux.org/ From joe@strout.net Fri Aug 27 18:49:36 1999 From: joe@strout.net (Joseph J. Strout) Date: Fri, 27 Aug 1999 10:49:36 -0700 Subject: [Tutor] help In-Reply-To: <199908270220.WAA05534@python.org> References: <199908270220.WAA05534@python.org> Message-ID: At 10:15 PM -0500 08/26/99, Aaron Marzec wrote: >can you give me some tips on your python software v1.52 Sure, ask a specific question and you'll get a specific answer. Ask a general answer like this and you'll get a general answer like "Read the docs and experiment." ;) Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From da@ski.org Fri Aug 27 20:04:20 1999 From: da@ski.org (David Ascher) Date: Fri, 27 Aug 1999 12:04:20 -0700 (Pacific Daylight Time) Subject: [Tutor] Auto-responder -- request for comments Message-ID: I'm going to add an autoresponder which will be sent to folks who are posting to the tutor list for the first time in a long time. Here is my first draft of the message. If anyone has any edits they'd like to see happen, let me know. --david Your message for tutor@python.org, the Python programming tutor list, has been received and is being delivered. This automated response is sent to those of you new to the Tutor list, to point out a few resources that can help with answering your own questions, or improve the chances of getting a useful answer from the other subscribers. If your question is something akin to: "I've just heard about Python, and it sounds great! Where can I find out more on how to program with Python?" or: "What's Python?" please read section 1 below. On the other hand, if your question is: "I've heard that Python is good for hacking -- I want to know more!" or "Can you teach me how to break into a computer with Python?" please read section 2 at the bottom of this email. Section 1: ---------- The most comprehensive overview of python.org help resources is at http://www.python.org/Help.html . The Python FAQ is available at http://www.python.org/doc/FAQ.html and it has answers to many questions that people ask, possibly including your question. Another wealth of information and experience can be found via the python.org searches, at http://www.python.org/search/ . There you'll find comprehensive, easy-to-use searches over the python.org web site and the python newsgroup (comp.lang.python, also available as a mailing list, python-list@python.org). Finally, when you do send email to the Tutor list, be as clear as you can about the problem, including, when relevant, details like: - Precise error messages, including complete tracebacks - The hardware platform (available in the Python sys module as sys.platform) - The python version (sys.version) - The python search path (sys.path) In general, be specific about what was going on connected with the problem or what specific concept you're having difficulties with. The better the info you provide, the more likely the helpers will be able to glean the answer... Note that no one is paid to read the tutor list or provide answers, and most readers often have other work that demands their attention. Well-posed requests for help are usually answered fairly promptly, but occasionally a request slips by, so if you do not get a response with one or two working days (it's usually quicker than that), please feel free to send a followup, asking whether anyone is working on your question. Anyway, your message is being delivered to the Tutor list as this one is being sent. However, if your question was about as detailed as "Teach me how to program in Python", do not count on an answer -- this email contains all the information you need to start. Come back with a more precise question, and we'll be glad to help. Thanks! Section 2: ---------- We often get requests which ask about hacking or cracking or breaking into computers. If you haven't yet, go read Eric Raymond's seminal article "How To Become a Hacker" (http://www.tuxedo.org/~esr/faqs/hacker-howto.html). If you want help learning how to hack the way Eric defines the word, then come back to us (and read Section 1 above). If you want help learning how to crack, go look elsewhere -- we're not interested in helping you do that. From ivanlan@callware.com Fri Aug 27 20:27:49 1999 From: ivanlan@callware.com (Ivan Van Laningham) Date: Fri, 27 Aug 1999 13:27:49 -0600 Subject: [Tutor] Auto-responder -- request for comments References: Message-ID: <37C6E6B5.7696DE46@callware.com> Hi All-- David Ascher wrote: > > I'm going to add an autoresponder which will be sent to folks who are > posting to the tutor list for the first time in a long time. Here is my > first draft of the message. If anyone has any edits they'd like to see > happen, let me know. > A good idea! [bobbitt] However: > > Section 2: > ---------- > > We often get requests which ask about hacking or cracking or breaking > into computers. If you haven't yet, go read Eric Raymond's seminal > article "How To Become a Hacker" > (http://www.tuxedo.org/~esr/faqs/hacker-howto.html). Well, I take issue with the word "seminal" here. Webster's online says: Main Entry: sem·i·nal Pronunciation: 'se-m&-n&l Function: adjective Etymology: Middle English, from Middle French, from Latin seminalis, from semin-, semen seed -- more at SEMEN Date: 14th century 1 : of, relating to, or consisting of seed or semen 2 : containing or contributing the seeds of later development : CREATIVE, ORIGINAL - sem·i·nal·ly /-n&l-E/ adverb I would suggest "important," "influential," "creative," or possibly even "ovular." The last has the same sense of containing or contributing the seeds of later development, but from a slightly different perspective;-) -ly y'rs, Ivan;-) ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan@callware.com ivanlan@home.com http://www.pauahtun.org See also: http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 ---------------------------------------------- From jblake@stamp-coin.com Fri Aug 27 20:46:12 1999 From: jblake@stamp-coin.com (Jonathon) Date: Fri, 27 Aug 1999 19:46:12 +0000 (UTC) Subject: [Tutor] Initializing Tupples In-Reply-To: Message-ID: On Wed, 25 Aug 1999, Joseph J. Strout wrote: >So there must be a difference between what you're telling us, and Source code from the program I am writing is available at http://www.stamp-coin.com/python/script-error/index.html >copy of Python is seriously screwed up (unlikely). Or, this error >occurs not on the code you gave us, but on later code where you try >to... Possible. >Well, you can't. You need to use a list for that; tuples are immutable. Let's see if I understand the difference between lists and tuples. Once a Tuple is created, it can not be changed. Once a List is created, both it, and its contents can be changed --- increased, decreased etc. IE: Example_Tuple = ( "joe"0, "curly", "moe" ) and Example_Tuple retains that value for the duration of the program. Example_List = [ "joe", "curly", "moe" ] Example_List[0] = "larry" Changes the 0 element to larry. Example_List.insert(3, "joe") Adds "joe" to the list, as the third element. Example_List[3] = 2 Makes that a number, instead of a string. << All this appears to work at the python prompt. >> xan jonathon From joe@strout.net Fri Aug 27 21:19:28 1999 From: joe@strout.net (Joseph J. Strout) Date: Fri, 27 Aug 1999 13:19:28 -0700 Subject: [Tutor] Initializing Tupples In-Reply-To: References: Message-ID: At 7:46 PM +0000 08/27/99, Jonathon wrote: > Let's see if I understand the difference between lists and > tuples. > > Once a Tuple is created, it can not be changed. > Once a List is created, both it, and its contents can > be changed --- increased, decreased etc. Yep, that's it. (And, for the record, strings are just like tuples.) > Example_Tuple = ( "joe", "curly", "moe" ) > and Example_Tuple retains that value for the duration > of the program. Well, not exactly -- you could easily rebind Example_Tuple to something else, e.g.: Example_Tuple = Example_Tuple[:2] # keep only the first two items or Example_Tuple = Example_Tuple + ("larry", "guido") # append two items These work because the slice operator [:] or the addition operator creates a *new* tuple, rather than modifying the old one in place; and then this new tuple is bound to the name "Example_Tuple". Does this make sense? Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From stephen@webadmins.com Fri Aug 27 23:15:59 1999 From: stephen@webadmins.com (Stephen) Date: Fri, 27 Aug 1999 18:15:59 -0400 (EDT) Subject: [Tutor] help In-Reply-To: Message-ID: I just picked up python in the last few weeks and started scripting @ work. Take my word for it... skip 'Learning Python' and go directly to 'Programming Python' if you're already versed in another scripting language (perl/shell/etc). The 'Learning Python' book put me to sleep... /***************************************************************\ * Stephen ("xinu") Klassen -- Unix Systems Administrator * * Website: http://stephen.webadmins.com/ UIN: 19224641 (wk) * \***************************************************************/ On Fri, 27 Aug 1999, Tim Wilson wrote: > On 26 Aug 1999, Aaron Marzec wrote: > > > can you give me some tips on your python software v1.52 > > > > P.S Im a newbie > > You might want to start with the Python Tutorial at > http://www.python.org/doc/current/tut/tut.html From watchman1@bigfoot.com Sat Aug 28 04:46:02 1999 From: watchman1@bigfoot.com (Billy) Date: Fri, 27 Aug 1999 23:46:02 -0400 Subject: [Tutor] RE: how do I get pythons GUI to work In-Reply-To: <199908260505.BAA02382@python.org> Message-ID: <001a01bef107$d9514680$75a296d0@billyest> I am running win98 when I click on the python GUI the Herd drive works but the program never starts I can only use the command line Billy Estes - From watchman1@bigfoot.com Sat Aug 28 04:52:53 1999 From: watchman1@bigfoot.com (Billy) Date: Fri, 27 Aug 1999 23:52:53 -0400 Subject: [Tutor] how do I get the python GUI to work In-Reply-To: <199908260505.BAA02382@python.org> Message-ID: <000001bef108$ceb8c300$75a296d0@billyest> I am running win98 when I click on the python GUI icon the hard drive try to work but the GUI never comes up Billy Estes From strat_addict@yahoo.com Sat Aug 28 06:45:48 1999 From: strat_addict@yahoo.com (G. Norton) Date: Fri, 27 Aug 1999 22:45:48 -0700 (PDT) Subject: [Tutor] how do I get the python GUI to work Message-ID: <19990828054548.28405.rocketmail@web1403.mail.yahoo.com> --- Billy wrote: > I am running win98 when I click on the python GUI > icon the hard drive try to > work but the GUI never comes up > Billy Estes > > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://www.python.org/mailman/listinfo/tutor > Billy, I also have Windows98 and had the same problem.The problem is with your path.I don't know if this is "The" way do fix it but it worked for me.What I did was uninstall everything, set the path and reinstalled.Everything works fine now.I don't know your programming background, but just in case you don't know what i'm talking about I'll try to save you a few emails and some headache time and explain path now.(If you do, ignore the rest of this) BUT: click start go to Run and type sysedit the first window you should see is C:\\Autoexec.bat this is where you set your path.This is my path:(I don't recommend cutting and pasting.Type it in to play it safe!) set PYROOT=c:\PROGRA~1\Python PATH %PYROOT%;%PATH% set PYTHONPATH=.;%PYROOT%;%PYROOT%\lib;%PYROOT%\lib\plat-win;%PYROOT%\lib\lib-tk;%PYROOT%\PIL;%PYROOT%ext\pyds;%PYROOT%ext\lib; set TCL_LIBRARY=%PYROOT%\tcl8.0\library set TK_LIBRARY=%PYROOT%\tk8.0\library There should be only 6 lines. From "PYTHONPATH=" to "ROOT%ext\lib;" is one line. (sorry can't format my email) Reboot your computer and it should work. Good Luck, G.Norton __________________________________________________ Do You Yahoo!? Bid and sell for free at http://auctions.yahoo.com From vidya@singnet.com.sg Sat Aug 28 16:33:45 1999 From: vidya@singnet.com.sg (Vidyasagar Govind) Date: Sat, 28 Aug 1999 15:33:45 -0000=?us-ascii?Q?_(/etc/localtime=C0=01=14=08=A4=F2=FF=BF=B9=A6 =08?= Subject: [Tutor] Fractals using Python Message-ID: I am a newbie to Python, and really like it especially with its numerical extensions. Can Python be used for plotting outputs from mathematical formulae? I used to use VB for plotting the output of fractal formulae using simple commands for drawing lines, circles,etc. Does Python have equivalent commands/modules? If so where can I get them? Thanks! ---------------------------------- E-Mail: Vidyasagar Govind Date: 28-Aug-99 Time: 15:26:25 This message was sent by XFMail ---------------------------------- From b4705021@im.ntu.edu.tw Sat Aug 28 18:00:31 1999 From: b4705021@im.ntu.edu.tw (Daniel Gau) Date: Sun, 29 Aug 1999 01:00:31 +0800 Subject: [Tutor] Re: Tutor digest, Vol 1 #111 - 13 msgs References: <199908280514.BAA16145@python.org> Message-ID: <37C815AF.5D1A030@im.ntu.edu.tw> tutor-admin@python.org wrote: > > Send Tutor mailing list submissions to > tutor@python.org > > To subscribe or unsubscribe via the web, visit > http://www.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. Getting Started (Kapil Malhotra) > 2. RE: Python question for beginners... (alan.gauld@bt.com) > 3. Re: Getting Started (Joseph J. Strout) > 4. help (Aaron Marzec) > 5. Re: help (Tim Wilson) > 6. Re: help (Joseph J. Strout) > 7. Auto-responder -- request for comments (David Ascher) > 8. Re: Auto-responder -- request for comments (Ivan Van Laningham) > 9. Re: Initializing Tupples (Jonathon) > 10. Re: Initializing Tupples (Joseph J. Strout) > 11. Re: help (Stephen) > 12. RE: how do I get pythons GUI to work (Billy) > 13. how do I get the python GUI to work (Billy) > > --__--__-- > > Message: 1 > From: "Kapil Malhotra" > To: tutor@python.org > Date: Thu, 26 Aug 1999 23:24:49 PDT > Subject: [Tutor] Getting Started > > This is Kapil Malhotra from India. I need to learn Python for my project. My > mail ID is malhotra_kapil@hotmail.com . Please send me any stuff which I > might find useful. > > Regards, > > Kapil > > ______________________________________________________ > Get Your Private, Free Email at http://www.hotmail.com > > --__--__-- > > Message: 2 > From: alan.gauld@bt.com > To: markm@lineo.com, tutor@python.org > Subject: RE: [Tutor] Python question for beginners... > Date: Fri, 27 Aug 1999 09:50:13 +0100 > > > I am doing a cgi script. I need the script to execute a program and > > return the program output as a variable preferably. > > I tried using os.system("/usr/local/bin/program") but that > > Look at os.popen(...) > > BUT the other issue in CGI work is that your program will > execute as the cgi or www user. Often that user has very > restricted access to system commands and files (for good > security reasons!) > > > to work from within the script. It works in the python interpretor > > That could be the security restriction above.... > > > not within the script. Maybe the os.execv command???I don't > > Almost certainly not - unless you os.fork() first. > execv will *replace* your Python program with whatever > program you execute. > > Alan G. > > --__--__-- > > Message: 3 > Date: Fri, 27 Aug 1999 07:33:16 -0700 > To: "Kapil Malhotra" , tutor@python.org > From: "Joseph J. Strout" > Subject: Re: [Tutor] Getting Started > > At 11:24 PM -0700 08/26/99, Kapil Malhotra wrote: > >This is Kapil Malhotra from India. I need to learn Python for my > >project. My mail ID is malhotra_kapil@hotmail.com . Please send me > >any stuff which I might find useful. > > That's not how it works. The "stuff you might find useful" is all at > http://www.python.org. This mailing list is for specific topics and > questions -- when you have one, ask it, and you'll get an answer. > > Cheers, > -- Joe > > ,------------------------------------------------------------------. > | Joseph J. Strout Biocomputing -- The Salk Institute | > | joe@strout.net http://www.strout.net | > `------------------------------------------------------------------' > > --__--__-- > > Message: 4 > From: Aaron Marzec > To: tutor@python.org > Date: 26 Aug 99 22:15:11 -0500 > Subject: [Tutor] help > > can you give me some tips on your python software v1.52 > > P.S Im a newbie > > ________________________________________________________ > NetZero - We believe in a FREE Internet. Shouldn't you? > Get your FREE Internet Access and Email at > http://www.netzero.net/download/index.html > > --__--__-- > > Message: 5 > Date: Fri, 27 Aug 1999 12:47:38 -0500 (CDT) > From: Tim Wilson > To: Aaron Marzec > cc: tutor@python.org > Subject: Re: [Tutor] help > > On 26 Aug 1999, Aaron Marzec wrote: > > > can you give me some tips on your python software v1.52 > > > > P.S Im a newbie > > You might want to start with the Python Tutorial at > http://www.python.org/doc/current/tut/tut.html > > If you're interested in books, I would recommend "Learning Python" by > Lutz, Ascher, and Willison from O'Reilly and Associates. You can get it at > Amazon at > http://www.amazon.com/exec/obidos/ASIN/1565924649/o/qid=935775937/sr=8-1/002-5025541-6796200 > > Have fun. > > -Tim > > -- > Timothy Wilson | "The faster you | Check out: > Henry Sibley H.S. | go, the shorter | http://slashdot.org/ > W. St. Paul, MN, USA | you are." | http://linux.com/ > wilson@chem.umn.edu | -Einstein | http://www.mn-linux.org/ > > --__--__-- > > Message: 6 > Date: Fri, 27 Aug 1999 10:49:36 -0700 > To: Aaron Marzec , tutor@python.org > From: "Joseph J. Strout" > Subject: Re: [Tutor] help > > At 10:15 PM -0500 08/26/99, Aaron Marzec wrote: > > >can you give me some tips on your python software v1.52 > > Sure, ask a specific question and you'll get a specific answer. Ask > a general answer like this and you'll get a general answer like "Read > the docs and experiment." ;) > > Cheers, > -- Joe > > ,------------------------------------------------------------------. > | Joseph J. Strout Biocomputing -- The Salk Institute | > | joe@strout.net http://www.strout.net | > `------------------------------------------------------------------' > > --__--__-- > > Message: 7 > Date: Fri, 27 Aug 1999 12:04:20 -0700 (Pacific Daylight Time) > From: David Ascher > To: tutor@python.org > Subject: [Tutor] Auto-responder -- request for comments > > I'm going to add an autoresponder which will be sent to folks who are > posting to the tutor list for the first time in a long time. Here is my > first draft of the message. If anyone has any edits they'd like to see > happen, let me know. > > --david > > Your message for tutor@python.org, the Python programming tutor list, > has been received and is being delivered. This automated response is > sent to those of you new to the Tutor list, to point out a few > resources that can help with answering your own questions, or improve > the chances of getting a useful answer from the other subscribers. > > If your question is something akin to: > > "I've just heard about Python, and it sounds great! Where can I > find out more on how to program with Python?" > > or: > > "What's Python?" > > please read section 1 below. > > On the other hand, if your question is: > > "I've heard that Python is good for hacking -- I want to know more!" > > or > > "Can you teach me how to break into a computer with Python?" > > please read section 2 at the bottom of this email. > > Section 1: > ---------- > > The most comprehensive overview of python.org help resources is at > http://www.python.org/Help.html . The Python FAQ is available at > http://www.python.org/doc/FAQ.html and it has answers to many > questions that people ask, possibly including your question. Another > wealth of information and experience can be found via the python.org > searches, at http://www.python.org/search/ . There you'll find > comprehensive, easy-to-use searches over the python.org web site and > the python newsgroup (comp.lang.python, also available as a mailing > list, python-list@python.org). > > Finally, when you do send email to the Tutor list, be as clear as you > can about the problem, including, when relevant, details like: > > - Precise error messages, including complete tracebacks > - The hardware platform (available in the Python sys module as sys.platform) > - The python version (sys.version) > - The python search path (sys.path) > > In general, be specific about what was going on connected with the > problem or what specific concept you're having difficulties with. The > better the info you provide, the more likely the helpers will be able > to glean the answer... > > Note that no one is paid to read the tutor list or provide answers, > and most readers often have other work that demands their attention. > Well-posed requests for help are usually answered fairly promptly, but > occasionally a request slips by, so if you do not get a response with > one or two working days (it's usually quicker than that), please feel > free to send a followup, asking whether anyone is working on your > question. > > Anyway, your message is being delivered to the Tutor list as this one > is being sent. However, if your question was about as detailed as > "Teach me how to program in Python", do not count on an answer -- this > email contains all the information you need to start. Come back with > a more precise question, and we'll be glad to help. > > Thanks! > > Section 2: > ---------- > > We often get requests which ask about hacking or cracking or breaking > into computers. If you haven't yet, go read Eric Raymond's seminal > article "How To Become a Hacker" > (http://www.tuxedo.org/~esr/faqs/hacker-howto.html). If you want help > learning how to hack the way Eric defines the word, then come back to > us (and read Section 1 above). If you want help learning how to > crack, go look elsewhere -- we're not interested in helping you do > that. > > --__--__-- > > Message: 8 > Date: Fri, 27 Aug 1999 13:27:49 -0600 > From: Ivan Van Laningham > Organization: Callware Technologies, Inc. > CC: tutor@python.org > Subject: Re: [Tutor] Auto-responder -- request for comments > > Hi All-- > > David Ascher wrote: > > > > I'm going to add an autoresponder which will be sent to folks who are > > posting to the tutor list for the first time in a long time. Here is my > > first draft of the message. If anyone has any edits they'd like to see > > happen, let me know. > > > > A good idea! > > [bobbitt] > > However: > > > > > Section 2: > > ---------- > > > > We often get requests which ask about hacking or cracking or breaking > > into computers. If you haven't yet, go read Eric Raymond's seminal > > article "How To Become a Hacker" > > (http://www.tuxedo.org/~esr/faqs/hacker-howto.html). > > Well, I take issue with the word "seminal" here. Webster's online says: > > Main Entry: sem·i·nal > Pronunciation: 'se-m&-n&l > Function: adjective > Etymology: Middle English, from Middle French, from Latin seminalis, > from semin-, semen seed -- more at SEMEN > Date: 14th century > 1 : of, relating to, or consisting of seed or semen > 2 : containing or contributing the seeds of later development : > CREATIVE, ORIGINAL great poets> > - sem·i·nal·ly /-n&l-E/ adverb > > I would suggest "important," "influential," "creative," or possibly > even "ovular." The last has the same sense of containing or > contributing the seeds of later development, but from a slightly > different perspective;-) > > -ly y'rs, > Ivan;-) > ---------------------------------------------- > Ivan Van Laningham > Callware Technologies, Inc. > ivanlan@callware.com > ivanlan@home.com > http://www.pauahtun.org > See also: > http://www.foretec.com/python/workshops/1998-11/proceedings.html > Army Signal Corps: Cu Chi, Class of '70 > ---------------------------------------------- > > --__--__-- > > Message: 9 > Date: Fri, 27 Aug 1999 19:46:12 +0000 (UTC) > From: Jonathon > To: tutor@python.org > Subject: Re: [Tutor] Initializing Tupples > > On Wed, 25 Aug 1999, Joseph J. Strout wrote: > > >So there must be a difference between what you're telling us, and > > Source code from the program I am writing is available at > http://www.stamp-coin.com/python/script-error/index.html > > >copy of Python is seriously screwed up (unlikely). Or, this error > >occurs not on the code you gave us, but on later code where you try > >to... > > Possible. > > >Well, you can't. You need to use a list for that; tuples are immutable. > > Let's see if I understand the difference between lists and > tuples. > > Once a Tuple is created, it can not be changed. > Once a List is created, both it, and its contents can > be changed --- increased, decreased etc. > > IE: > > Example_Tuple = ( "joe"0, "curly", "moe" ) > and Example_Tuple retains that value for the duration > of the program. > > Example_List = [ "joe", "curly", "moe" ] > > Example_List[0] = "larry" > > Changes the 0 element to larry. > > Example_List.insert(3, "joe") > > Adds "joe" to the list, as the third element. > > Example_List[3] = 2 > > Makes that a number, instead of a string. > > << All this appears to work at the python prompt. >> > > xan > > jonathon > > --__--__-- > > Message: 10 > Date: Fri, 27 Aug 1999 13:19:28 -0700 > To: Jonathon , tutor@python.org > From: "Joseph J. Strout" > Subject: Re: [Tutor] Initializing Tupples > > At 7:46 PM +0000 08/27/99, Jonathon wrote: > > > Let's see if I understand the difference between lists and > > tuples. > > > > Once a Tuple is created, it can not be changed. > > Once a List is created, both it, and its contents can > > be changed --- increased, decreased etc. > > Yep, that's it. (And, for the record, strings are just like tuples.) > > > Example_Tuple = ( "joe", "curly", "moe" ) > > and Example_Tuple retains that value for the duration > > of the program. > > Well, not exactly -- you could easily rebind Example_Tuple to > something else, e.g.: > > Example_Tuple = Example_Tuple[:2] # keep only the first two items > or > Example_Tuple = Example_Tuple + ("larry", "guido") # append two items > > These work because the slice operator [:] or the addition operator > creates a *new* tuple, rather than modifying the old one in place; > and then this new tuple is bound to the name "Example_Tuple". Does > this make sense? > > Cheers, > -- Joe > > ,------------------------------------------------------------------. > | Joseph J. Strout Biocomputing -- The Salk Institute | > | joe@strout.net http://www.strout.net | > `------------------------------------------------------------------' > > --__--__-- > > Message: 11 > Date: Fri, 27 Aug 1999 18:15:59 -0400 (EDT) > From: Stephen > To: Tim Wilson > cc: Aaron Marzec , tutor@python.org > Subject: Re: [Tutor] help > > I just picked up python in the last few weeks and started scripting @ work. Take > my word for it... skip 'Learning Python' and go directly to 'Programming Python' > if you're already versed in another scripting language (perl/shell/etc). > > The 'Learning Python' book put me to sleep... > > /***************************************************************\ > * Stephen ("xinu") Klassen -- Unix Systems Administrator * > * Website: http://stephen.webadmins.com/ UIN: 19224641 (wk) * > \***************************************************************/ > > On Fri, 27 Aug 1999, Tim Wilson wrote: > > > On 26 Aug 1999, Aaron Marzec wrote: > > > > > can you give me some tips on your python software v1.52 > > > > > > P.S Im a newbie > > > > You might want to start with the Python Tutorial at > > http://www.python.org/doc/current/tut/tut.html > > --__--__-- > > Message: 12 > From: "Billy" > To: > Date: Fri, 27 Aug 1999 23:46:02 -0400 > charset="iso-8859-1" > Subject: [Tutor] RE: how do I get pythons GUI to work > > I am running win98 when I click on the python GUI the Herd drive works but > the program never starts I can only use the command line > Billy Estes How could I get characters one by one from stdin without using "curses" module? Is there any way to check the input every time the user press a key? -- ~ Daniel Gau 'v' Linux Notes http://www.linux.org.tw/~plateau/linux_notes/index.htm // \\ H-Zone http://www.linux.org.tw/hardware/index.php3 /( )\ TwLUG http://www.linux.org.tw/ ^`~'^ ICQ Number 30932232 From joe@strout.net Sat Aug 28 21:54:31 1999 From: joe@strout.net (Joseph J. Strout) Date: Sat, 28 Aug 1999 13:54:31 -0700 Subject: [Tutor] Fractals using Python In-Reply-To: Message-ID: At 3:33 PM -0700 8/28/99, Vidyasagar Govind wrote: >I am a newbie to Python, and really like it especially with >its numerical extensions. Yes, it's quite good at this sort of thing. >Can Python be used for plotting outputs from mathematical >formulae? But of course! There are a number of plotting packages, none of them very satisfactory though IMHO. (That includes Graphite, the one I'm working on -- it's progressing too slowly this summer, but should pick up soon.) >I used to use VB for plotting the output of fractal >formulae using simple commands for drawing lines, circles,etc. >Does Python have equivalent commands/modules? If so where can I >get them? The closest equivalent in Python is PIDDLE, which is a cross-platform (and multi-output) drawing API available at http://www.strout.net/python/piddle . If you have any trouble with it, ask me or post to the python-piddle mailing list (described on the web site). Good luck, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From eroubinc@u.washington.edu Sun Aug 29 23:59:38 1999 From: eroubinc@u.washington.edu (Evgeny Roubinchtein) Date: Sun, 29 Aug 1999 15:59:38 -0700 (PDT) Subject: [Tutor] TCL fileevent --> Python ??? Message-ID: I am teaching myself Tkinter by rewriting the examples in "Practical Programming in TCL and Tk" in Python. They have a sample application which runs a command and captures and displays the commands output in a Text widget. The user types the command in an Entry widget, clicks the "Run" button and then "it cooks". I am stuck on translating the "Run" button's callback; the TCL code is: proc Run {} { global command input log btnRun # command -- is the text user typed in the Entry widget # log -- is the Text widget in which the command's output is captured # btnRun -- is the "Run" button if [catch {open "| $command |& cat"} input] { # some kind of error happened $log insert end $input\n } else { # opened the pipe OK fileevent $input readable Log # call Log whenever something # comes in from the pipe # how do you say something similar # in Python? $log insert end $command\n $btnRun config -text Stop -command Stop } } Well, I am sort of stumped on translating "fileevent": looking at its man page, it behaves just like the TK/Tkinter's "bind" method, except that "bind" calls a procedure when there's an X event, and "filevent" calls procedure when some input is waiting to be read, so the read won't 'block', so the application doesn't look "frozen" to the user. Looking through Python library I didn't find anything I could use "out of the box", I think if I started a new thread (or used fork) I could have one process/thread handling the input from the pipe and the other handling the button clicks -- I will play with that idea but if this sounds like something someone has done before, I would love to hear from them. Thank you -- Evgeny Roubinchtein, eroubinc@u.washington.edu ................... ..... REALITY.SYS Corrupted - Unable to recover Universe From davidscards@hotmail.com Mon Aug 30 12:30:40 1999 From: davidscards@hotmail.com (david dumore) Date: Mon, 30 Aug 1999 04:30:40 PDT Subject: [Tutor] Teach Me Message-ID: <19990830113041.39485.qmail@hotmail.com> Hello I got a question. Ok someone must of figured out my password to my other hotmail account that I use along with this one .I can not log into it. Is there any way that I could hack into it and change my password in my preferences? Is there any way that I could decode the password that someone has set it to without my knowing? Is there anyway to hack or figure out the secret question that this person has set my account to? I need help! I want to access to other e-mail account! Thanks David ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com From TomJenkins@zentuit.com Mon Aug 30 13:39:37 1999 From: TomJenkins@zentuit.com (Tom Jenkins) Date: Mon, 30 Aug 1999 08:39:37 -0400 Subject: [Tutor] Teach Me In-Reply-To: <19990830113041.39485.qmail@hotmail.com> Message-ID: <199908301136.HAA17081@asprin.zentuit.com> Here's what you do - 1) call up hotmail and explain it to them; 2) expect a call from South East Regional Network (searnet.com) in Danville, KY and explain to them why your using your account with them in possible violation of your agreement. From: "david dumore" To: alan.gauld@bt.com, tutor@python.org Subject: RE: [Tutor] Teach Me Date sent: Mon, 30 Aug 1999 04:30:40 PDT > Hello I got a question. > Ok someone must of figured out my password to my other hotmail account that > I use along with this one .I can not log into it. Is there any way that I > could hack into it and change my password in my preferences? Is there any > way that I could decode the password that someone has set it to without my > knowing? Is there anyway to hack or figure out the secret question that this > person has set my account to? > I need help! I want to access to other e-mail account! > Thanks > David > > ______________________________________________________ > Get Your Private, Free Email at http://www.hotmail.com > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://www.python.org/mailman/listinfo/tutor -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Tom Jenkins DevIS (http://www.devis.com) And the No. 1 response that you'll need to memorize if you plan to bet your business on Windows 2000: "You want fries with that?" - Nickolas Petreley, InfoWorld, August 23, 1999 "Do not be overcome by evil, but overcome evil with good." Romans 12:21 From seanconway@home.com Mon Aug 30 23:24:42 1999 From: seanconway@home.com (Sean Conway) Date: Mon, 30 Aug 1999 15:24:42 -0700 Subject: [Tutor] 1.5.1 -> 1.5.2 cgi.Fieldstorage Message-ID: <001301bef336$74a66cc0$0528a8c0@home> Hello everyone. I am experimenting with Python + CGI, using Apache 1.3.6 and PyApache. I was using Python 1.5.1 with no problems. However, when I tried to upgrade to Python 1.5.2, the script below stopped working. Reverting back to 1.5.1 made the error go away. Here is the script that fails with 1.5.2, and the error it generates: ---script--- import cgi, string input = open('/home/httpd/cgi-bin/data', 'r').readlines() form = cgi.FieldStorage() print "Content-type: text/html\n\nTest" print "You voted for option: ", form["PRstats"].value, "

Current votes:

" x = string.atoi(form["PRstats"].value) input[x] = str(string.atoi(input[x]) + 1) + "\n" print "Votes for option 0: ", input[0], "

Votes for option 1: ", input[1], "

Votes for option 2: ", input[2], "

Votes for option 3: ", input[3] open('/home/httpd/cgi-bin/data', 'w').writelines(input) print "" ---error--- Traceback (innermost last): File "/home/httpd/cgi-bin/test2.py", line 3, in ? form = cgi.FieldStorage() File "/usr/lib/python1.5/cgi.py", line 792, in __init__ method = string.upper(environ['REQUEST_METHOD']) TypeError: impossible, string This is a simple voting script that is 1/2 finished. What has changed in Python 1.5.2 with regards to cgi.FieldStorage()? I suppose it is possible that the RPM I d/led of Python 1.5.2 is partly corrupted, although I don't think that is very likely. Thanks in advance, Sean Conway P.S. Thanks to everyone who helped me out with my previous problem. From bwarsaw@cnri.reston.va.us (Barry A. Warsaw) Tue Aug 31 22:50:03 1999 From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw) (Barry A. Warsaw) Date: Tue, 31 Aug 1999 17:50:03 -0400 (EDT) Subject: [Tutor] Testing new replybot text Message-ID: <14284.19979.526165.584290@anthem.cnri.reston.va.us> Please ignore. From bwarsaw@cnri.reston.va.us (Barry A. Warsaw) Tue Aug 31 22:59:58 1999 From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw) (Barry A. Warsaw) Date: Tue, 31 Aug 1999 17:59:58 -0400 (EDT) Subject: [Tutor] second test Message-ID: <14284.20574.616716.310597@anthem.cnri.reston.va.us> please ignore. seeing if the graceperiod works.