Re: [Tutor] SSL Error

2018-08-03 Thread Terry Carroll
't tell. Also, before your "import requests" line, include these: import sys print(sys.version) After the "import requests" line, include this: print(requests.__version__) -- Terry Carroll carr...@tjc.com ___ Tutor maillis

Re: [Tutor] Wish to upgrade Python 3.6.5 to Python 3.6.6 for Linux Mint 19

2018-07-15 Thread Terry Carroll
t broken, don't fix it" theory. That being said, if you do want to update to the latest version available for Mint, this command should do it for you: sudo apt-get install --only-upgrade python3 If Mint doesn't have a vetted 3.6.6 yet, I would leave it alone. --

Re: [Tutor] Regex not working as desired

2018-02-27 Thread Terry Carroll
On Mon, 26 Feb 2018, Terry Carroll wrote: Instead of looking fo re xcaprions.. Wow. That should read "Instead of looking for exceptions..." Something really got away from me there. -- Terry Carroll carr...@tjc.com ___ Tutor maillist

Re: [Tutor] Regex not working as desired

2018-02-27 Thread Terry Carroll
t;4k33", "4jjk4", "4334", "4","44", "444", ""] for thing in test_data: m = p.match(thing) if m is None: print("not all digits:", thing) else: print("all digits:", thing) -- Terry Carroll carr...@tjc.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Java equivalent of Python-Tutor?

2018-02-07 Thread Terry Carroll
but I hope the blatantly obsequious sucking up at the beginning of my note makes up for it.) -- Terry Carroll carr...@tjc.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Pasting an image with transparency

2017-06-02 Thread Terry
On 06/02/2017 08:31 AM, Peter Otten wrote: Terry wrote: We read the docstring so you don't have to ;) I have to remember to utilize available help functions... my bad. from PIL import Image image = Image.open("sample.jpg") # some random pic I have lying around help(image.

[Tutor] Pasting an image with transparency

2017-06-01 Thread Terry
, sig.size, sig.mode) box = (768, 616, 1018, 662) enh.paste(sig, box) enh.show() -- Terry "Hoots" To stay young, never lose your sense of wonder. * My main photo gallery can be seen at: http://www.flickr.com/photos/

[Tutor] New to Python, Already Confused

2016-09-20 Thread Gampper, Terry
t. My conclusion is that if the score is <100, the lowest score is properly displayed, but if the score is >=100, then the lowest score is equal to the highest score. Doesn't make sense to me. Do you have any ideas? Thanks! -- Terry Gampper Adjunct INFO Instructor Metropolitan

Re: [Tutor] Learning Regular Expressions

2016-05-30 Thread Terry--gmail
Thanks Alan I noticed that I was using some double ' to encircle some things and some single ' for apostrophes in contractionsand fixed those...but apparently since you could run it, that part didn't matter. The problem was ultimately caused by a stray ''' which was a fragment of me messin

Re: [Tutor] Logging exceptions, but getting stderr output instead

2016-05-26 Thread Terry Carroll
On Wed, 25 May 2016, Alex Hall wrote: You're not missing anything; I wasn't clear. I wasn't sure if raise or sys.exit(1) were the preferred ways, or if there was some other way I didn't know about. If you're aborting because of the exception after unsuccessfully trying to handle it, you can a

[Tutor] Learning Regular Expressions

2016-05-24 Thread Terry--gmail
$ ^ ( ) { } | \ if you really want to use these, you must escape them '\' ''' Thanks for your thoughts! --Terry ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Getting started in testing

2016-05-24 Thread Terry Carroll
Thanks to Alan, Danny, Albert-Jan and Ben for their suggestions. I've now gotten my feet wet in unittest and have gone from not quite knowing where to start to making substantial progress, with a small suite of tests up and running. ___ Tutor maillist

[Tutor] Getting started in testing

2016-05-19 Thread Terry Carroll
Is anyone aware of any good tutorials on testing one's Python code? These days, I'm a hobby programmer, writing little things just for my own use, and don't really sweat testing much. But I do have one niche open-source project where I need to be a bit more regimented, and specifically need to

Re: [Tutor] sqlite

2016-05-17 Thread Terry Carroll
On Tue, 3 May 2016, Crusier wrote: I am just wondering if there is any good reference which I can learn how to program SQLITE using Python I can not find any book is correlated to Sqlite using Python. "The Definitive Guide to SQLite" is about SQLite, but includes a chapter on both PySQLite a

[Tutor] Plotting with python

