On Mon, Aug 4, 2014 at 5:13 PM, Alan Gauld <alan.ga...@btinternet.com>
wrote:

> On 05/08/14 00:21, Greg Markham wrote:
>
>          but I'm running into a syntax error
>>
>
> As others have said you are getting the expected error when running Python
> v3 code under Python v2.
>
> How exactly are you running the program? It looks like somehow you
> are picking up Python v2 when you run the script even though your python
> -V is showing v3.
>
> BTW. Which OS are you using? It shouldn't affect the cause but
> it helps with the debugging!
>
>
>  For clarity, the full program reads as follows:
>>
>>
>> # Game Over - Version 2
>> # Demonstrates the use of quotes in strings
>> # Python Programming for the Absolute Beginner, 3rd ed - Ch 2
>> # Greg Markham - Aug 04, 2014
>>
>> print("Program 'Game Over' 2.0")
>>
>> print("Same", "message", "as before")
>>
>> print("Just",
>>        "a bit",
>>        "bigger")
>>
>
> Does all of the above print out correctly? Can you send
> us a cut n paste of the exact output of the program?
>
>
>
>> print("Here", end=" ")
>> print("it is...")
>>
>> print(
>>          """
>>           _____       ___       ___  ___   _____
>>          /  ___|     /   |     /   |/   | |  ___|
>>          | |        / /| |    / /|   /| | | |__
>>          | |  _    / ___ |   / / |__/ | | |  __|
>>          | |_| |  / /  | |  / /       | | | |___
>>          \_____/ /_/   |_| /_/        |_| |_____|
>>
>>           _____   _     _   _____   _____
>>          /  _  \ | |   / / |  ___| |  _  \
>>          | | | | | |  / /  | |__   | |_| |
>>          | | | | | | / /   |  __|  |  _  /
>>          | |_| | | |/ /    | |___  | | \ \
>>          \_____/ |___/     |_____| |_|  \_\
>>
>>          """
>>       )
>>
>> input("\n\nPress the enter key to exit.")
>>
>
> finally you could try putting the following at the very top of your
> program:
>
> import sys
> print(sys.version)
>
> That will definitively prove that you are actually
> running v3 on the file...


Aaaah, brilliant!  You were right!

I:\Programming\Scripts\Learning\chapter02>game_over2.py
2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)]

I installed ver 2.7.8 initially then some time later installed ver 3.4.1
upon starting the above mentioned book which uses that version.  I thought
I had handled the problem by renaming the executables to python27.exe and
pythonw27.exe as well as modifying the path statement to point to where the
latest version was installed, but that appears not to have been enough.  To
avoid further confusion, I'm uninstalling both versions and reinstalling
the latest now so as to reset the file associations which have become a
little out of sorts from all my tampering.

Thanks for helping me get to the heart of it!

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

Reply via email to