[Tutor] Installation problem: Python 2.6.6 (32-Bit) on Windows 7 (32-Bit)

2010-08-31 Thread Tony Cappellini
Has anyone else had problems running the msi for Python 2.6.6 on Windows 7? If I don't check Compile .py to byte code, the installer completes without error. Checking Compile .py to byte code causes the following to be displayed There is a problem with the windows installer package. A program

[Tutor] When max() doesn't work as expected

2009-12-03 Thread Tony Cappellini
I have a list of 2300 strings. When I call max() on the list, it returned an item with 37 characters. I am only passing 1 argument to max(). I know for a fact that the largest item has 57 characters, and when I called mylist.index('my_57_character_string') the index was found. Printing

[Tutor] String formatting hex numbers

2009-05-30 Thread Tony Cappellini
I was looking at a this code which uses this code to dsiplay some hex numbers sys.stdout.write( \r%-8s ... 0x%08X-0x%08X % ( descr, long(startAddr), long(endAddr) ) The hex values are in this range 0x1BFFF400 to 1BFFF000 Why are these displayed with a leading negative sign (between the 0x and

[Tutor] Determining periodicity of rand.randint()

2009-01-31 Thread Tony Cappellini
Has anyone ever measured how random (or deterministic) a given sequence of numbers generated by rand.randint() are? Using these arguments for rand.randint(0, 1000 ) if a program which calls rand.randint() runs for 10 hours (or a few days), will it keep generating a repeatable set of numbers

[Tutor] Using the curses module (or a better solution)

2008-10-06 Thread Tony Cappellini
I'm maintaining a framework of tests which are run on a diskless Linux client, in character mode (no graphical desktop). The tests often print out a lot of info, which scrolls off the screen. I'd like to add a 1-2 line no-scroll-area at the top of the screen, so as to print a message which

Re: [Tutor] Using the curses module (or a better solution)

2008-10-06 Thread Tony Cappellini
See the recent discussion of urwid for discussion of a similar problem. http://thread.gmane.org/gmane.comp.python.tutor/50500/ This looks interesting. Thanks! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] cmd module

2008-09-03 Thread Tony Cappellini
I was just reading the PYMOTW article on the cmd module, and trying the examples. http://www.doughellmann.com/PyMOTW/cmd/cmd.html Scroll down to Auto-Completion. Does the tab key work for anyone running Windows ? Is this an OS specific feature? I see the bash prompts in the article, tab does

[Tutor] using sys.excepthook to handled unhandled exceptions

2008-08-27 Thread Tony Cappellini
The original authors left asserts in many places and I don't want the people using the code to see the ugly tracebacks. want to add an unhandled exception handler to a large framework that I'm maintaining, to make the applications behave better, Users of a program shouldn't need to know anything

[Tutor] using sys.excepthook to handle unhandled exception (corrected and reposted)

2008-08-27 Thread Tony Cappellini
I'm maintaining a large framework of python code where the original authors left many assert statements. When an unhandled exception occurs, the traceback is displayed on the screen. Ideally, I don't want the users to see the tracebacks from unhandled exceptions, but rather a short, useful

Re: [Tutor] Wave module

2008-07-06 Thread Tony Cappellini
Message: 1 Date: Sat, 5 Jul 2008 16:50:35 -0600 From: Alex Krycek [EMAIL PROTECTED] Subject: [Tutor] Wave module To: tutor@python.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=iso-8859-1 Hello, I'm trying to join two .wav files with the wave module. But when I try to

Re: [Tutor] Tutor Digest, Vol 53, Issue 18

2008-07-06 Thread Tony Cappellini
Message: 7 Date: Sat, 05 Jul 2008 12:23:36 -0600 From: Nathan Farrar [EMAIL PROTECTED] Subject: [Tutor] Exploring the Standard Library To: Python Tutor tutor@python.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=us-ascii I'd like to spend some time exploring the standard

Re: [Tutor] Is var = None in Python equivalent to Set var

2008-06-30 Thread Tony Cappellini
Message: 5 Date: Mon, 30 Jun 2008 11:49:59 +0200 From: Andre Engels [EMAIL PROTECTED] Subject: Re: [Tutor] Is var = None in Python equivalent to Set var = Nothingin VB? To: Kelie [EMAIL PROTECTED] Cc: tutor@python.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain;

Re: [Tutor] Is var = None in Python equivalent to Set var

2008-06-30 Thread Tony Cappellini
This thread got a bit off track but in Python these statements are unnecessary. What happened to Explicit is better than implicit? Regarding the original poster contrasting VB with Python setting someObject = None is perfectly fine in Python, and a good analogy between the languages.

Re: [Tutor] Is var = None in Python equivalent to Set var

2008-06-29 Thread Tony Cappellini
Message: 9 Date: Sun, 29 Jun 2008 01:20:16 -0700 From: wesley chun [EMAIL PROTECTED] Subject: Re: [Tutor] Is var = None in Python equivalent to Set var = Nothingin VB? To: [EMAIL PROTECTED], Alan Gauld [EMAIL PROTECTED] Cc: tutor@python.org the reason why i ask is because it's not

Re: [Tutor] Is var = None in Python equivalent to Set var

2008-06-29 Thread Tony Cappellini
Wes, is this not your reply? the reason why i ask is because it's not standard practice i see people doing this with Python, so i'm trying to get a better understanding of what you're trying to do. thanks! -- wesley *exactly* why, other than most of the time, people let objects go

Re: [Tutor] Grabbing data from changing website

2008-06-05 Thread Tony Cappellini
-- Message: 4 Date: Wed, 4 Jun 2008 10:00:46 -0400 From: James [EMAIL PROTECTED] Subject: [Tutor] Grabbing data from changing website To: tutor@python.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-1 urllib2 will grab the

[Tutor] Python Programming for the Absolute Beginner-OT

2008-05-28 Thread Tony Cappellini
A bit OT, but still within the realm of beginning Python... My co-worker whom has just started learning Python, bought this book in used condition. http://www.courseptr.com/ptr_detail.cfm?group=Programmingsubcat=Otherisbn=978%2D1%2D59863%2D112%2D8 Unfortunately it came without the CD, and the

[Tutor] Re Open a directory in the default file manager

2008-05-20 Thread Tony Cappellini
Message: 2 Date: Thu, 15 May 2008 20:10:05 +0200 From: Tim Michelsen [EMAIL PROTECTED] Subject: [Tutor] Open a directory in the default file manager To: tutor@python.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-15; format=flowed Hello, is there any function/module

Re: [Tutor] Tutor Open a directory in the default file manager

2008-05-20 Thread Tony Cappellini
*Tim Michelsen* timmichelsen at gmx-topmail.de tutor%40python.org?Subject=Re%3A%20%5BTutor%5D%20Open%20a%20directory%20in%20the%20default%20file%20managerIn-Reply-To=%3Cg0skru%24lep%241%40ger.gmane.org%3E *Mon May 19 21:36:30 CEST 2008* - Previous message: [Tutor] Open a directory in the

Re: [Tutor] Copy script

2008-04-10 Thread Tony Cappellini
Message: 7 Date: Thu, 10 Apr 2008 01:46:49 +0100 From: Alan Gauld [EMAIL PROTECTED] Subject: Re: [Tutor] Copy script To: tutor@python.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; format=flowed; charset=iso-8859-1; reply-type=original I don;t see how the input file relates to

Re: [Tutor] Copy script

2008-04-10 Thread Tony Cappellini
Of course they do - they can use input redirection just like Unix. Oh,-I have forgotten about that. But why use clunky batch language when you can use Python? After all, he did post this to the python list. ___ Tutor maillist - Tutor@python.org

Re: [Tutor] Don't miss Python-by-example - new online guide to

2008-04-04 Thread Tony Cappellini
Date: Fri, 04 Apr 2008 07:12:11 -0700 From: Dick Moores [EMAIL PROTECTED] Subject: [Tutor] Don't miss Python-by-example - new online guide to Python Standard Library To: Python Tutor List tutor@python.org Message-ID: [EMAIL PROTECTED] Dick- there was no url with your message. Also See

Re: [Tutor] Tutor Digest, Vol 49, Issue 78

2008-03-26 Thread Tony Cappellini
Draft notes for the next Kent's Korner presentation are available at http://personalpages.tds.net/~kent37/kk/00010.html Comments welcome. I vote Kent move out of the korner and into the front of the classroom! Nice color scheme, easy to look at, good layout, font, size, and small chunks

Re: [Tutor] Python to C++

2008-03-25 Thread Tony Cappellini
Another alternative is Weave http://www.scipy.org/Weave But mixing C/C++ with Python sort of defeats the reasons for using Python to begin with Message: 2 Date: Sat, 22 Mar 2008 02:44:54 +0100 From: Eike Welk [EMAIL PROTECTED] Subject: Re: [Tutor] Python to C++ To: tutor@python.org Message-ID:

Re: [Tutor] Python to C++

2008-03-25 Thread Tony Cappellini
Montag, den 24.03.2008, 23:39 -0700 schrieb Tony Cappellini: Another alternative is Weave http://www.scipy.org/Weave But mixing C/C++ with Python sort of defeats the reasons for using Python to begin with Message: 2 Date: Sat, 22 Mar 2008 02:44:54 +0100 From: Eike Welk

Re: [Tutor] what is @classmethod and @staticmethod ??

2008-03-23 Thread Tony Cappellini
Kent Would you show the examples which show where staticmethod classmethod are used? I've often wondered about the usefulness of these myself. Having read many of the popular books on python, none provide a good clear explanation of why or where these should be used, and what the alternatives

Re: [Tutor] what is @classmethod and @staticmethod ??

2008-03-23 Thread Tony Cappellini
I don't use classmethods so I can't discuss that. For staticmethods, suppose I have in foo.py Where is the word staticmethod in the example below? Where is it used? This is what I was hoping to see. class Foo(object): # Lots of useful stuff In client.py I have from foo import

Re: [Tutor] Make sound with python? Cross platform?

2008-03-10 Thread Tony Cappellini
Thanks very much. Not quite sure why I didn't find those earlier! I'll have a look now. I think this cuts more to the chase than using a game framework http://pysonic.sourceforge.net/ ___ Tutor maillist - Tutor@python.org

Re: [Tutor] How to deal with a thread that doesn't terminate

2008-02-20 Thread Tony Cappellini
(object): def __init__(self,cmd): self.cmdline = cmd def start(self): self.process = subprocess.Popen([self.cmdline]) def stop(self): win32api.TerminateProcess(int(self.process._handle), -1 --michael On Feb 19, 2008 4:53 PM, Tony Cappellini [EMAIL

Re: [Tutor] How to deal with a thread that doesn't terminate

2008-02-19 Thread Tony Cappellini
On Feb 19, 2008 2:02 PM, bob gailer [EMAIL PROTECTED] wrote: Tony Cappellini wrote: When I executing a program external to the main program in a thread, and that thread hangs, can the thread be terminated? Please define hangs. AFAIK that could mean waiting on an external event / signal

Re: [Tutor] Hello and newbie question about self

2008-02-03 Thread Tony Cappellini
http://www.ibiblio.org/swaroopch/byteofpython/read/self.html Is there a typo in the contents of this web page? Should this statement Note for C++/Java/C# Programmers The self in Python is equivalent to the self pointer in C++ and the this reference in Java and C#. Actually be Note for

Re: [Tutor] shutils.copytree

2008-01-11 Thread Tony Cappellini
The source for copytree says, The destination directory must not already exist. I suppose that is why you have a problem but I don't know the specific cause. Did you get a traceback? The source also says, Consider this example code rather than the ultimate tool so maybe you should just copy

[Tutor] shutils.copytree

2008-01-10 Thread Tony Cappellini
I'm using shutils for the first time, and I've un into a problem. The docs for copytree are pretty sparse and don't mention any problem situations Under WinXP, I'm trying to copy a directory tree to a USB device using copytree, but copytree doesn't like a drive letter as a destination.

Re: [Tutor] Choice of GUI builders

2008-01-03 Thread Tony Cappellini
Message: 1 Date: Thu, 3 Jan 2008 08:11:05 - From: Alan Gauld [EMAIL PROTECTED] Subject: Re: [Tutor] Choice of GUI builders To: tutor@python.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; format=flowed; charset=iso-8859-1; reply-type=original OK, wxPython is a fine toolkt.

Re: [Tutor] Tutor Digest, Vol 47, Issue 8

2008-01-03 Thread Tony Cappellini
Message: 1 Date: Thu, 3 Jan 2008 10:06:01 -0200 From: Tiago Saboga [EMAIL PROTECTED] Subject: Re: [Tutor] Choice of GUI builders To: tutor@python.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=us-ascii But since 2005, according to wikipedia, the Qt Windows is also licensed

Re: [Tutor] Tutor Digest, Vol 47, Issue 8

2008-01-03 Thread Tony Cappellini
with the particular toolkit by the programmer. On Jan 3, 2008 1:00 PM, Marc Tompkins [EMAIL PROTECTED] wrote: On Jan 3, 2008 10:31 AM, Tony Cappellini [EMAIL PROTECTED] wrote: It's like OCR and speech-to-text. At some point it becomes easier to do it by hand than to straighten out the dog's breakfast

Re: [Tutor] Tutor Digest, Vol 45, Issue 58

2007-11-20 Thread Tony Cappellini
- Forwarded Message From: Doug Glenn [EMAIL PROTECTED] To: Alan Gauld [EMAIL PROTECTED] Sent: Tuesday, 20 November, 2007 4:08:12 AM Subject: Re: [Tutor] Wrong version of Python being executed It is a bit odd since normally Pythons installation mechinism only does it for the PY file on

Re: [Tutor] Wrong version of Python being executed

2007-11-19 Thread Tony Cappellini
of Python is invoked. How do other people deal with having multiple versions of Python on their system, and not run into this issue?? On Nov 10, 2007 6:16 PM, Kent Johnson [EMAIL PROTECTED] wrote: Tony Cappellini wrote: When I run this python script, the following exception is thrown

Re: [Tutor] Wrong version of Python being executed

2007-11-12 Thread Tony Cappellini
Date: Mon, 12 Nov 2007 09:14:05 - From: Alan Gauld [EMAIL PROTECTED] Subject: Re: [Tutor] Wrong version of Python being executed To: tutor@python.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; format=flowed; charset=iso-8859-1; reply-type=original Umm, have you rebooted?

Re: [Tutor] Wrong version of Python being executed

2007-11-11 Thread Tony Cappellini
Martin Walsh mwalsh at groktech.org Sun Nov 11 06:13:10 CET 2007 That is odd. Try using the full path to python, just to be sure: c:\python25\python script.py -- do you get the same behavior? This works just fine- I would expect it to. Also, if you haven't already, you can run python with the

Re: [Tutor] Tutor Digest, Vol 45, Issue 30

2007-11-11 Thread Tony Cappellini
Message: 4 Date: Mon, 12 Nov 2007 00:16:35 - From: Alan Gauld [EMAIL PROTECTED] Subject: Re: [Tutor] Wrong version of Python being executed To: tutor@python.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; format=flowed; charset=iso-8859-1; reply-type=original

Re: [Tutor] Wrong version of Python being executed

2007-11-11 Thread Tony Cappellini
Message: 2 Date: Sun, 11 Nov 2007 16:57:01 -0600 From: Martin Walsh [EMAIL PROTECTED] Subject: Re: [Tutor] Wrong version of Python being executed To: Tutor Python tutor@python.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-1 My initial thought based on your

[Tutor] Wrong version of Python being executed

2007-11-10 Thread Tony Cappellini
I've got Python 2.3, 2.4 and 2.5 installed on a Windows XP machine.. I currently have Python 2.5 in my path, and there are no other versions of Python in the path. I'm trying to run a program which expects Python 2.4 or later to be installed, because there is a call to logging.BasicConfig(arg1,

Re: [Tutor] Wrong version of Python being executed

2007-11-10 Thread Tony Cappellini
Thanks for replying Kent. This is quite a strange mystery. A couple of possibilities... Is there a #! line at the start of the script that specifies Python 2.3 (I'm not sure if those work in windows though...) No- The shebang line is for non-Windows systems (Unix variants) How do you run the

Re: [Tutor] Wrong version of Python being executed

2007-11-10 Thread Tony Cappellini
What do you get if you print sys.path from the interpreter? I've printed out sys.path from inside the script as well, and all references to Python25 are replaced with Python23 FWIW- This isn't a problem unique to this script. I've just printed out sys.path from another script in another

Re: [Tutor] os.rename anomaly in Python 2.3 on Windows XP

2007-10-09 Thread Tony Cappellini
Thanks. Unfortunately,os.listdir() returns the same string as glob.glob, for the problem file I mentioned. When I pass that string to os.rename() OSError: [Errno 22] Invalid argument Sounds like it has something to do with Unicode. Your filenames aren't being interpreted correctly. Perhaps

[Tutor] os.rename anomaly in Python 2.3 on Windows XP

2007-10-08 Thread Tony Cappellini
Using Windows XP, SP2 and Python 2.3 I've written a script which walks through a bunch of directories and replaces characters which are typically illegals as filenames, with an '_' character. The directories are part of a package of software which is released by a group of people from Japan, and

Re: [Tutor] Tutor Digest, Vol 40, Issue 55

2007-06-24 Thread Tony Cappellini
Take a look at pyHook 1. Re: Catch event's on my computer (Alan Gauld) From: Alan Gauld [EMAIL PROTECTED] Subject: Re: [Tutor] Catch event's on my computer To: tutor@python.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; format=flowed; charset=iso-8859-1;

Re: [Tutor] HTTP file download

2007-03-13 Thread Tony Cappellini
How do you handle a binary file? Message: 4 Date: Tue, 13 Mar 2007 13:23:44 +0100 From: Jean-Philippe Durand [EMAIL PROTECTED] Subject: Re: [Tutor] HTTP file download To: [EMAIL PROTECTED] [EMAIL PROTECTED] Cc: tutor@python.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain;

Re: [Tutor] Tutor Digest, Vol 37, Issue 15

2007-03-05 Thread Tony Cappellini
Rename your file from .py to .pyw. This will prevent the DOS window from appearing Message: 6 Date: Mon, 5 Mar 2007 16:51:42 +0100 From: learner404 [EMAIL PROTECTED] Subject: [Tutor] Hiding/Killing a DOS window (from a previous os.system call) To: Tutor Python tutor@python.org Message-ID:

Re: [Tutor] How does this work?

2007-02-07 Thread Tony Cappellini
PS To import a file whose name is in a variable (string), see __import__(). I've started doing the import instead of exec/eval , but the person who wrote the module being called, started using the logging module. Now I can't capture the output of the module I'm calling, and display it in a GUI.

Re: [Tutor] How does this work?

2007-02-07 Thread Tony Cappellini
If I understand you, you have a python cmdline app that does something useful. You have users who aren't comfortable with the command line, so you are writing a GUI wrapper that calls the cmdline app with popen(). That is correct A better approach is to turn the functional part of the cmdline

Re: [Tutor] How does this work?

2007-02-07 Thread Tony Cappellini
The application needs to be rewritten if this is true. The author's implementation is not logical, regardless- I won't ask him to do this, it's just the way it is. I don't know why it was written this way. if I'm inferring correctly that he knows there are other apps depending on this. Yes

Re: [Tutor] How does this work?

2007-02-07 Thread Tony Cappellini
You should be able to make the logging module work with you, it is very flexible. You should hook into the logging module. Write a custom handler that pushes log methods into your GUI. Add the handler to the root logger. The cmd line app already uses the logging module- this is where the

Re: [Tutor] How does this work?

2007-02-07 Thread Tony Cappellini
Thanks. I'm not using wx, but that doesn't matter. I'll see if there's some way I can get the author to let me pass in the logging handler to his main. On 2/7/07, Kent Johnson [EMAIL PROTECTED] wrote: Kent Johnson wrote: You should be able to make the logging module work with you, it is very

[Tutor] How does this work?

2007-02-06 Thread Tony Cappellini
I saw a snippet of python which is used to execute another python script, and I'm trying to understand the mechanism. Simple as it is, I don't understand how it works :-) this is the caller ## callee=open(tester.py).read() exec(callee) eval(main(['', 'argument']))

Re: [Tutor] How does this work?

2007-02-06 Thread Tony Cappellini
Hi Danny, Hi Tony, Ack! This is not safe. I would strongly recommend not to do this. There is a much simpler way for the caller to be written: What is not safe about doing it this way ? import tester tester.main([], argument)

[Tutor] reassigning/replacing sys.stdout

2007-01-30 Thread Tony Cappellini
I'm writing a python gui app that will call a python cmd line app. The gui will take users input, pass it to the cmd line app, then display the cmd app program output. The idea is to give users who aren't comfortable with the cmd line a way to run the program, without having to open a shell

Re: [Tutor] reassigning/replacing sys.stdout

2007-01-30 Thread Tony Cappellini
got it -thanks On 1/30/07, Luke Paireepinart [EMAIL PROTECTED] wrote: Tony Cappellini wrote: I'm writing a python gui app that will call a python cmd line app. The gui will take users input, pass it to the cmd line app, then display the cmd app program output. The idea is to give users who

Re: [Tutor] reassigning/replacing sys.stdout

2007-01-30 Thread Tony Cappellini
That would be ideal- but I'm using 2.4 now, and the people using the app would also have to upgrade to 2.5. I don't like upgrading unless there's a pressing need. On 1/30/07, Danny Yoo [EMAIL PROTECTED] wrote: The author of the cmd line app suggested I temporarily replace sys.stdout'with a

[Tutor] Purging/deleting the logfile with the logging module

2007-01-30 Thread Tony Cappellini
I want to purge (empty) or delete the logfile created by the logging module, and reopen it for a new session. There is reference to a close function in the 2.3 docs, but I don't see how I can purge or delete the file, since I don't have access to the file descriptor. *close*( ) Tidy up any

Re: [Tutor] Purging/deleting the logfile with the logging module

2007-01-30 Thread Tony Cappellini
*close*( ) Tidy up any resources used by the handler. This version does nothing and is intended to be implemented by subclasses. How can I purge/delete reopen the logfile? FileHandler has a close() method that presumably does something useful. see above- It says it does

[Tutor] Are there any MAC OSX python users here?

2007-01-20 Thread Tony Cappellini
I'm trying to help some people run a python cmd line program on OSX. Would you email me off list if you have OSX and run python apps form the cmd line? thanks ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Tutor Digest, Vol 35, Issue 18

2007-01-05 Thread Tony Cappellini
Message: 7 Date: Fri, 5 Jan 2007 08:04:23 -0800 (PST) From: Mike Ellis [EMAIL PROTECTED] Subject: [Tutor] Python gui for file input To: tutor@python.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=iso-8859-1 Hi all, I am looking to create a simple gui interface to a small

[Tutor] Assigning a variable stored in a dictionary

2007-01-04 Thread Tony Cappellini
I can't see the forest through the trees. I have stored 3 global variables in a dictionary, and associated each variable with a filename. Ideally, I want to read the contents of the text files, and store the contents in the global variables. The globals will be used by another function. However,

Re: [Tutor] Tutor Digest, Vol 35, Issue 8

2007-01-03 Thread Tony Cappellini
Take a look at Movable Python. It may not be exactly what you're looking for, but it may turn out to be a resource to leverage from. Message: 1 Date: Tue, 2 Jan 2007 21:14:16 -0500 From: Daniel McQuay [EMAIL PROTECTED] Subject: Re: [Tutor] Starting python from a DOS prompt from any

[Tutor] Embedding strings in a python script

2007-01-03 Thread Tony Cappellini
I have a number of text files which need to be checked into CVS. Each file needs a special text header/footer in order that CVS can track changes and version numbers. Python to the rescue. I've written a small python program which will write the header/footer to all files in the current

Re: [Tutor] Starting python from a DOS prompt from any

2007-01-01 Thread Tony Cappellini
Message: 3 Date: Sun, 31 Dec 2006 00:10:39 -0500 From: Daniel McQuay [EMAIL PROTECTED] Subject: [Tutor] Starting python from a DOS prompt from any directory? sorry for such a newbie question but i would like to figure this out because there are some situations where i need that to work

Re: [Tutor] Tutor Digest, Vol 34, Issue 55

2006-12-29 Thread Tony Cappellini
Message: 1 Date: Thu, 28 Dec 2006 17:24:41 -0800 From: Chris Hengge [EMAIL PROTECTED] Subject: Re: [Tutor] OT: Python 2.5 (Was Re: Length of longest item in I hope this is related enough for this thread, but I'm curious why people didn't seem to unanimously jump into 2.5 upon release. One

[Tutor] Length of longest item in a list, using a list comp

2006-12-28 Thread Tony Cappellini
I want to use a list comp to get the length of the longest string in a list, but can't quite get the syntax right. l1=['abc', 'abcde', 'abcfdtea'] longest=0 [x for x in l1 if len(x) longest] The problem is I can't add the true clause to the if statement in a list comp as in if len(x)

Re: [Tutor] Length of longest item in a list, using a list comp

2006-12-28 Thread Tony Cappellini
Thanks, but I am restricted to using 2.3.4 for now, so longest = max([len(x) for x in ll]) works for me On 12/28/06, Andreas Kostyrka [EMAIL PROTECTED] wrote: * Python [EMAIL PROTECTED] [061228 20:44]: On Thu, 2006-12-28 at 11:27 -0800, Tony Cappellini wrote: I want to use a list

[Tutor] Docs for os popen and Popen2 modules

2006-12-05 Thread Tony Cappellini
Running python 2.3.4, on Windows XP the popen2 docs show 6.8 popen2 -- Subprocesses with accessible I/O streams This module allows you to spawn processes and connect to their input/output/error pipes and obtain their return codes under Unix and Windows. Then it further goes to say The only

[Tutor] How To structure a program for cmd line mode gui mode

2006-12-01 Thread Tony Cappellini
Im writing a cmd line program which will automate getting some modules out of cvs, based on some input criteria. Initiallly, I will do a cmd line version, but would like to make a gui version later with QT. I would like to find out how to structure the program so that when the gui version is

[Tutor] e: moving from pack to grid in tkinter

2006-11-27 Thread Tony Cappellini
Date: Mon, 27 Nov 2006 18:07:33 +1300 From: John Fouhy [EMAIL PROTECTED] Subject: Re: [Tutor] moving from pack to grid in tkinter To: tutor-python tutor@python.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-1; format=flowed On 27/11/06, Tony Cappellini [EMAIL

[Tutor] moving from pack to grid in tkinter

2006-11-26 Thread Tony Cappellini
I've got a main window which is 640 * 400. self.root.geometry(600x400) self.label.pack(side=BOTTOM, fill=X) This line would put the label at the bottom of the window, and extend to both left and right edges of the window. I want to change to grid geometry because I have several more

[Tutor] using CVS through Python

2006-11-11 Thread Tony Cappellini
I need to do some automated checkouts of CVS projects from Python scripts, and want ot be able to handle success and failure conditions.While sending the command lines to cvs isn't a problem, I could use some suggestions for how to check the cvs responses. Parsing the text returned from CVS isn't

Re: [Tutor] Print Screen

2006-11-03 Thread Tony Cappellini
Date: Thu, 02 Nov 2006 20:09:59 -0500From: Bill Burns [EMAIL PROTECTED]Subject: Re: [Tutor] Print Screen To: Chris Hengge [EMAIL PROTECTED]Cc: pythontutor tutor@python.orgMessage-ID: [EMAIL PROTECTED]Content-Type: text/plain; charset=ISO-8859-1; format=flowed pressed, try pyHook. Note: pyHook

Re: [Tutor] Running multiple version of Python on 1 windows

2006-10-31 Thread Tony Cappellini
>From Kent You don't say what OS you are running but under Windows it is trivial tohave multiple versions of Python installed, I have 2.3, 2.4 and 2.5.They are each in their own directories, all in the system path. I have aliases called py23, py24 and py25 that let me launch the version Iwant. I'm

Re: [Tutor] what is PIL..???

2006-10-21 Thread Tony Cappellini
Also checkout GnuPlot http://www.gnuplot.info/and the Python bindings for ithttp://gnuplot-py.sourceforge.net/ Date: Sat, 21 Oct 2006 14:07:12 +0100From: Asrarahmed Kadri [EMAIL PROTECTED] Subject: [Tutor] what is PIL..???To: pythontutor tutor@python.orgMessage-ID: [EMAIL

[Tutor] Trying to understand sys.getrefcount()

2006-10-12 Thread Tony Cappellini
I'm using Python 2.3.4After reading this in the docs getrefcount( object) Return the reference count of the object. The count returned is generally one higher than you might expect, because it includes the (temporary) reference as an argument to getrefcount().I decided to try some

[Tutor] What not to put in __init__()

2006-10-03 Thread Tony Cappellini
I've just inherited a lot of python code to maintain.The __init__ functions in many of the classes are very long- some over 100 lines.I like to keep functions/methods short readable at a glance, if possible. 1. Is it good methodology to move some code from _init__ to it's own method within the

Re: [Tutor] Fatal error after RE-installing Python 2.3.4

2006-09-24 Thread Tony Cappellini
Message: 1Date: Sat, 23 Sep 2006 08:25:13 -0400From: Kent Johnson [EMAIL PROTECTED]Subject: Re: [Tutor] Fatal error after RE-installing Python 2.3.4Cc: tutor@python.orgMessage-ID: [EMAIL PROTECTED]Content-Type: text/plain; charset=ISO-8859-1; format=flowedWere the extra warnings legitimate

Re: [Tutor] Tutor Digest, Vol 31, Issue 66

2006-09-23 Thread Tony Cappellini
Message: 4Date: Sat, 23 Sep 2006 08:38:37 +0100From: Alan Gauld [EMAIL PROTECTED]Subject: Re: [Tutor] Fatal error after RE-installing Python 2.3.4To: tutor@python.orgMessage-ID: [EMAIL PROTECTED]Content-Type: text/plain; format=flowed; charset=iso-8859-1;reply-type=originalHave you installed in

[Tutor] Fatal error after RE-installing Python 2.3.4

2006-09-22 Thread Tony Cappellini
I've just started a job which has a massive python2.3.4-centric tools installation and configuration.I know what you're going to say, but I can't upgrade and be the only one with a newer version. There are close to 30 engineers using this same tools configuration, and it has been working fine for

[Tutor] Making a better main() : Critique request

2006-08-20 Thread Tony Cappellini
Some time ago, I had read an article on Guido's blog (I think) about ways to improve the main() functionin a Python script. There were many replies, and I thought I would try to implement some of these ideas. I had found that in every python program I wrote I would 1. check the number of

[Tutor] simple Model-View-Controller example for QT/PyQT

2006-07-24 Thread Tony Cappellini
Does anyone here have a example/demo using the MVC pattern, in a simple QT/pyQT program?thanks ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Confused about embedding python in Html

2005-08-20 Thread Tony Cappellini
I want to use embedded python in an html page. However, I dont want to force the user to have python installed for the page to work. Is there any way to make the embedded python code be executed by the server? I'm hoping ti use python as an alternative to vbscript and jaava thanks tony

[Tutor] Reading/writing Wave files

2005-02-16 Thread Tony Cappellini
After looking at the Python docs for the wave module, I'm a bit puzzled as to how to use it. Does anyone have an example I can browse? If I write to a wave file, is the data I write actually audible, if I use Winamp or some other wave player, or is it more complicated than that? Is the data I

[Tutor] Iterating over multiple lists- options

2005-02-07 Thread Tony Cappellini
I'm trying to generate an HTML table, from multiple lists. There are 4 lists total, each of which *may* have a different length from the other lists. Each list has been stored in a master dictionary. North=[Bill, Bob, Sue, Mary] South=['Tim', ''Tom', 'Jim', 'John', 'Carl', 'Evan', 'Rich'] etc

Re: [Tutor] Iterating over multiple lists- options

2005-02-07 Thread Tony Cappellini
Out of curiosity, if it's not possible to run zip() directly on the lists that you have, can you bend the lists so that zip() will fit? It is possible, however zip() truncates the longer list, based on the size of the smaller list, so it's just not feasible in my case. Here's a quick function

Re: [Tutor] Iterating over multiple lists- options

2005-02-07 Thread Tony Cappellini
map(None, North, South, East West) does exactly what you want: North=['Bill', 'Bob', 'Sue', 'Mary'] South=['Tim', 'Tom', 'Jim', 'John', 'Carl', 'Evan', 'Rich'] map(None, North, South) [('Bill', 'Tim'), ('Bob', 'Tom'), ('Sue', 'Jim'), ('Mary', 'John'), (None, 'Carl'), (None, 'Evan'),

[Tutor] Leading zero for hex numbers

2004-12-15 Thread Tony Cappellini
I'm trying to get Python to automatically print a leading 0 for hex numbers, but it only seems to work for for decimal numbers. print 0x%0X % 12345 displays 0x3039 instead of 0x03039 The Python docs state The conversion will be zero padded for numeric values, when a 0 is used as a flag