2015-10-30 Thread Terry Carroll
If you were going to get started doing some simple plotting with Python 2.7 (in my case, I'm simply plotting temperature against time-of-day) what would you use? - matplotlib [1] - gnuplot [2] - something else entirely? Assume no substantial familiarity with the underlying plotting softwar

Re: [Tutor] Building Starships -- object of type 'int' has no len()

2014-08-20 Thread Terry--gmail
Thanks Japhy Bartlett! [[0] for i in range(5)] Works! I converted to fit into my routine as: lens = [[] for i in range(len(catalog2[0]))] << the new statement for row in catalog2: for col, item in enumerate(row): lens[col].append(len(item)) lens = [max(col) for col in lens]

Re: [Tutor] Building Starships -- object of type 'int' has no len()

2014-08-20 Thread Terry--gmail
lens = [max(col) for col in lens] --Terry IT WORKS! I just don't know how to automatically format lens with enough [] like I was able to tell On 08/20/2014 02:56 PM, Marc Tompkins wrote: On Wed, Aug 20, 2014 at 1:38 PM, Terry--gmail wrote: Marc, my understanding

Re: [Tutor] Building Starships -- object of type 'int' has no len()

2014-08-20 Thread Terry--gmail
that, that statement would put the entire block of element sizes into one list, and the next MAX statement would then yield only a single number, which would be the largest size element it encounted in the whole of catalog2! Or am I really missing the boat here? :) Thanks for your thoughts! --

Re: [Tutor] Building Starships -- object of type 'int' has no len()

2014-08-20 Thread Terry--gmail
Alan Gauld Hi! We are not quite out of the woods on this last example you gave me. It now seems to be complaining that it doesn't want to append an integer to the list or that this isn't the place to use '.append' -- I am probably interpreting it's complaint wrong: Python 3.3 If I run this

Re: [Tutor] Building Starships -- object of type 'int' has no len()

2014-08-19 Thread Terry--gmail
The down side of setting the python.org domain to be mailed to as plain text, appears to be that Thunderbirdy has changed all my email to plain text, instead of just the email going to this domainwhich is weird. Leam Hall: I have just one additional function to create in the User Design se

Re: [Tutor] Building Starships -- object of type 'int' has no len()

2014-08-17 Thread Terry--gmail
ly typed 4 spaces. SO, I have typed the lines below in manually: for line_number, row in enumerate(catalog2): for col, item in enumerate(row): if lens[col] < len(item): lens[col] = len(item) How's that? --Terry ___ Tutor

Re: [Tutor] Building Starships -- object of type 'int' has no len()

2014-08-17 Thread Terry--gmail
I found another place in Thunderbirdy to set 'plain text'. This is a test. Does the below code look correct now? --And did I reply correctly this time? (Reply-All and keep only tutor@python.org address...) for line_number, row in enumerate(catalog2): for col, item in enumerate(row): if le

[Tutor] Building Starships -- object of type 'int' has no len()

2014-08-17 Thread Terry--gmail
17, 5, 9, 12, 7, 0, 0, 0] <<-that is the correct answer. Did I do this correctly? Or, was there a way to compact it more? What have we gained? We have grabbed the entire row of data, and then looped through it without setting indexes when referring to the parts of each line...t

[Tutor] Building Starships -- object of type 'int' has no len()

