Re: [Tutor] understanding __import__()

2006-07-26 Thread python-tutor
Sean Perry wrote: Ok, this may be slightly above tutor's level, but hey, never hurts to ask (-: __import__ is dark magic; generally those who venture into that realm would do well to read the C source for Python.. I'm guessing that '.' is not in your sys.path, so Python isn't finding the

Re: [Tutor] assert

2005-12-23 Thread python-tutor
Try this: a=myClass() b=myClass() a.howmany() a.count=0 del a Does this help clear things up? Todd Maynard On Friday 23 December 2005 06:18, shivayogi kumbar wrote: class myClass:                         count = 0                          def __init__(self):                                

Re: [Tutor] assert

2005-12-23 Thread python-tutor
Shivayogi, Sorry my last e-mail wasn't very helpful. Better would have been: a=myClass() b=myClass() a.howmany() myClass.count=0 del a which will (hopefully) give you something like: Exception exceptions.AssertionError: exceptions.AssertionError instance at 0xb7b1d12c in bound

Re: [Tutor] Auto package install?

2005-12-06 Thread python-tutor
Scott, Take a look at setuptools: http://peak.telecommunity.com/DevCenter/setuptools It should handle everything you are looking for with ease. Turbogears ( http://turbogears.org )is a real world project that uses it. So far it seems to be flexible and reliabe for me. Good Luck, --Todd

Re: [Tutor] What can I do with this code?

2005-08-10 Thread python-tutor
How about changing it into a math quiz program? You have the program output random problems (What is 14 * 3 ?) And then you can output appropriate random insults, words of encouragement, or praise as appropriate until the user gets the answer right. Just be careful with division. You

Re: [Tutor] SSH commands in Python on Linux

2005-08-10 Thread python-tutor
Ignoring the python stuff for the moment In answer to Question 1., You want to use Public Key authentication...this will let you log in without a password.Google for SSH Public Key Authentication will give you several hits for the howto's One pretty good one was

Re: [Tutor] deck dealing program

2005-08-08 Thread python-tutor
Are you: a.) Having trouble with the code and looking for help? b.) Looking for suggestions on how to improve the code? c.) Offering the code as a demo for Nathan et al.? I was just doing stuff along the same lines and was having fun seeing the different approaches to the same problem.

Re: [Tutor] Question About chdir()

2005-08-08 Thread python-tutor
Let's see if I can get this right.as I am working on memory and not enough sleep. The 'r' means that using a raw string so the backslashes aren't escaped out The equivalent without using the 'r' would be: os.chdir('c:\\temp') --Todd On Monday 08 August 2005 03:07 am, Don Parris

Re: [Tutor] Get information from a web page

2005-08-08 Thread python-tutor
Not sure exactly what you have going wrong without the code or the exact url you are using. Does something like: import urllib page = urllib.urlopen(http://slashdot.org/article.pl?sid=05/08/08/043236tid=126;).read() print page give you the correct results? Is the problem specific to

Re: [Tutor] What's the invaild syntax? Error message and relative code supplied.

2005-07-31 Thread python-tutor
Remember this problem from yesterday? Take a look at the line before the one you are getting the error on. And count the ('s and the )'s. --Todd On Sunday 31 July 2005 07:38 pm, Nathan Pinno wrote: What the invalid syntax? Here is the error message: SyntaxError: invalid syntax File

Re: [Tutor] What's the invalid synax? Error message and code supplied.

2005-07-30 Thread python-tutor
    I'd count the parenthesis on the prior line: option = int(raw_input('Option (1,2,3,4,5,6,9): ') while option != 9: Also when you notice that you are copying and pasting the same line over and over, it may be time to think about reorganizing the code a little bit (Once you have it

Re: [Tutor] How do I make a Python program keep repeating?

2005-07-30 Thread python-tutor
How does the user indicate that they are done with the program? One solution is to ask at the end of each iteration if they want to repeat. Psuedocode: keep_going=True while(keep_going) Run your program stuff keep_going = get_user_response(Do you want to run again?) --Todd On

Re: [Tutor] When I run this code, it just keeps repeating.

2005-07-30 Thread python-tutor
Looks like you are making some pretty good progress. The short answer to your question is that the menu user input need to be inside the while loop. That way cal_opt has a chance to change value before it gets evaluated by the while loop again. Another comment - the global cal_opt is

Re: [Tutor] Now what do I do?(was Re: When I run this code, it just keeps repeating.)

2005-07-30 Thread python-tutor
You are almost there. Do you undestand why you are getting the output that you are getting? Pretend that you are the computer and walk through what happens when you enter 9 at the menu: while cal_opt != 9: menu() cal_opt = cal() # This is where you entered '9' so

Re: [Tutor] Help with file I/O.

2005-07-30 Thread python-tutor
Have you worked through the diveintopython.org tutorial/book? Chapter 6 covers file handling. If/When you get stuck post your code/question and ask for help. --Todd On Saturday 30 July 2005 11:49 pm, Nathan Pinno wrote: If anyone will help me learn file I/O, it would be appreciated. I went