Re: [Tutor] Assistance with UnicodeDecodeError

2015-01-31 Thread Dave Angel

On 01/31/2015 08:37 AM, J Mberia wrote:

Hi,



Welcome to Python tutor.  Thanks for posting using text email, and for 
specifying both your Python version and Operating system.



I am teaching myself programming in python and assistance with
UnicodeDecodeError

I am trying to scrap text from a website using Python 2.7 in windows 8 and
i am getting this error *"**UnicodeDecodeError: 'charmap codec can't encode
character u'\u2014 in position 11231 character maps to "*

*How do i resolve? Pls assist.*



You can start by posting the whole error message, including the stack 
trace.  Then you probably should include an appropriate segment of your 
code.


The message means that you've got some invalid characters that you're 
trying to convert.  That can either be that the data is invalid, or that 
you're specifying the wrong encoding, directly or implicitly.


--
DaveA
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Umm.. I need help on changing Global Variables.

2015-01-31 Thread Dave Angel

On 01/29/2015 12:16 PM, Tallen Grey Smith wrote:

So, I’m trying to make a very simple game that involves time management 
properly, but I’m having an issue.






thats my code, and I want it to where if I type charge  it’ll make my charge go up 10, my steps go down 1, my divs going down 

1, and it to go to

Python (like any modern procedural language) does not have a goto 
command.  You're calling the other function, which means that eventually 
the other function will return back to game().  That's probably a big 
mistake, but it won't matter for the moment.



my charge_1 function, which should do the same thing but with a tweaked dialog 
box



I don't see any dialog boxes in that code.


 But no matter how hard i try, once it gets to the charge_1, it always says
that the variables that I changed where referenced in previous functions and it 
can’t pull them.


Don't paraphrase the effect.  Show just what got displayed.  I've never 
seen an exception called "it can't pull them"




How can I change this to get a variable that when changed in my If statement, 
would be useable in other functions?
Thanks.


Use of global variables is thoroughly discouraged.  I'd suggest making a 
Game class, and making all these "variables" attributes of an instance 
of Game.  Then you just pass that instance around between the various 
functions, as a formal parameter.


--
DaveA
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Lost message re serial comms - oops!

2015-01-31 Thread Alan Gauld

On 31/01/15 00:39, Alan Gauld wrote:

While managing the moderation queue I saw a message about using Python
for serial comms using a RaspberryPi. It came from a C/C++ programmer
wanting to use python.

I think I accidentally hit reject instead of accept.


The OP resent the post and I definitely approved it this time
but it still hasn't come through. Could the OP please mail me
direct so I can figure out what's going wrong.

apologies,

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Assistance with UnicodeDecodeError

2015-01-31 Thread J Mberia
Hi,

I am teaching myself programming in python and assistance with
UnicodeDecodeError

I am trying to scrap text from a website using Python 2.7 in windows 8 and
i am getting this error *"**UnicodeDecodeError: 'charmap codec can't encode
character u'\u2014 in position 11231 character maps to "*

*How do i resolve? Pls assist.*

*Jerry*
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor