Sean's Technology and Writing Blog

Mission Python: Errata and Updates

21 January 2019


My book Mission Python went through extensive quality controls before publication, with each listing built and tested by both myself and the tech editor. My own testing was carried out on both the Raspberry Pi and the Windows PC.

However, I have been alerted to some errors in the book, and some things that need to be changed in the project following software updates. I'll use this blog post to maintain a list of any required changes. We are incorporating these into the book when it is reprinted, so your copy may not have these issues. If the first instruction after the #START# box on p243 is generate_map(), these updates do not apply. The code updates below have been incorporated into the code downloads.

  • The instructions for running Listing 4-1 say that you can run it from IDLE. This will generate an error saying that the name 'images' is not defined. To run this listing, you need to run it from the command line using pgzrun listing4-1.py. For instructions on using the command line to run Pygame Zero programs, please see the Running the Game section in the book's Introduction. When you run this program, the game window will be blank because the program sets up the data but doesn't display anything on the screen yet. If you don't see any error messages and you do see a blank window, your program is working fine. (When you reach Listing 4-3, you should start to see the room on the screen in the window.)
  • The points made above also apply to Listing 4-2: you should run it using pgzrun listing4-2.py and not IDLE. The game window will be blank. You can't use the shell to test the program, but you can add instructions to the end of the program and then run it from the command line. You will see the output in the command line window. Below is some example code to add to the end of Listing 4-2 to complete Training Mission #1 in Chapter 4. Add this code right at the end of the listing, without any indentation. When you've finished testing, make sure you delete this test code to avoid any problems later on.
    ## Test code ##
    current_room = 45
    generate_map()
    print(room_map)
  • On p118, in Listing 7-5, add the instruction generate_map() as shown below. If you need to make this change, you don't need to use Listing 8-3 in the book, which adds this instruction later. In later listings, the generate_map() instruction should come before the clock.schedule_interval() instruction where shown.
    ###############
    ##   START   ##
    ###############
    
    generate_map()
    clock.schedule_interval(game_loop, 0.03)
  • On p178, when you add the code from Listing 10-6 to Listing 10-5, you should save the program as listing10-6.py and run it with pgzrun listing10-6.py. The process and program still works if you reuse the listing10-5.py filename again as described in the book, but the correct process is to use listing10-6.py.

If you experience difficulties, please see also my blog post about compatibility with different software and hardware platforms to those officially supported by Mission Python.

Many thanks to Adriaan van Niekerk, Stéphanie Noardo, Richard Park, and Tim Byers for telling me about these issues.

Since this book was first published, the Raspberry Pi Foundation has removed IDLE from the Raspberry Pi’s default software. It recommends Thonny as an editor that offers a more beginner-friendly environment. You can find the Thonny Python IDE in the Programming part of the applications menu. If you use Thonny, you can see the Shell and your program code at the same time. Where you see instructions to use the pgzrun command to start your program, you may be able to just click the Run button in Thonny instead. The colors used in the code may not match the book’s content, though. It’s easy to install IDLE, which will ensure your experience matches the rest of this book. Follow these steps:

  1. Click the Terminal icon at the top of the screen to open a terminal window.
  2. At the prompt, type in sudo apt-get update and press Enter.
  3. When that command finishes, enter sudo apt-get install idle and press Enter.
  4. You can now access the IDLE editor from the main Raspberry Pi menu. Find it listed as Python 3 (IDLE) in the Programming section.

If you encounter other problems, please feel free to get in touch. We are incorporating these updates and corrections into the ebook and reprints of the paper book.


Permanent link for this post | Blog Home | Website Home

Comments

Post a Comment

Dip into the blog archive

June 2005 | September 2005 | January 2006 | March 2006 | April 2006 | May 2006 | June 2006 | July 2006 | August 2006 | September 2006 | October 2006 | November 2006 | December 2006 | February 2007 | March 2007 | April 2007 | May 2007 | June 2007 | July 2007 | August 2007 | September 2007 | October 2007 | November 2007 | December 2007 | January 2008 | February 2008 | March 2008 | April 2008 | May 2008 | June 2008 | July 2008 | August 2008 | September 2008 | October 2008 | November 2008 | December 2008 | January 2009 | February 2009 | March 2009 | April 2009 | May 2009 | June 2009 | July 2009 | August 2009 | September 2009 | October 2009 | November 2009 | December 2009 | January 2010 | February 2010 | March 2010 | April 2010 | May 2010 | June 2010 | August 2010 | September 2010 | October 2010 | November 2010 | December 2010 | March 2011 | April 2011 | May 2011 | June 2011 | July 2011 | August 2011 | September 2011 | October 2011 | November 2011 | December 2011 | January 2012 | February 2012 | March 2012 | June 2012 | July 2012 | August 2012 | September 2012 | October 2012 | December 2012 | January 2013 | February 2013 | March 2013 | April 2013 | June 2013 | July 2013 | August 2013 | September 2013 | October 2013 | November 2013 | December 2013 | January 2014 | February 2014 | March 2014 | April 2014 | May 2014 | June 2014 | July 2014 | August 2014 | September 2014 | October 2014 | November 2014 | December 2014 | January 2015 | February 2015 | March 2015 | April 2015 | May 2015 | June 2015 | September 2015 | October 2015 | December 2015 | January 2016 | February 2016 | March 2016 | May 2016 | July 2016 | August 2016 | September 2016 | October 2016 | November 2016 | December 2016 | January 2017 | July 2017 | August 2017 | October 2017 | November 2017 | January 2018 | February 2018 | August 2018 | October 2018 | November 2018 | December 2018 | January 2019 | March 2019 | June 2019 | August 2019 | September 2019 | October 2019 | Top of this page | RSS

Credits

© Sean McManus. All rights reserved.

Visit www.sean.co.uk for free chapters from Sean's coding books (including Mission Python, Scratch Programming in Easy Steps and Coder Academy) and more!

Discover my latest books

Mission Python book

Mission Python

Code a space adventure game in this Python programming book published by No Starch Press.

Coder Academy book

Coder Academy

Learn to make games and other programs in Scratch, and make a web page in HTML. Highly interactive book for 7-10 year olds.

Cool Scratch Projects in Easy Steps book

Cool Scratch Projects in Easy Steps

Discover how to make 3D games, create mazes, build a drum machine, make a game with cartoon animals and more!

Walking astronaut from Mission Python book Top | Search | Help | Privacy | Access Keys | Contact me
Home | Blog | Copywriting Services | Books | Free book chapters | Articles | Music | Photos | Games | Shop | About