[Tutor] help - SyntaxError: Non-UTF-8 code using python 3

Lily Tran lilytran at adobe.com
Thu Aug 9 05:26:35 CEST 2012


Hello;


I am getting the following error when I try to run this python program in eclipse.  I am running python 3:


 File "/Users/lilytran/Desktop/python/Ex_Files_Python_3_EssT/Exercise Files/class_beginner_python/hw3_2_lab6.py", line 30

SyntaxError: Non-UTF-8 code starting with '\xd0' in file  on line 30, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

============================================================


Can you please tell me what I am doing wrong and how do I fix this error?  Below is my program.  Thanks –Lily

====================================================


import random



def MagicEightBallEmulator():

    answers = ["As I see it, yes",

               "It is certain",

               "It is decidedly so",

               "Most likely",

               "Outlook good",

               "Signs point to yes",

               "Without a doubt",

               "Yes",

               "Yes – definitely",

               "You may rely on it",

               "Reply hazy, try again",

               "Ask again later",

               "Better not tell you now",

               "Do not count on it",

               "My reply is no",

               "My sources say no",

               "Outlook not so good",

               "Very doubtful"]


    while True:

        what = random.choice(answers)

    return print(what)


def RunEmulator():

    while True:

        print ('Welcome to Magic 8 Ball!')

        print ('Please ask your question!')

        question = input()

        if question == 'quit':

            break

        MagicEightBallEmulator()



RunEmulator()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120808/04711082/attachment.html>


More information about the Tutor mailing list