Re: [Tutor] python2 vs python3 urllib

2011-04-25 Thread pierre dagenais
On 11-04-23 06:58 PM, pierre dagenais wrote: The following code works as expected with python version 2.6.5, but with version 3.1.2 I get the following error: pierre:/MyCode/mesProjets$ py3 test.py Traceback (most recent call last): File "test.py", line 3, in sock = urllib.urlopen("http://div

Re: [Tutor] Virtualenv Error

2011-04-25 Thread Alan Gauld
"Malcolm Newsome" wrote I installed virtualenv and am getting this error when trying to create one. I'm running Windows 7. Can anyone help?? I've no idea what virtuialenv is or does but it doesn't sound like a Python beginners questuion You might get more success asking on the general

[Tutor] Unbound Method Error

2011-04-25 Thread Greg Nielsen
Because of the limited Python 3 support, I've decided to attempt to push my over 600 lines of code back to Python 2.6. Surprisingly, it worked well for the most part, except for the following section of code. crash = pygame.sprite.spritecollide(playerCar, computerSprites, False) if crash:

Re: [Tutor] Unbound Method Error

2011-04-25 Thread Steven D'Aprano
Greg Nielsen wrote: In Python 2.6.6, this section of code returns the following error TypeError: unbound method collide() must be called with BlueCarSprite instance as first argument (got GreenCarSprite instance instead) Please copy and paste the actual traceback, as that will show the *actu

Re: [Tutor] Unbound Method Error

2011-04-25 Thread Greg Nielsen
First and foremost, thank you Steven for your quick and well written response. It means a lot to me that you took the time out of your day to answer my question, and it has really helped me better understand what it going on. So the full trace back for my error is as follows: Traceback (most rece

[Tutor] voluntary work

2011-04-25 Thread Edgar Almonte
someboy have some project where can take a very noob and with very little knowledgement of python in the arm where i can work voluntary of course ? the thing is i want learn i read a bit and do some exercises but i am the kind of ppl that need saw the path that will walk so need a route and a littl

Re: [Tutor] Assistance

2011-04-25 Thread Prasad, Ramit
>>while numberOfGrades != gradesEntered: >>grade = int(raw_input("Please enter the grade:" )) >>gradesEntered += 1 >>score =+ grade >Note that += and =+ do different things. I suspect this last line is >not doing what you think. Details like this are very important in >

Re: [Tutor] Unbound Method Error

2011-04-25 Thread Prasad, Ramit
Disclaimer: I have no knowledge of PyGame. I think your original is a lack of checking types. You are calling BlueCar/GreenCar/Truck.collide regardless of the car type. If you pass a TruckSprite to BlueCarSprite.collide it makes sense (without knowledge of PyGame) that it would fail because it

Re: [Tutor] Assistance

2011-04-25 Thread Wayne Werner
On Mon, Apr 25, 2011 at 9:59 AM, Prasad, Ramit wrote: > >>while numberOfGrades != gradesEntered: > >>grade = int(raw_input("Please enter the grade:" )) > >>gradesEntered += 1 > >>score =+ grade > > >Note that += and =+ do different things. I suspect this last line is >

Re: [Tutor] voluntary work

2011-04-25 Thread Alan Gauld
"Edgar Almonte" wrote is i want learn i read a bit and do some exercises but i am the kind of ppl that need saw the path that will walk so need a route and a little of guide to keep going , Have you looked at the python web site? There is a whole section dedicated to tutorials for people who

Re: [Tutor] Assistance

2011-04-25 Thread Wayne Werner
On Mon, Apr 25, 2011 at 1:13 PM, Prasad, Ramit wrote: > b = + 2 is legal syntax, while b + = 2 is not. > > Why do you 'b += 2' is not legal syntax? It seems to work in python 2.x and > 3.x. Is this deprecated or looked down upon? Is it better to use 'b = b + 2' > ? > > For the +2, it did not even

Re: [Tutor] Assistance

2011-04-25 Thread Prasad, Ramit
b = + 2 is legal syntax, while b + = 2 is not. Why do you 'b += 2' is not legal syntax? It seems to work in python 2.x and 3.x. Is this deprecated or looked down upon? Is it better to use 'b = b + 2' ? For the +2, it did not even occur to me that it was referring to a positive number and not so

Re: [Tutor] voluntary work

2011-04-25 Thread Edgar Almonte
Thanks , but i still are looking for some small project to get work that let me learn in a more interesting way. i not that kind of person that can start app from zero so is hard for me learn new things without some kind of goal. thanks again. On Mon, Apr 25, 2011 at 1:33 PM, Alan Gauld wrote:

Re: [Tutor] voluntary work

2011-04-25 Thread Wolf Halton
"Learn Python the Hard Way" is pretty cool. I am always looking for books that lay it out well. Thanks for mentioning it, and good luck with your studies. I find that having a project that is a little beyond me helps me get better at coding. -Wolf On Mon, Apr 25, 2011 at 1:33 PM, Alan Gauld wr

Re: [Tutor] voluntary work

2011-04-25 Thread Rafael Durán Castañeda
I recommend you visit www.pythonchallenge.com On 25/04/11 20:42, Wolf Halton wrote: "Learn Python the Hard Way" is pretty cool. I am always looking for books that lay it out well. Thanks for mentioning it, and good luck with your studies. I find that having a project that is a little beyond

Re: [Tutor] Unbound Method Error

2011-04-25 Thread Greg Nielsen
Ramit, First, thank you for your input and insight into my problem, I believe that the code you came up with should not only be more efficient, but also clear up the last of my issues. I just have a quick question on the isinstance command you called. How exactly do I get the code to recogniz

Re: [Tutor] Unbound Method Error

2011-04-25 Thread Prasad, Ramit
Hi Greg, You must use the class definition not an instance/object of it. If the class is called CarClass from some_lib_a.sub_lib_b import CarClass [...] isinstance(car, CarClass) OR import some_lib_a [...] isinstance(car, some_lib_a.sub_lib_b.CarClass) The following does NOT work: isinstance(c

Re: [Tutor] voluntary work :p:

2011-04-25 Thread Thomas C. Hicks
On Mon, 25 Apr 2011 15:09:02 -0400 Rafael Durán Castañeda wrote: > I recommend you visit > www.pythonchallenge.com > > On 25/04/11 20:42, Wolf Halton wrote: > "Learn Python the Hard Way" is pretty cool. I am always looking for > books that lay it out well. Thank

Re: [Tutor] voluntary work :p:

2011-04-25 Thread Edgar Almonte
Thanks all for the answer, python challenge is cool but i think need more python and programing level that i current have, ( i ended looking for the answer at google ) i will continue reading "Learn Python the Hard Way" 2011/4/25 Thomas C. Hicks : > On Mon, 25 Apr 2011 15:09:02 -0400 > Rafael Du

[Tutor] after(), how do I use it?

2011-04-25 Thread michael scott
Hello, I asked for help in another location and it solved my problem, but the only problem is I don't fully understand the after function. Here is part of the code that was given to me. def print_label_slowly(self, message): '''Print a label one character at a time using the event

Re: [Tutor] after(), how do I use it?

2011-04-25 Thread Adam Bark
On 26/04/11 01:36, michael scott wrote: Hello, I asked for help in another location and it solved my problem, but the only problem is I don't fully understand the after function. Here is part of the code that was given to me. def print_label_slowly(self, message): '''Print a label

Re: [Tutor] Unbound Method Error

2011-04-25 Thread Steven D'Aprano
Greg Nielsen wrote: if isinstance(car, redracersprites26.BlueCarSprite()): TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types Don't instantiate the class. Instead of redracersprites26.BlueCarSprite() # makes a new instance just refer to the class object w

Re: [Tutor] after(), how do I use it?

2011-04-25 Thread michael scott
Here is the code in its entirety, it works although I don't see after() defined, so I assumed it was a built in function. I can just copy and paste parts of this code into my project, so its not imperative that I understand, but I prefer to use the weapons I've been given. So I hope that you g

Re: [Tutor] after(), how do I use it?

2011-04-25 Thread Wayne Werner
On Mon, Apr 25, 2011 at 8:02 PM, michael scott wrote: > Here is the code in its entirety, it works although I don't see after() > defined, so I assumed it was a built in function. I can just copy and paste > parts of this code into my project, so its not imperative that I understand, > but I prefe

Re: [Tutor] after(), how do I use it?

2011-04-25 Thread Edgar Almonte
after(delay_ms, callback=None, *args) [#] Registers an alarm callback that is called after a given time. This method registers a callback function that will be called after a given number of milliseconds. Tkinter only guarantees that the callback will not be called earlier than that; if t

Re: [Tutor] after(), how do I use it?

2011-04-25 Thread michael scott
Now I understand what I misunderstood. Well he imported Tkinter as tk, so I thought if it belonged to Tkinter it would be tk.after(), but the after was attached to the app, so it was in actuality app.after() . app inherits from the tk class (taking with it all its methods), so its a built in fun

Re: [Tutor] after(), how do I use it?

2011-04-25 Thread Wayne Werner
On Mon, Apr 25, 2011 at 8:34 PM, michael scott wrote: > So I know it takes 2 arguments, and I know to use it recursively in my > problem, so now I understand enough about this function to put it to good use > :) Thank you. > > Technically speaking it's not a recursive function call, it registers

Re: [Tutor] Unbound Method Error

2011-04-25 Thread Greg Nielsen
And it works! Thank you once again to both Steven and Ramit for your peerless insight into the workings of Python and for taking time out of you day to help me work my code back to Python 2. I have learned much by talking with both of you over the last day or so. Greg _

Re: [Tutor] voluntary work :p:

2011-04-25 Thread Wolf Halton
I didn't get anything out of pythonchallenge. All seems static. Do you need flash or something to make the magic happen? On Mon, Apr 25, 2011 at 7:29 PM, Edgar Almonte wrote: > Thanks all for the answer, python challenge is cool but i think need > more python and programing level that i curren

Re: [Tutor] voluntary work :p:

2011-04-25 Thread bob gailer
On 4/25/2011 11:59 PM, Wolf Halton wrote: I didn't get anything out of pythonchallenge. Nothing? No web pages? All seems static. Now you say All instead of nothing. Did you get more than 1 web page? Do you need flash or something to make the magic happen? What are you expecting? What ma