Re: [Tutor] Life after beginner

2006-01-30 Thread Danny Yoo
On Mon, 30 Jan 2006, Pat Martin wrote: > My question is, what next? Is there some intermediate tutorials or books > out there that I can start learning some real meat in the language? Hi Pat, Maybe you'd like something like: http://diveintopython.org/ which is pretty meaty (or, if you're

[Tutor] ANN: Rur-ple 0.95 has been released

2006-01-30 Thread Andre Roberge
RUR-PLE 0.95 has been released. A link to the download page can be found at http://rur-ple.sourceforge.net (The site is slightly out of date, and there is no plan to update it in the future as it provides an excellent idea of what RUR-PLE is about.) This new version contains a few bug fixes and

[Tutor] Life after beginner

2006-01-30 Thread Pat Martin
Hello,I have been reading about and playing with programming in python for awhile now. I have most of the basics down. I know what a tuple is, I know how to load modules, and I understand a fair amount of beginning programming theory. I have written some scripts for both home and work and have beco

Re: [Tutor] Getting Running File's Name

2006-01-30 Thread Hans Dushanthakumar
Under WinXP, the variable sys.argv[0] holds the script file name (including the path). Not sure, but it may work the same under Linux as well. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bryan Carbonnell Sent: Tuesday, 31 January 2006 3:11 p.m. To: tu

[Tutor] Getting Running File's Name

2006-01-30 Thread Bryan Carbonnell
Can Python return the name of the current file's name? In other works, if I am running a Python file (MyPythonFile.py) is there a function that will return 'MyPythonFile.py'? This will be used in Linux if that matters. Thanks -- Bryan Carbonnell - [EMAIL PROTECTED] Warning: dates on calendar

Re: [Tutor] wxPython

2006-01-30 Thread K. Weinert
> How can I avoid that the graphics freeze. > here is another example for doing this: http://uucode.com/texts/pylongopgui/pyguiapp.html It uses Tkinter, but it should work in wxPython, too. Kind regards, Karsten. ___ Tutor maillist - Tutor@python.

Re: [Tutor] getting around ValueError in os.walk

2006-01-30 Thread John Fouhy
On 31/01/06, Alan Gauld <[EMAIL PROTECTED]> wrote: > You need a comma after dirpath, python sees only two values > in the tuple but expects 3 (actually I'd expect a syntax error, > unless there is no space in the real code?) >>> 1 . __add__ ( 4 ) 5 Python is quite happy about whitespace either si

Re: [Tutor] getting around ValueError in os.walk

2006-01-30 Thread Andrew Fant
Mea culpa, Mea Maxima Culpa. I apoligize for sending quickly when I was trying to edit in vi. Thanks to everyone who caught my typo and explained ValueError to me in detail. Andy (vowing to RTFM more closely in the future) -- Andrew Fant| And when the night is cloudy| This space to l

Re: [Tutor] I'm puzzled

2006-01-30 Thread gmane
> Why will this little program crash when you enter the > enter key? > > while True: >a = raw_input('number? ') >if a.isdigit(): >print 'isdigit' >elif a[0] == '-' and a[1:].isdigit(): You could instead use elif a.startswith('-') and a[1:].isdigit(): as the empty string c

Re: [Tutor] getting around ValueError in os.walk

2006-01-30 Thread Alan Gauld
> for (dirpath. subdirs, filenames) in os.walk("/foo/bar"): You need a comma after dirpath, python sees only two values in the tuple but expects 3 (actually I'd expect a syntax error, unless there is no space in the real code?) > when I try to run it, I get a "ValueError: too many values to unpac

Re: [Tutor] Copy files

2006-01-30 Thread Alan Gauld
David, Can I suggest you rethink your variable names? That might make it clearer what is happening. > def compare_files(file_name1, file_name2): > x = cmp (file_name1, file_name2) > return x Seems fair enough except file_name1 and file_name2 are actually file *contents*! And in fact

Re: [Tutor] getting around ValueError in os.walk

2006-01-30 Thread John Fouhy
On 31/01/06, Andrew D. Fant <[EMAIL PROTECTED]> wrote: > when I try to run it, I get a "ValueError: too many values to unpack" which I > think comes from the fact that there is a subdirectory of /foo/bar which has > over 2500 files in it. The tree can't be easily restructured for legacy > reasons

Re: [Tutor] getting around ValueError in os.walk

2006-01-30 Thread Jason Massey
Andrew, I put in your code, exactly as you have it, with only three changes: #!/usr/bin/python import os for (dirpath, subdirs, filenames) in os.walk("/python24"):    # a comma instead of a period after dirpath    for file in filenames:    if file.endswith(".py"):

[Tutor] getting around ValueError in os.walk

2006-01-30 Thread Andrew D. Fant
I'm working on a program to do some processing on a directory tree. If I had been doing it in a shell script, the core of the processing would have been in a "find $ROOT -type f -name FOO -print" command" On the web, I found a snippet of code that demonstrated the os.walk module and I created a si

Re: [Tutor] putting instance variables into a dict

2006-01-30 Thread Shuying Wang
Hi, That's more or less what I want. Thanks! Now I just need to figure out metaclasses and poke around python's innards. :D --Shuying On 1/30/06, Danny Yoo <[EMAIL PROTECTED]> wrote: > It's an somewhat low-level detail that the attributes of a class instance > can be accessed through a special _

Re: [Tutor] email-sending.. (fwd)

2006-01-30 Thread Python
On Sun, 2006-01-29 at 10:09 -0800, Danny Yoo wrote (forwarding a direct reply to the list): > Hi Danny, > > i have crossed that point where it complains of socket error.., but > now i am stuck with another issue, where it says that it has sent the > mail, but i dont recive any in my yahoo mail.,i

[Tutor] Copy files

2006-01-30 Thread David Holland
I wrote a small program that compares files test1 and test2 to test3. If the files are different  then it  copies either test1 to test3 or the reverse.The problem is that the although the shutil.copy2 in thefunction change_files  works without error it does not copy.  Can anyone see what is

Re: [Tutor] wxPython

2006-01-30 Thread Kent Johnson
Øyvind wrote: > Hello. > > I have made some programs using wxPython (PythonCard). They all seem to > have one common nominator. When the program are doing something unrelated > unrelated to the graphics (for example, ftp's, works with a document or a > file), the graphics freezes. It does unfreeze

[Tutor] wxPython

2006-01-30 Thread Øyvind
Hello. I have made some programs using wxPython (PythonCard). They all seem to have one common nominator. When the program are doing something unrelated unrelated to the graphics (for example, ftp's, works with a document or a file), the graphics freezes. It does unfreeze afterwards, but since the

Re: [Tutor] A row of cards, but they're all red

2006-01-30 Thread Andre Roberge
On 1/30/06, ->Terry<- <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- [snip] Try reducing your code to only the following: > > Here's the code: > - -- > #!/usr/bin/env python > suits = ["red ", "blue", "green", "yellow"] > ranks = ["ace", "two", "three", "f