2014-08-15 Thread Terry--gmail
Thanks for your response JL. I added the following Exception to the code snippet: for line_number in range(len(catalog2)): for col in range(len(catalog2[line_number])): try: if lens[col] < len(catalog2[line_number][col]): lens[col] = len(catalog2[line_number][col]) except TypeError: print(

[Tutor] Building Starships -- object of type 'int' has no len()

2014-08-15 Thread Terry--gmail
Python 3.3 This has something to do with the nature of FOR statements and IF statements, and I am sure it must be a simple mistake...but I seem to be stumped. I am writing a starship encounter program as my first real python programwhere the user gets a random amount of credits to design

Re: [Tutor] Your confirmation is required to leave the Tutor mailing list

2014-02-10 Thread Terry Carroll
On Mon, 10 Feb 2014, tutor-confirm+c3fa710640d780363ebaec9fd955eefa81f1b...@python.org wrote: Mailing list removal confirmation notice for mailing list Tutor We have received a request for the removal of your email address, "carr...@tjc.com" from the tutor@python.org mailing list. To confirm

Re: [Tutor] How can a CGI program get the URL that called it?

2014-01-10 Thread Terry Carroll
On Sat, 11 Jan 2014, Steven D'Aprano wrote: However, if you pass a path using \ to posixpath, it treats them as non-separators: That's apparenbtly what's happening. I didn't investigate much, once I found out that using posixpath didn't address the issue I was having; using replace() was pr

Re: [Tutor] How can a CGI program get the URL that called it?

2014-01-10 Thread Terry Carroll
Ah, I discovered what my problem was... On Fri, 10 Jan 2014, Alan Gauld wrote: its calling your file. You should know where your file is? My problem was that, I know where the file is in the host's file system, and relative to my CGI program. I do not have a URL to that file. If you want

[Tutor] How can a CGI program get the URL that called it?

2014-01-10 Thread Terry Carroll
How can my Python 2.7 CGI program find the URL that caused the program to be called? I have a program that creates a JPG or PNG file on the fly, and needs to construct a URL to it. I know the path relative to my program is, for example, "../temp/tmpiicack.png" (the filename generated by tempf

[Tutor] How to get nested boundaries in Multipart email

2013-12-15 Thread Mark Terry
Hello all, I'm trying to script email from database data. Following the examples at http://docs.python.org/3.3/library/email-examples.html I'm able to send simple emails, multipart emails with attachments, and multipart emails with alternative text. What I'm trying to do now is get multipart em

Re: [Tutor] Which computer operating system is best for Python developers?

2012-03-02 Thread Terry Carroll
(Re Python on Windows 7) On Thu, 23 Feb 2012, Tim Golden wrote: On 23/02/2012 09:00, Alan Gauld wrote: If you do a reinstall, download the ActiveState version rather than the Python.org version. I also recommend the ActiveState distro. I am going to "third" Alan's and Tim's recommendation

Re: [Tutor] Stacks and Stack underflow/Stack overflow

2011-11-19 Thread Terry Carroll
On Sat, 19 Nov 2011, Joe Batt wrote: Hi All  Could some kind soul please explain why you get a stack underflow and a stack overflow. I am getting the following error in Python 3 Traceback (most recent call last):   File "/Users/joebatt/Desktop/python/pickling puzzle 5.py", line 39, in     a=p

Re: [Tutor] The Perennial 3.2 vs 2.7

2011-11-19 Thread Terry Carroll
On Thu, 17 Nov 2011, Wayne Werner wrote: On Thu, Nov 17, 2011 at 8:45 PM, Mark Lybrand wrote: so, use my 2.7 and not my 3.2 for my study? Or use my 3.2 for study and then do what I have to in 2.7 after including those lines? Honestly it probably doesn't matter. Many 3rd part

Re: [Tutor] regexp

2011-11-06 Thread Terry Carroll
On Sat, 5 Nov 2011, Dinara Vakhitova wrote: I need to find the words in a corpus, which letters are in the alphabetical order ("almost", "my" etc.) I started with matching two consecutive letters in a word, which are in the alphabetical order, and tried to use this expression: ([a-z])[\1-z], but

Re: [Tutor] Assigning variables with names set by other variables

2011-11-04 Thread Terry Carroll
On Fri, 4 Nov 2011, Max S. wrote: Is it possible to create a variable with a string held by another variable in Python?  For example, It's possible, but in almost all cases where this comes up, the better approach is to use a dictionary.___ Tutor ma

Re: [Tutor] Mailing list archive oddity?

2011-09-29 Thread Terry Carroll
On Thu, 29 Sep 2011, Hugo Arts wrote: * someone from the future is in need of python help and is sending messages back in time. I'm betting this is Guido and his time machine again. ___ Tutor maillist - Tutor@python.org To unsubscribe or change sub

[Tutor] xrange() with start or stop > sys.maxint?

2011-05-18 Thread Terry Carroll
Is there any way to use xrange with a start or stop value that exceeds sys.maxint? import sys print sys.maxint 2147483647 start = sys.maxint-1 for i in xrange(start, start+1): ... pass ... start = sys.maxint for i in xrange(start, start+1): ... pass ... Traceback (most recent call last

Re: [Tutor] Overriding a method in a class

2011-05-15 Thread Terry Carroll
On Sat, 14 May 2011, Alan Gauld wrote: Is there any reason you can'tt override in the uisual way by inheritance? Doh! Of course I should. I've written plenty of classes before, but never one intended to be inherited, and now that you point it out, it's obvious that that's what I should be

Re: [Tutor] Overriding a method in a class

2011-05-13 Thread Terry Carroll
On Fri, 13 May 2011, Terry Carroll wrote: For my specific case, I'm going to go with a Plan B of using callbacks; and provide default unbound callbacks present in the module, but not defined in the class itself. Here's a callback-with-default approach, which works: ##

Re: [Tutor] Overriding a method in a class

2011-05-13 Thread Terry Carroll
referencing an unbound method, and does not insert the self reference into the argument list. Now I'll wait for one of the experts to edify me. On Fri, 13 May 2011, Terry Carroll wrote: I have a pretty basic point of confusion that I'm hoping I can have explained to me. I have a c

Re: [Tutor] Overriding a method in a class

2011-05-13 Thread Terry Carroll
On Fri, 13 May 2011, Terry Carroll wrote: What I *expect* is to see ['abcdefg'] printed. What I get is: Sorry, mixed multiple examples; What I had expected was ['wxyz']. Still the same question though. BTW, I forgot to mention: Python 2.7.1, under Windows. (St

[Tutor] Overriding a method in a class

2011-05-13 Thread Terry Carroll
I have a pretty basic point of confusion that I'm hoping I can have explained to me. I have a class in which I want to override a method, and have my method defined externally to the class definition invoked instead. But when I do so, my external method is invoked with a different argument sig

Re: [Tutor] module to parse XMLish text?

2011-01-14 Thread Terry Carroll
On Fri, 14 Jan 2011, Stefan Behnel wrote: Terry Carroll, 14.01.2011 03:55: Does anyone know of a module that can parse out text with XML-like tags as in the example below? I emphasize the "-like" in "XML-like". I don't think I can parse this as XML (can I?). Sampl

[Tutor] module to parse XMLish text?

2011-01-13 Thread Terry Carroll
Does anyone know of a module that can parse out text with XML-like tags as in the example below? I emphasize the "-like" in "XML-like". I don't think I can parse this as XML (can I?). Sample text between the dashed lines:: - Blah, blah, blah SOMETHING ELSE

Re: [Tutor] Writing to the terminal?

2010-12-12 Thread Terry Carroll
On Mon, 13 Dec 2010, Steven D'Aprano wrote: Which operating system and terminal did you use? In my experience, using print is not satisfactory... You're right; it worked under Windows, but not under Linux. Given the other details of the question, my suggestion is not an adequate solution.

Re: [Tutor] Writing to the terminal?

2010-12-12 Thread Terry Carroll
On Fri, 10 Dec 2010, Modulok wrote: Assume I'm working in a command shell on a terminal. Something like tcsh on xterm, for example. I have a program which does *something*. Let's say it counts down from 10. How do I print a value, and then erase that value, replacing it with another value? Say I

Re: [Tutor] Meaning of -1 in Python

2010-12-10 Thread Terry Carroll
On Fri, 10 Dec 2010, Alan Gauld wrote: "Ben Ganzfried" wrote n = s.find('not') b = s.find('bad') if n != -1 and b != -1 and b > n: s = s[:n] + 'good' + s[b+3:] return s It's clear that n!=-1 and b!=-1 means something like : "if in the string 's' we find the word "not" and in string 's

Re: [Tutor] Which non SQL Database ?

2010-12-08 Thread Terry Carroll
On Sat, 4 Dec 2010, Jorge Biquez wrote: What would do you suggest to take a look? If possible available under the 3 plattforms. I would second the use of SQLite. It's built into Python now, on all platforms. But you specified "non SQL", so one other thing I'd suggest is to just create the

Re: [Tutor] Question on tkinter event binding

2010-12-03 Thread Terry Carroll
On Fri, 3 Dec 2010, Albert-Jan Roskam wrote: I'm trying to make a small improvement on a data entry program and it is literally giving me a headache. Followed shortly thereafter with: On Fri, 3 Dec 2010, Albert-Jan Roskam wrote: Aaahhh, got it! Peace! ... I'll paste the working code below. I

Re: [Tutor] Pyserial and invalid handle

2010-12-02 Thread Terry Carroll
On Wed, 1 Dec 2010, Walter Prins wrote: But whatever the case may be, suffice it to say I've reproduced your issue on my Win7 64bit box, and then resolved it by installing the PyWin32 modules. I'd like to put in a plug for Activestate Python here. Activestate has a free distribution of Pytho

Re: [Tutor] Python and Tkinter Programming by Grayson--New Version?

2010-11-28 Thread Terry Carroll
On Thu, 25 Nov 2010, Alan Gauld wrote: "Yves Dextraze" wrote Sent from my iPod There is no mention on Amazon of any new editions and they usually announce several months in advance... A pity a new Tkinter book using Tix and ttk instead of PMW would be a really useful resource! Odd -- Y

Re: [Tutor] %T as a strftime format identifier

2010-11-27 Thread Terry Carroll
On Sat, 27 Nov 2010, Steven D'Aprano wrote: [st...@sylar ~]$ python2.5 Python 2.5 (r25:51908, Nov 6 2007, 16:54:01) [GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2 Type "help", "copyright", "credits" or "license" for more information. import time time.strftime("%T") '19:03:16' Interesting

[Tutor] %T as a strftime format identifier

2010-11-26 Thread Terry Carroll
Was %T ever a valid format specifier for time.strftime in Python? I just installed a Python streaming MP3 server called Edna (http://edna.sourceforge.net/). It was an easy install except that I got a ValueError on one line, essentially for: time.strftime("%a, %d %b %Y %T GMT") After a few

[Tutor] wxPython, Tkinter (was: program hangs in while loop using wx.yield

2010-11-16 Thread Terry Carroll
On Tue, 16 Nov 2010, Patty wrote: Hi Terry - I am an alumni of UCSC (University of California, Santa Cruz) and live really close so I can request books throughout the UC system just like you describe and there is no limit - or maybe an extremely high limit - to the number of books I can check

Re: [Tutor] program hangs in while loop using wx.yield

2010-11-15 Thread Terry Carroll
On Sun, 14 Nov 2010, Alex Hall wrote: Is there a basic tutorial for this sort of thing? Chapter 3 ("Working in an event-driven environment") of the book "wxPython in Action" is a pretty good tutorial on event-driven GUI programming in wxPython. The book in general is pretty good; I no longe

Re: [Tutor] Data Directory under site-packages

2010-11-10 Thread Terry Carroll
On Wed, 10 Nov 2010, Greg Lindstrom wrote: I'm writing my first module that I intend to put under our company's "site-packages" directory for everyone to use in their programs. The problem I'm having is that I want to place files in a data directory under the module directory (under site-packag

[Tutor] Stupid bug

2010-11-10 Thread Terry Carroll
This isn't a question, I'm just offering it as a cautionary tale and an opportunity to laugh at my own stupidity. I have a small function to calculate the MD5 checksum for a file. It's nothing fancy: ### import hashlib def md5(filename, bufsize=65536): ""

Re: [Tutor] Too different 2.6 vs 2.7?

2010-11-08 Thread Terry Carroll
On Mon, 8 Nov 2010, Jorge Biquez wrote: Are there really BIG differences between version 2.6 and 2.7? I'm in a similar boat. I use Ubuntu 10.04 aw well as Windows XP, Vista and 7. I keep to similar levels just to avoid confusion and at present run Python 2.6 on all systems. If I had an u

[Tutor] trying to generate change in print output

2010-11-07 Thread Terry Green
Am stumped, when I use this code: race=int(row[2]) raceChek=1 if raceChek == race: print ('raceChek ', raceChek, 'race ', race) else: print ('raceChek ', raceChek,' no match ', 'race ', race); raceChek = race I Get this: raceChek 1 race 1 raceChek 1 race 1

Re: [Tutor] Interactive visualization in python

2010-11-07 Thread Terry Carroll
On Sun, 7 Nov 2010, Alan Gauld wrote: Most GUI toolkits have a tree widget like the Wiondows Explorer tree view. The Tkintrer version is included in the Tix module which extends the basic Tkinter widgets. I'm pretty sure wxPython will have one too. I haven't used it, but wxPython's tree widge

Re: [Tutor] Reading the CDROM in Linux

2010-11-05 Thread Terry Carroll
On Fri, 5 Nov 2010, Terry Carroll wrote: Aha, this looks like it will work; I was starting to think along these lines; I was thinking of reading the output of df, but this is cleaner. Just to close this out, here's what's working for me. It will need to be prettied up, and t

Re: [Tutor] Reading the CDROM in Linux

2010-11-05 Thread Terry Carroll
On Sat, 6 Nov 2010, Steven D'Aprano wrote: Terry Carroll wrote: I have a program that traverses the directory of a CDROM using os.walk. I do most of my work on Windows, but some on (Ubuntu) Linux, and I'd like this to work in both environments. On Windows, I do something along th

Re: [Tutor] Reading the CDROM in Linux

2010-11-05 Thread Terry Carroll
On Sat, 6 Nov 2010, Steven D'Aprano wrote: Anyway, more modern Linux systems automatically mount CDs and DVDs. By convention, /mnt/... is used for manually mounts, and /media/... for automatic mounts of media. I am seeing my volume in /media ; however, I won't know the volume name when my pr

[Tutor] Reading the CDROM in Linux

2010-11-05 Thread Terry Carroll
Alan Gauld wrote: I don't use Ubuntu so don;t know the standard anmswer there but it will depend on where the CD is mounterd. I usually mount cdroms on /dev/cdrom That's what I figured; I now realize I didn't say so in my email, but it's mounted at /dev/sr0, which is where I came up with tha

[Tutor] Reading the CDROM in Linux

2010-11-05 Thread Terry Carroll
I have a program that traverses the directory of a CDROM using os.walk. I do most of my work on Windows, but some on (Ubuntu) Linux, and I'd like this to work in both environments. On Windows, I do something along the lines of this: startpoint="D:/" for (root, dirs, files) in os.walk(start

[Tutor] Stumped Again

2010-10-30 Thread Terry Green
Am running this Script and cannot figure out how to close my files, Keep getting msg: Attribute Error: '_csv.writer' object has no attribute 'close' Why? import csv testOutput = csv.writer(open('c:/users/terry/downloads/tup1012k/tup1

[Tutor] (no subject)

2010-10-28 Thread Terry Green
Need Help!] def main(): pass if __name__ == '__main__': main() postPos=words[3] f = open ("c:/users/terry/downloads/tup1012k/tup1012x.drf","r") lines = f.readlines() for line in lines: words = line.split(",") print (words[3

[Tutor] Syntax Error Messages

2010-10-22 Thread Terry Green
.Error, e: sys.exit('file %s, line %d: %s' % (filename, reader.line_num, e)) thanks, Terry Green ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Optparse question: if only certain values are acceptable

2009-05-08 Thread Terry Carroll
On Sat, 9 May 2009, Sander Sweers wrote: > Is the below what you are looking for? It's exactly what I was looking for. Thanks very much. Now I'm going to have to re-read the docs and see why I couldn't pick that up from them. ___ Tutor maillist -

[Tutor] Optparse question: if only certain values are acceptable

2009-05-08 Thread Terry Carroll
I'm tryng to use optparse for the first time. The toy summary is that I want to have the following command format: prognam -f FORMAT Where FORMAT, if specified, must be one of "X", "Y", or "Z". In otherwords, if the user enters: progname -f X It runs, producing its output in format X. Sim

Re: [Tutor] Parsing suggestion? (CUE file)

2009-02-03 Thread Terry Carroll
On Tue, 3 Feb 2009, Kent Johnson wrote: > Ah, I see. I imagined something more ambitious, that treated the lines > as fields. I find that the more ambitious my projects become, the less likely I am to complete them! With two toddlers, on a good day, I get 30 to 60 minutes of discretionary tim

Re: [Tutor] Parsing suggestion? (CUE file)

2009-02-03 Thread Terry Carroll
On Tue, 3 Feb 2009, Kent Johnson wrote: > On Tue, Feb 3, 2009 at 2:55 PM, Terry Carroll wrote: > > > The silver cloud to my temporary Internet outage was that I was able to > > solve my problem, in the process discovering that the csv module can parse > > a CUE file[1]

Re: [Tutor] Parsing suggestion? (CUE file)

2009-02-03 Thread Terry Carroll
On Tue, 3 Feb 2009, Terry Carroll wrote: > I am parsing certai Sorry about that. I was composing this message last night when my Internet connection went down. When I logged on this morning, I had a partial message. I meant to cancel but unfortunately, in pine, the SEND key (CTRL-X)

[Tutor] Parsing suggestion? (CUE file)

2009-02-03 Thread Terry Carroll
I am parsing certai ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] MP3Info class usage

2008-12-19 Thread Terry Carroll
On Fri, 19 Dec 2008, Terry Carroll wrote: > configure is s shell script. You'll need a version os shell that runs on > windows. > make, too, I'll bet. > > I run Cygwin on windows, which is a pretty good thing to have apart from > this. It's free and ava

Re: [Tutor] MP3Info class usage

2008-12-19 Thread Terry Carroll
On Thu, 18 Dec 2008, Gareth at Serif wrote: > I've not installed it, I've just imported it in my main program. How do you > install eyeD3, there's no installation package? I read the readme, which > talks about executing 'configure', but that just reports back that it is not > recognized as an i

Re: [Tutor] How to clear the screen

2008-10-19 Thread -&gt; Terry <-
Hi Johnny! Even the gurus on this list were beginners at one time. Try this: print "\n" * 40 - -- Terry -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFI+1yaOP+8GDe6jtYRAjhYAJ9rnhTCSfIoTtrjaREQrCB9gpF+qQCgze1u

Re: [Tutor] ftplib.storbinary and using a progress bar

2008-09-06 Thread Terry Carroll
On Sat, 6 Sep 2008, johnf wrote: > I'm currently using ftplib.storbinary() to upload a file to a FTP server. > However, I would like to inform the user of the progress being made during > the file transfer (it could be a very long transfer). But > ftplib.storbinary() has no callback like retr

Re: [Tutor] Need help with Factorial algorithm using Python

2008-09-05 Thread Terry Carroll
On Fri, 5 Sep 2008, Terry Carroll wrote: > On Sat, 6 Sep 2008, John Fouhy wrote: > > > You can count the number of fives in the prime decomposition of a > > number by just dividing by 5 repeatedly until you don't get a whole > > number. > > But that requires

Re: [Tutor] Need help with Factorial algorithm using Python

2008-09-05 Thread Terry Carroll
On Sat, 6 Sep 2008, John Fouhy wrote: > 2008/9/5 Terry Carroll <[EMAIL PROTECTED]>: > > So here's my routine to address the problem. It consists of making a > > multiplication table of coefficients that includes the factor such as 5, > > 25, 125, etc., and the

Re: [Tutor] Need help with Factorial algorithm using Python

2008-09-04 Thread Terry Carroll
On Thu, 4 Sep 2008, Robert Berman wrote: > Time to do some reading about regex. And here I thought I was slick > working with lists and strings. You shouldn't need a regexp for this. An easy way to count the trailing zeros is: - convert the number to a string; - make a copy, stripping off the

Re: [Tutor] Need help with Factorial algorithm using Python

2008-09-04 Thread Terry Carroll
On Thu, 4 Sep 2008, Robert Berman wrote: > "It can easily be seen that 6! = 720 and has exactly one > trailing zero. What is the lowest integer, x, such that x! has 7^20 > trailing zeros?" > > It does not, on the surface, appear to be a frontal lobe breaker. Design > an algorithm to build factori

Re: [Tutor] Decimals 'not equal to themselves' (e.g. 0.2 equals 0.200000001)

2008-08-05 Thread Terry Carroll
On Sun, 3 Aug 2008, CNiall wrote: > >>> 0.2 > 0.20001 > >>> 0.33 > 0.33002 > > As you can see, the last two decimals are very slightly inaccurate. > However, it appears that when n in 1/n is a power of two, the decimal > does not get 'thrown off'. How might I make Pyth

Re: [Tutor] adding a watermark to a sequence of images

2008-07-21 Thread Terry Carroll
On Mon, 21 Jul 2008, Christopher Spears wrote: > By all means, share your script! Even if I don't use it, I can learn > something from it! Well, maybe. If nothing else, perhaps you'll learn some new bad habits. The timestamp on this file shows that I dropped this project in June 2005, and you

Re: [Tutor] Advice for my function, isPrime(n), please

2008-07-21 Thread Terry Carroll
On Mon, 21 Jul 2008, Daniel Sarmiento wrote: > What about the following function? > > if x == 0: > return False > return True I don't like it, myself. You have multiple points of exit, and, yes, you can see that the fallthough is only executed if the condition is not met, but it makes you

Re: [Tutor] adding a watermark to a sequence of images

2008-07-21 Thread Terry Carroll
On Sun, 20 Jul 2008, Christopher Spears wrote: > Has anyone used Python to watermark of sequence of images? There's a recipe for watermarking using PIL here: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/362879 I have a half-baked program that goes through a directory of images and t

Re: [Tutor] Any way of monitoring a python program's memory utilization?

2008-07-17 Thread Terry Carroll
On Thu, 17 Jul 2008, Monika Jisswel wrote: > I see no problem, if you open very BIG files then your memory will get > filled up & your system will halt, I'm going to disagree with you on this one. First, in general, it is not the case that opening a very large file will cause memory to be fille

Re: [Tutor] Any way of monitoring a python program's memory utilization?

2008-07-17 Thread Terry Carroll
On Thu, 17 Jul 2008, Monika Jisswel wrote: > Well, you can check whether your system has reached its limits or not, but > what for ? So I can debug the problem. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Any way of monitoring a python program's memory utilization?

2008-07-16 Thread Terry Carroll
On Wed, 16 Jul 2008, Terry Carroll wrote: > The obvious thing to do is to also filter by PID, which is the second > element; Of course that opens a new question: how to find one's own PID > from within Python. More googling awaits. And, while searching for that, I found o

Re: [Tutor] Any way of monitoring a python program's memory utilization?

2008-07-16 Thread Terry Carroll
On Thu, 17 Jul 2008, John Fouhy wrote: > tasklist is the Windows version of ps. You could try something like > 'tasklist /FI "IMAGENAME eq python.exe"', though you'd then have to > parse the output. Thanks! I just found that too! (Alan's suggestiom made me thing of googling for "ps equivalent

Re: [Tutor] Any way of monitoring a python program's memory utilization?

2008-07-16 Thread Terry Carroll
On Thu, 17 Jul 2008, Alan Gauld wrote: > With cygwin you should have top, vmstat and of course ps. > All of these can monitor system status,. top being very similar to > XPs Task Manager process view but in a text window. vmstat will > not tell you process IDs, just report total usage. And ps is s

[Tutor] Any way of monitoring a python program's memory utilization?

2008-07-16 Thread Terry Carroll
Is there any way of having my program see how much memory it's using? I'm iterating through a vey large tarfile (uncompressed, it would be about 2.4G, with about 2.5 million files in it) and I can see from some external monitors that its virtual storage usage just grows and grows, until my whole s

Re: [Tutor] Anyone using tarfile?

2008-07-15 Thread Terry Carroll
On Tue, 15 Jul 2008, Kent Johnson wrote: > What version of Python are you using? I have 2.5.2 and the line > numbers in my tarfile.py are quite different than yours. The changelog > for Python 2.5.2 shows many fixes to tarfile so an upgrade may be in > order. And that was it! I pulled the most c

[Tutor] Anyone using tarfile?

2008-07-15 Thread Terry Carroll
I'm trying to use tarfile with no luck. Anyone on this list used it successfully? Here's a sample program pared down to illustrate the error. I'm arbitrarily trying to extract the 4th TARred file in the tarball (a file that I know from other debugging efforts is data/c410951c, and that I can

[Tutor] Traversing a two-dimensional "array"(was: (no subject)

2008-06-18 Thread Terry Carroll
On Wed, 18 Jun 2008, amit sethi wrote: > Hi , Could you please tell me , how i can traverse a two dimensional array , > i am sorry , it must be pretty simple but I am new to python am not able to > understand. What many languages would call a two-dimensional array would be represented in Python

Re: [Tutor] do I need f.close()

2008-06-12 Thread Terry Carroll
On Wed, 11 Jun 2008, dave selby wrote: > The whole topic came up because I just finished reading 'learning > python' 3rd edition OReilly as a refresher where there are multiple > instances of suggesting that you do the exact opposite eg ... > > [line.rstrip() for line in open('myfile')] ... p361

Re: [Tutor] for loop

2008-06-10 Thread Terry Carroll
On Tue, 10 Jun 2008, Sean Novak wrote: > I know I'm going to feel stupid on this one.. > > I would normally write this in PHP like this: > > for($i=1; i< count($someArray); $i++) > { > print $someArray[i] > } > > essentially,, I want to loop through an array skipping "someArray[0]" Like

Re: [Tutor] How to get a script to open a text file with Python?

2008-06-10 Thread Terry Carroll
On Tue, 10 Jun 2008, Alan Gauld wrote: > If TextPad is your default txt editor just use > os.system("foo.txt") or os.startfile("foo.txt"); sounds like the equivalent, but for some reason, I prefer it. ___ Tutor maillist - Tutor@python.org http://ma

Re: [Tutor] Little problem with math module

2008-05-21 Thread Terry Carroll
On Wed, 21 May 2008, Terry Carroll wrote: > The following (barely-tested) routine should calculate all the Nth roots > of a given x, even when x is negative and N is even: I realize I'm probably talking to myself here, but for the benefit of the archives, I found a more elegant app

Re: [Tutor] Little problem with math module

2008-05-21 Thread Terry Carroll
> "Tiago Katcipis" <[EMAIL PROTECTED]> wrote > > > def newton_divergente(x): > > return math.pow(x, 1.0/3.0) > > > > but when x = -20 it returns this error > > > > return math.pow(x, 1.0/3.0) > > ValueError: math domain error > > > > but why is that? is it impossible to calculate -20 ^ (1/3)

  1   2   3   4   5   >