Re: [Tutor] Tutor Digest, Vol 93, Issue 117

2011-11-20 Thread Mic
Message: 4 Date: Sat, 19 Nov 2011 23:18:01 + From: Alan Gauld To: tutor@python.org Subject: Re: [Tutor] Can I shorten this code? Message-ID: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Most peoples code could be shortened. And most of it would be the worse for it. There ar

[Tutor] Help with error in ski game

2011-11-20 Thread Chloe Beck
Hi, I've just begun trying to teach myself how to program with Python. I'm currently working through the book 'Hello World, Computer programming for kids and other beginners' and am stuck on one of the exercises. The exercise is a take on the SkiFree game. The error message I get is as follow

[Tutor] Beginner Programming Challenges

2011-11-20 Thread Bod Soutar
FOA: Any aspiring new programmers looking for some inspiration or projects. There is a series of programming challenges being run on the ubuntu forums The challenges are aimed at beginners, and although they assume you are running linux, this is not always a requirement.

Re: [Tutor] Help with error in ski game

2011-11-20 Thread bodsda
Just a guess but take a look at the spelling. centerx Or centrex Bodsda Sent from my BlackBerry® wireless device -Original Message- From: Chloe Beck Sender: tutor-bounces+bodsda=googlemail@python.org Date: Sun, 20 Nov 2011 11:58:25 To: Subject: [Tutor] Help with error in ski game

Re: [Tutor] ProgressBar - Python and Powershell

2011-11-20 Thread Nikunj.Badjatya
Can anyone throw some light on this please. ! ? From: tutor-bounces+nikunj.badjatya=emc@python.org [mailto:tutor-bounces+nikunj.badjatya=emc@python.org] On Behalf Of nikunj.badja...@emc.com Sent: Thursday, November 17, 2011 4:21 PM To: tutor@python.org Subject: [Tutor] ProgressBar - Pyt

Re: [Tutor] ProgressBar - Python and Powershell

2011-11-20 Thread bodsda
This is just my opinion but I would have several (say 10) powershell scripts individually called by python, python will sit still until the powershell exits, then update the progress bar by 10% before calling the next script etc etc. Bodsda Sent from my BlackBerry® wireless device -Origin

Re: [Tutor] ProgressBar - Python and Powershell

2011-11-20 Thread Steven D'Aprano
nikunj.badja...@emc.com wrote: Can anyone throw some light on this please. ! ? This is a list for beginners learning Python. Your question is quite advanced for this list, as it involves both threads and subprocesses. It also uses a third-party module, progressbar, and a Windows-only applica

Re: [Tutor] Help with error in ski game

2011-11-20 Thread Steven D'Aprano
Chloe Beck wrote: Traceback (most recent call last): File "/Users/Chloe/Documents/SKI SKI/ski ski ski", line 99, in skier.move(speed) File "/Users/Chloe/Documents/SKI SKI/ski ski ski", line 28, in move if self.rect.centerx < 20: self.rect.centrex = 20 AttributeError: 'pygame.Rect'

[Tutor] Guess my number game

2011-11-20 Thread myles broomes
I asked for advice yesterday with some pseudocode for a 'guess my number' game I wrote up, and I was told to have a go at writing up the actual code. I've had a go but im struggling... #guess my number games #the user thinks of a number between 1 and 100, #the computer then has to try and guess

[Tutor] Shortening code [was Re: Tutor Digest, Vol 93, Issue 117]

2011-11-20 Thread Alan Gauld
Please change to a sensible subject when replying to digest messages. On 20/11/11 11:45, Mic wrote: > I have done my best to make the code more readable now. > Here is the result. from tkinter import* button1_color="green" button1_value=False button2_color="green"

Re: [Tutor] Guess my number game

2011-11-20 Thread Alan Gauld
On 20/11/11 15:29, myles broomes wrote: > ...I was told to have a go at writing up the actual code. Well done, thats a good start. #guess my number games #the user thinks of a number between 1 and 100, #the computer then has to try and guess that number #welcome the player to the game and expl

Re: [Tutor] ProgressBar - Python and Powershell

2011-11-20 Thread Nikunj.Badjatya
Thanks for the reply Steve. I mean, the installer as a sole is single threaded. They way to implement progressbar may turn it to multithreaded. Anyways, I have posted the problem in pyhton-list ml. Thanks Nikunj -Original Message- From: tutor-bounces+nikunj.badjatya=emc@python.org [

[Tutor] \x00T\x00r\x00i\x00a\x00 ie I get \x00 breaking up every character ?

2011-11-20 Thread dave selby
Hi All, I have a long string which is an HTML file, I strip the HTML tags away and make a list with text = re.split('<.*?>', HTML) I then tried to search for a string with text.index(...) but it was not found, printing HTML to a terminal I get what I expect, a block of tags and text, I split the

Re: [Tutor] \x00T\x00r\x00i\x00a\x00 ie I get \x00 breaking up every character ?

2011-11-20 Thread Steve Willoughby
Where did the string come from? It looks at first glance like you have two bytes for each character instead of the one you expect. Is this perhaps a Unicode string instead of ASCII? Sent from my iPad On 2011/11/20, at 10:28, dave selby wrote: > Hi All, > > I have a long string which is an

Re: [Tutor] \x00T\x00r\x00i\x00a\x00 ie I get \x00 breaking up every character ?

2011-11-20 Thread Sarma Tangirala
Would the html parser library in python be a better idea as opposed to using split? That way you have greater control over what is in the html. On 20 Nov 2011 23:58, "dave selby" wrote: > Hi All, > > I have a long string which is an HTML file, I strip the HTML tags away > and make a list with > >

Re: [Tutor] \x00T\x00r\x00i\x00a\x00 ie I get \x00 breaking up every character ?

2011-11-20 Thread Steve Willoughby
On 20-Nov-11 12:04, Sarma Tangirala wrote: Would the html parser library in python be a better idea as opposed to using split? That way you have greater control over what is in the html. Absolutely. And it would handle improper HTML (like unmatched brackets) gracefully where the split will jus

Re: [Tutor] \x00T\x00r\x00i\x00a\x00 ie I get \x00 breaking up every character ?

2011-11-20 Thread Steve Willoughby
It's customary to copy the list with answers, so everyone can benefit who may run into the same issue, too. On 20-Nov-11 11:38, dave selby wrote: It came from some automated HTML generation app ... I just had the idea of looking at in with ghex every other character is \00 , thats mad.

Re: [Tutor] \x00T\x00r\x00i\x00a\x00 ie I get \x00 breaking up every character ?

2011-11-20 Thread Steven D'Aprano
dave selby wrote: I split the HTML and print text and I get loads of \x00T\x00r\x00i\x00a\x00 ie I get \x00 breaking up every character. Any idea what is happening and how to get back to a list of ascii strings ? How did you generate the HTML file? What other applications have you used to

Re: [Tutor] \x00T\x00r\x00i\x00a\x00 ie I get \x00 breaking up every character ?

2011-11-20 Thread Dave Angel
On 11/20/2011 04:45 PM, Steven D'Aprano wrote: Something in the tool chain before it reached Python has saved it using a wide (four byte) encoding, most likely UTF-16 as that is widely used by Windows and Java. With the right settings, it could take as little as opening the file in Notepad,

[Tutor] Is there a way to add paths in Eric?

2011-11-20 Thread Mark Lybrand
I am using Windows Vista. I have some python scripts I have been developing in my learning folder. Can I add the path to the folder in eric to call them interactively, or will I need to move them? -- Mark :) ___ Tutor maillist - Tutor@python.org T

Re: [Tutor] Is there a way to add paths in Eric?

2011-11-20 Thread Mark Lybrand
Okay, I have answered my own question import sys sys.append() Sorry for bothering. Mark On Sun, Nov 20, 2011 at 6:21 PM, Mark Lybrand wrote: > I am using Windows Vista. I have some python scripts I have been > developing in my learning folder. Can I add the path to the folder in eric >

[Tutor] How to get module name from ImportError

2011-11-20 Thread Nikunj.Badjatya
Hi All, Please look at the following snippet. {{{ # User defined modules try: from scripts import precheck from scripts import validate from scripts import constants except ImportError: print("ERROR: One of the modules (..scripts/precheck.py, validate.py, constants) is not presen

Re: [Tutor] How to get module name from ImportError

2011-11-20 Thread Christian Witts
On 2011/11/21 07:54 AM, nikunj.badja...@emc.com wrote: Hi All, Please look at the following snippet. {{{ # User defined modules try: from scripts import precheck from scripts import validate from scripts import constants except ImportError: print("ERROR: One of the modul

Re: [Tutor] How to get module name from ImportError

2011-11-20 Thread Nikunj.Badjatya
Exactly ! Thanks a lot. From: Christian Witts [mailto:cwi...@compuscan.co.za] Sent: Monday, November 21, 2011 11:36 AM To: Badjatya, Nikunj Cc: tutor@python.org Subject: Re: [Tutor] How to get module name from ImportError On 2011/11/21 07:54 AM, nikunj.badja...@emc.com

Re: [Tutor] How to get module name from ImportError

2011-11-20 Thread Dave Angel
On 11/21/2011 01:23 AM, nikunj.badja...@emc.com wrote: Exactly ! Thanks a lot. 1) You really shouldn't top-post. Nor should you try to indicate something with color, since this is a text-based forum. I would suggest that you do not try to parse error messages. (If you're going to just print