Errata

Head First Python

Errata for Head First Python

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Printed
Page 324
4th paragraph

In sentence that describes overriding the dunder for the greater-than operator (>), shouldn't it say to override the __gt__ method (not the __ge__ method)?

Note from the Author or Editor:
Yes, this should read __gt__.

Note: this is an errata for the 2nd edition, not the first.

Anonymous  Jan 16, 2019 
Printed
Page 310
1st para

First sentence following "Hooking into the "with" Statement":
"At stated at the end..." should be "As stated at the end"

Note from the Author or Editor:

Note: this is an errata for the 2nd edition, not the first.

Anonymous  Jan 16, 2019 
Printed
Page 21
top

Please be careful to point out that indents in IDLE are really important. The following function, when I used returns to put the next line of code in will produce a syntax error on 'else'. You have to put the indent (as below) back again to line up with if. It took me a while to work out!

def print_lol(the_list):
for each_item in the_list:
if isinstance(each_item, list):
print_lol(each_item)
else:
print(each_item)

Note from the Author or Editor:
Noted. Thanks.

Jonathan Richards  Apr 16, 2016 
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 260-263
Chapter 8


Hello,

The following sections in chapter 8 on small devices are not valid any more :

Configure the SDK and emulator
Install and configure Android Scripting
Add Python to your SL4A installation

Could you provide updates on the available urls for Android SDK and “Scripting Language for Android” that work ?

Regards
P. Barnes

Note from the Author or Editor:
With the passing of time, some of the libraries that I used in the first edition no longer work as described in the book - this is hard to guard against, as I have no control over these "external" projects. That said, we are in the process of writing the 2nd edition (I'm six chapters in as of Feb 2016). The 2nd edition removes the Android material due to the fact that it's all a bit of a fast-moving target (shifting sand, so to speak). There are no plans to amend the first edition to address your raised issues as - by the time we find the time to do so - the second edition will be out and the first edition will be retired. That said, I'm sorry you are having trouble with this material. As a workaround, you could use a virtualbox to install all of the (older) versions used in the book and get the code to work that way. It's a little bit of extra work, but quite doable.

--Paul.

Anonymous  Feb 18, 2016 
Printed, PDF, ePub, Mobi,
Page 58
first code box

text printed in handwriting should be "These two lines look OK." instead of "Thes two lines look OK."

Note from the Author or Editor:
Yes, change "Thes" to "These".

nenad  Oct 11, 2014 
Printed, PDF, ePub, Mobi,
Page 337,338
athletes = athletemodel.get_from_store()

On both, generate_timing_data.py (page 337) and generate_data.py (page 338), athletes is declared as: athletes = athletemodel.get_from_store(). However, the function get_from_store() was eliminated from athletemodel.py on page 331 and it was not replaced. I believe that this function needs to be recreated and it should return a dictionary that contains the data of all the athletes, or both generate_timing_data.py and generate_data.py need to be modified.

Note from the Author or Editor:
This has been added to the list of fixes for the 2nd edition. Thanks for bringin this to my attention.

Miguel Brito  Mar 12, 2014 
Printed, PDF,
Page 284
1st paragraph

typo: change "messgage" to "message"

Note from the Author or Editor:
Well spotted. Thanks, and noted.

--Paul.

Anonymous  Jul 11, 2013  Aug 29, 2014
Printed, PDF, ePub, Mobi,
Page 197-225
Various Places

Not sure if I'm missing something, but what happened to the sanitize() function between pages 197 and 225?

On 197, it's noted that the sanitize function is still used, and indeed, in subsequent code, it is still called. On page 208, AthleteList still uses it and it's implied that it's defined outside of the class. However, in the IDLE session on page 225, it's not in scope after the call to dir(). Certainly, AthleteList won't work without it.

Note from the Author or Editor:
Check out the code on page 210, which shows it (alive and well) at the top of the program listing. And, yes, it appears to be MIA at the top of page 225 within that dir() listing. It should be in that list, but isn't.

Shu Chow  Jan 29, 2013  Aug 29, 2014
PDF, ePub, Mobi, , Other Digital Version
Page 423
2nd to last paragraph

"the club?s Android?s phones."

excessive possessive; should be "the club?s Android phones."

Note from the Author or Editor:
"Android's" should be "Android".

mcmark64  Aug 23, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 420
first and fourth code examples at bottom of page

wrong kind of single quotes on entries: '59:59?, '56:29?

Note from the Author or Editor:
Replace typographical quote after 59:59.

mcmark64  Aug 23, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 414
entire page

The book never says to add lines to the test script for searching using the given user input.

Note from the Author or Editor:
The text needs to be clearer as to what the learner has to do here. (Beef up the description).

mcmark64  Aug 23, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 409
2nd to last sentence

the comprehensions results,"

incorrect possessive, should be "the comprehension's results,"

Note from the Author or Editor:
Change "comprehensions" to "comprehension's" in bottom paragraph.

mcmark64  Aug 23, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 407
middle paragraph

"associated columns headings"

Should be "associated column headings" or "associated columns' headings".

Note from the Author or Editor:
Change "columns" to "column's" in middle of page.

mcmark64  Aug 23, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 402
2nd sentence in 1st paragraph

"might help here?"

The sentence should end in a period instead of a question mark.

Note from the Author or Editor:
Remove "?" after "might help here".

mcmark64  Aug 23, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 401
last sentence in first comment above the data listing

Because the[y] have no affect on the timing data,

Change "the" to "they".

Note from the Author or Editor:
Change "the" to "they".

mcmark64  Aug 23, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 443
last paragraph, first sentence

PyQT is actually written PyQt (with a lowercase 't').

Note from the Author or Editor:
Change "PyQT" to "PyQt".

mcmark64  Aug 23, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 440
1st comment on right-hand side

Jeff Friedl?s regular expression ?bible?, which is well worth a look if you want to learn more.

Awkward sentence. Perhaps remove the word "which".

Note from the Author or Editor:
Remove ", which" from the first comment.

mcmark64  Aug 23, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 438
4th paragraph, 3rd sentence

add it to your modules documentation strings

missing possessive apostrophe: should be modules'

Note from the Author or Editor:
Replace "modules" with "module's".

mcmark64  Aug 22, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 436
last paragraph, first sentence

course,there

missing space after comma

Note from the Author or Editor:
Add a space after "And, of course,".

mcmark64  Aug 22, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 436
2nd paragraph, 3rd sentence

comes in various licencing flavor

should be "flavors"

Note from the Author or Editor:
"flavour" should read "flavours".

mcmark64  Aug 22, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 428
2nd comment on rhs of page

Ask your user *to* enter the recorded time.

Add the word "to".

Note from the Author or Editor:
Third comment on RHS: insert "to" before "enter".

mcmark64  Aug 22, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 428
1st paragraph, 2nd and 3rd sentences

Space missing between sentences: code.You

Note from the Author or Editor:
Add a space as indicated.

mcmark64  Aug 22, 2012  Aug 29, 2014
Other Digital Version
68
First line of code

The *code sample* for chapter 1, page 68 give "indent=True" while the ebook page gives "indent=False".

Note from the Author or Editor:
The downloadable ZIP for Chapter 2 sets the indent parameter to "True" in the Page 68 code, while the book/PDF sets it to "False". I'll update the code anon.

elliottwinslow  Aug 10, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 386
1st para 2nd sentence

Change "brwoser" to "browser".

Note from the Author or Editor:
Change "brwoser" to "browser" in first paragraph.

Mark A. McLaughlin  Jul 14, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 385
top note on right-hand side

Phrase "you?ll need to revert one of the options" should be "you?ll need to revert to one of the options."

Note from the Author or Editor:
Add the word "to" after the word "revert" in the hand-written note.

Mark A. McLaughlin  Jul 14, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 372
1st Paragraph

No space between third and fourth sentences: "too.Your" (There is an errata report for this typo on page 371 but not one for page 372.)

Note from the Author or Editor:
Add space as indicated. Also on page 371, same location, same problem.

Mark A. McLaughlin  Jul 14, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 370
last sentence to the left of the code block

Change "an new" to "a new."

Note from the Author or Editor:
Replace "an new" with "a new".

Mark A. McLaughlin  Jul 14, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 360
1st Paragraph

The phrase "the column type associated piece of data stored in a row" should be "the column type associated with a piece of data stored in a row."

Note from the Author or Editor:
Add the words "with a" before "piece" in second paragraph.

Mark A. McLaughlin  Jul 14, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 357
1st paragraph, 5th sentence

Change "browse and select your web app?s folder" to "browse to and select your webapp?s folder."

Note from the Author or Editor:
Add the word "to" after "browse".

Mark A. McLaughlin  Jul 08, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 355
throughout the page

App Engine now supports both Python 2.5 and 2.7.

Note from the Author or Editor:
But it didn't when the book was published, so this isn't really an error in the book. This will be considered as part of the second edition.

Mark A. McLaughlin  Jul 08, 2012 
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 350
first paragraph

The phrase "your evey expanding Python toolbox" should be "your ever-expanding Python toolbox." (Two changes: y changed to r and the addition of a hyphen.)

Note from the Author or Editor:
Change "evey " to "ever-" at top of page.

Mark A. McLaughlin  Jul 08, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 348
second sentence of third paragraph after screenshot

The phrase "it's database API" should be "its database API."

Note from the Author or Editor:
Change "it's database" to "its database".

Mark A. McLaughlin  Jul 08, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 345-347
dialog box timing message

The timing message would be more grammatically correct if it included the preposition "for", i.e., 'Provide a new timing value for '.

Note from the Author or Editor:
In the pool, add the word "for" to the end of "Provide a new timing value".

Mark A. McLaughlin  Jul 08, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 341
end of first sentence

The phrase "the same folder your index.html file" should be "the same folder as your index.html file". Add the word "as".

Note from the Author or Editor:
Add the word "as" after "folder" in first paragraph.

Mark A. McLaughlin  Jul 08, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 333
last sentence of first paragraph under the code block

There is an extra period in the text. "This is coming along. nicely." should be "This is coming along nicely."

Note from the Author or Editor:
Remove the full-stop (period) after the word "along" at bottom of page.

Mark A. McLaughlin  Jul 07, 2012  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 304
Text on right side of image

The phrase "bring ups" should be "brings up".

Note from the Author or Editor:
Change "bring up" to read "brings up".

Mark A. McLaughlin  Jul 07, 2012  Aug 29, 2014
Printed, PDF,
Page 47
Chapter 2 in general

The good folk over at PyPI have created a new "testing site" for Python modules: http://testpypi.python.org/pypi - this is the site you should use to practice uploading as per Chapter 2 of the book. There's a tonne of nester modules on the real, live PyPI site that really shouldn't be there (as the world only needs *one* nester module). If you use the testing site when doing the exercises in Chapter 2, we can all keep the main site free from unnecessary copies of the nester module.

Thanks for your cooperation with this.

--Paul.

Note from the Author or Editor:
This needs to be top of the list for any future second edition of this book.

Paul Barry  May 09, 2012 
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 246
Last 2 lines

Problem with YATE & following line of code:
print(yate.include_footer({"Home?: "/index.html", "Select another athlete": "generate_list.py"}))

Due to the unpredictable nature of how Python orders the dictionary items (i.e. not necessarily in order of input), the order of the HOME/Select Another links might differ depending on wording. For example:

>>> a = {"Home": "/index.html", "Select Another Athlete": "generate_list.py"}
>>> b = {"Home": "/index.html", "Select another runner": "generate_list.py"}
>>> print(a)
{'Home': '/index.html', 'Select Another Athlete': 'generate_list.py'}
>>> print(b)
{'Select another runner': 'generate_list.py', 'Home': '/index.html'}

Changing "Athlete" to "Runner" results in the "Select Another Runner" option being the first item in the dictionary which, because of the way the include_footer function is setup, will mean the HOME link will come last every time. Using sequential operations with a dictionary like this seems like a poor choice.

Note from the Author or Editor:
Yes, changing the code changes how it behaves, especially when working with dictionaries (which do not maintain insertion order). An "OrderedDict" has recently been added to Python which might help with this issue. Of course, I cannot make any guarantees about how the code in the book behaves after you decide to change it.

Anonymous  Apr 03, 2012 
Printed, PDF,
Page 333
1st paragraph under code box

"This function is a more involved than" should be "This function is more involved than".

Note from the Author or Editor:
Remove the word "a" from the sentence.

mcmark64  Jan 13, 2012  Aug 29, 2014
Printed, PDF,
Page 310
First Answer, Last Sentence

The phrase "we might have been designed" should be "we might have designed."

Note from the Author or Editor:
Remove the word "been" from this sentence.

mcmark64  Jan 06, 2012  Aug 29, 2014
Printed, PDF,
Page 291
Last bullet point

In the last bullet point the phrase "input streams" should be "input/output streams".

Note from the Author or Editor:
Remove the word "input" from before "streams",

mcmark64  Dec 17, 2011  Aug 29, 2014
Printed, PDF,
Page 279-287
entire chapter section

This section of Chapter 8 (pp. 279-287) is a little difficult to follow page to page. For example, the Sharpen your Pencil Solution given on page 280 assumes you know that your data is being returned as a dictionary, but that is not discussed until page 285, and the listing of the complete Android app on pp. 281-282 includes changes to the athlete_title that are not mentioned until page 286 (Do this!). Hence a few of my previous errata submissions are not errata but misunderstanding.

Note from the Author or Editor:
To be re-worked and fixed in the 2nd edition.

mcmark64  Dec 17, 2011 
Printed, PDF,
Page 280 & 282
athlete_title

The athlete_title string shown on page 280:
athlete_title = which_athlete + ' top 3 times:'
does not match that shown on page 282:
athlete_title = athlete['Name'] + ' (' + athlete['DOB'] + '), top 3 times:'

Note from the Author or Editor:
Yes.. there's an inconsistency here. To be fixed in 2nd edition.

mcmark64  Dec 17, 2011 
Printed, PDF,
Page 281
The athlete?s data CGI script

The call to as_dict is missing from the last line of the athlete?s data CGI script listing, i.e., the last line should be:
print(json.dumps(athletes[athlete_name].as_dict))

Note from the Author or Editor:
Code should read "print(json.dumps(athletes[athlete_name].as_dict))" as described.

mcmark64  Dec 17, 2011  Aug 29, 2014
Printed, PDF,
Page 279-280
Sharpen your pencil Exercise

It is unclear why the data being sent to the web server via the send_to_server() function is formatted as a dictionary. It is also not mentioned that the data returned by the web server is in the form of a dictionary. It would be better to review the code for the generate_data.py script before this exercise is given.

Note from the Author or Editor:
Noted to be better described/explained in the second edition.

mcmark64  Dec 17, 2011 
Printed, PDF,
Page 275
quit_msg

The string for quit_msg contains a typographical single quote.

Note from the Author or Editor:
Change the typographical quotes to be code quotes.

mcmark64  Dec 17, 2011  Aug 29, 2014
Printed, PDF,
Page 270
Sharpen your pencil Solution

The instructions for this exercise state: "returns the list of athlete names as a string." But the function as written returns a list of strings not a list "as a string."

Note from the Author or Editor:
Change "... athlete names as a string" to read "... athlete names as a list of strings".

mcmark64  Dec 17, 2011  Aug 29, 2014
Printed, PDF,
Page 266
7th response

The phrase "You need an data interchange format" should be "You need a data interchange format".

Note from the Author or Editor:
Change Jill's line to read "You need a " not "You need an".

mcmark64  Dec 17, 2011  Aug 29, 2014
Printed, PDF,
Page 258
Sharpen your pencil Solution

The most promising site for the search now is:
http://code.google.com/p/python-for-android/

Note from the Author or Editor:
This is due to the fact that the Python for Android project was created after the book went to press.

mcmark64  Dec 17, 2011 
Printed, PDF,
Page 244
1st paragraph, 2nd sentence

The phrase "your need to generate a new HTML page" should be "you need to generate a new HTML page".

Note from the Author or Editor:
Change "your" to read "you".

mcmark64  Dec 17, 2011  Aug 29, 2014
Printed, PDF,
Page 233
code for testing u_list function

The code for testing the u_list function is missing ">>> " and is printed in blue (in the PDF) when it should be black, i.e.,
>>> u_list(['Life of Brian', 'Holy Grail'])

Note from the Author or Editor:
Add the ">>>" prompt to the start of the u_list line and color it in black as per other examples.

mcmark64  Dec 17, 2011  Aug 29, 2014
Printed, PDF,
Page 231
description of function "header"

The phrase "(H1, H2, H2, and so on)" should be "(H1, H2, H3, and so on)".

Also, there are two periods after the first sentence: "as the default.."

Note from the Author or Editor:
Change "H1, H2, H2, " to read "H1, H2, H3, ".

mcmark64  Dec 17, 2011  Aug 29, 2014
Printed, PDF,
Page 224
code for put_to_store function

The error message "File error (put_and_store):" should be "File error (put_to_store):".

Also, this code contains some typographical quotes.

And the code does not handle pickling errors.

Note from the Author or Editor:
"put_and_store" should read "put_to_store".

mcmark64  Dec 17, 2011  Aug 29, 2014
Printed, PDF,
Page 217
second sentence of first paragraph under substeps

The phrase "and sent it back to the browser" should be "and send it back to the browser".

Note from the Author or Editor:
Change "sent" to read "send" as indicated.

mcmark64  Dec 17, 2011  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 212
third from last bullet point

The phrase "in order to associate it data with its instance" should be "in order to associate its data with its instance."

Note from the Author or Editor:
Change "it data" to "its data" in third from last bullet point.

mcmark64  Dec 16, 2011  Aug 29, 2014
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 208
new test code at the bottom of the page

The test code contains typographical quotes instead of programmer quotes.

Note from the Author or Editor:
Change the typographical quotes in last five lines of code.

mcmark64  Dec 16, 2011 
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 209
last question

The phrase "you can import the into your code" should be "you can import it into your code".

Note from the Author or Editor:
Change "import the into" to "import it into".

mcmark64  Dec 16, 2011  Aug 29, 2014
Printed, PDF,
Page 200
Sharpen your pencil Solution

The text in the "Sharpen your pencil Solution" contains printers quotes instead of code quotes.

Note from the Author or Editor:
Change all "printers quotes" to be code quotes.

mcmark64  Dec 16, 2011 
Printed, PDF,
Page 136
Line starting with "Yes, almost too exciting for words"

The period after the word created should be a comma.

Note from the Author or Editor:
Replace the "." with a ",".

mcmark64  Dec 13, 2011  Aug 29, 2014
Printed, PDF,
Page 136
Line starting with "Next up:"

There is no space between the two sentences on this line: to unpickle.Create an empty list ...

Note from the Author or Editor:
Add a space before the "C".

mcmark64  Dec 13, 2011  Aug 29, 2014
Printed, PDF,
Page 126
Third sentence of comment for print_lol function

The word "it's" should be "its" in the sentence ending with "printed to the screen on it's own line."

Note from the Author or Editor:
Yes, this is an issue in the comment (in green) in the code. Requires a new screen-shot from me to fix - it's *not* text.

mcmark64  Dec 13, 2011  Aug 29, 2014
Printed, PDF
Page 126
Section title at top of page

The underscore which should be between "print" and "lol," i.e., "print_lol" appears underneath the 'n' and 't' in the word "print."

Note from the Author or Editor:
This is *not* an issue in the first printing, but appears to be in the PDF.

mcmark64  Dec 13, 2011  Aug 29, 2014
Printed, PDF,
Page 422, 423, 426, 429
pp. 422-3, 429 IDLE screenshots, p. 426 Sharpen your pencil

As with p. 421, 'predicited' should be 'predicted'

Note from the Author or Editor:
Uuuugugh! There's an error in the code at the bottom of the screenshot. This needs a new screenshot, but the code can be changed to remove the misspelling of "predicted".

Anonymous  Nov 21, 2011  Aug 29, 2014
Printed, PDF,
Page 417
Last sentence

"Let's try it with some of data..." should be "Let's try it with some data..."

Note from the Author or Editor:
Remove "of" from the second paragraph.

Anonymous  Nov 21, 2011  Aug 29, 2014
Printed, PDF,
Page 368
2nd code snippet, 2nd hand-written note

The note pointing to the line

"class BirthDetailsForm(djangoforms.ModelForm):"

states that the new class inherits from the "djangoforms.Model" class when it should say it inherits from the "djangoforms.ModelForm" class.

Note from the Author or Editor:
Change "djangoforms.Model" to read "djangoforms.ModelForm" in the third hand-written note on this page.

Anonymous  Nov 20, 2011  Aug 29, 2014
Printed, PDF,
Page 366
2nd paragraph, 1st sentence

The words "with" and "which" appear to have been swapped:

"...write code with starts a new form, displays the form fields, terminates the form which a submit button..."

Note from the Author or Editor:
In the second paragraph of point 1, change "...write code with starts a new form, displays the form fields, terminates the form which a submit button..."
to read "...write code which starts a new form, displays the form fields, terminates the form with a submit button..."

Anonymous  Nov 20, 2011  Aug 29, 2014
Printed, PDF,
Page 355
2nd paragraph

SKD should be SDK in first line "Download the GAE Python SKD..."

Note from the Author or Editor:
Change "GAE Python SKD" to read "GAE Python SDK".

Anonymous  Nov 20, 2011  Aug 29, 2014
Printed, PDF,
Page 374
Last paragraph. Last sentence.

handers

should read:

handlers

Note from the Author or Editor:
Change "handers" to "handlers" as indicated.

terracoda  Nov 14, 2011  Aug 29, 2014
Printed, PDF,
Page 371
First paragrpah. Third line.

No space after period that ends the sentence in the middle of the line.

"too.Your"

Note from the Author or Editor:
Add a space as indicated.

terracoda  Nov 14, 2011  Aug 29, 2014
Printed, PDF,
Page 360
Thought bubble. Third line.

your think "column,"

should read:

you think "column,"

Note from the Author or Editor:
Change the "your" in the bubble speech box to be "you".

terracoda  Nov 14, 2011  Aug 29, 2014
Printed, PDF,
Page 351
End of third line.

possibly ten of thousands

should read:

possibly tens of thousands

Note from the Author or Editor:
Change "ten of" to "tens of" on third line of text.

terracoda  Nov 14, 2011  Aug 29, 2014
Printed, PDF,
Page xxx
Second sentence of paragraph under second heading

Should "not its operator precedence rules" have been "nor its operator precedence rules"? Both are a little syntactically awkward in that sentence.

Note from the Author or Editor:
Change "not its" to "nor its" in second paragraph.

mcmark64  Nov 10, 2011  Aug 29, 2014
Printed, PDF,
Page 363
Last paragraph. Last sentence.

"rather that using"

should read:

"rather than using"

Note from the Author or Editor:
Change "rather that" to "rather than" in last paragraph, last sentence.

terracoda  Nov 10, 2011  Aug 29, 2014
Printed, PDF,
Page 350
Bullet Points box. First bullet.

Are methods case sensitive?

If so, "fieldStorage()"

should read:

"FieldStorage()"

Note from the Author or Editor:
Yes, the "f" in "FieldStorage" should always be uppercase. Change the first bullet point to reflect this.

terracoda  Nov 10, 2011  Aug 29, 2014
Printed, PDF,
Page 350
Database Lingo box. Second bullet.

"rows or data"

should perhaps read:

"rows of data"

Note from the Author or Editor:
Change "rows or data" to read "rows of data".

terracoda  Nov 10, 2011  Aug 29, 2014
Printed, PDF,
Page 342
Last sentence. First line.

"amend you Android app"

should read:

"amend your Android app"

Note from the Author or Editor:
Change "you Android app" to "your Android app" in final paragraph.

terracoda  Nov 10, 2011  Aug 29, 2014
Printed, PDF,
Page 341
Frst sentence

"you SQLite database"

should read:

"your SQLite databse"

Note from the Author or Editor:
Change "you" to "your" in first sentence of first paragraph.

terracoda  Nov 10, 2011  Aug 29, 2014
Printed, PDF,
Page 317
Second to last paragraph. Last sentence.

"because that have different ID values."

should be:

"because they have different ID values."

Note from the Author or Editor:
Change "that have" to "they have"

terracoda  Nov 09, 2011  Aug 29, 2014
Printed, PDF,
Page 314
In the flow chart under Create.

connecton

should be:

connection

Note from the Author or Editor:
Change "connecton" to "connection" under the Create entry.

terracoda  Nov 09, 2011  Aug 29, 2014
Printed, PDF,
Page 296
Top of page. Second sentence.

"Take a look a this"

Should be:

"Take a look at this"

Note from the Author or Editor:
Change "a this" to "at this" in the first paragraph.

terracoda  Nov 09, 2011  Aug 29, 2014
Printed, PDF,
Page 340
Sharpen Pencil solution for generate_data.py

In a previous errata submission the last line of code was changed to read: "print(json.dumps(athlete))". However, in the updated text the second closing parenthesis is missing.

Note from the Author or Editor:
Add an extra ")" to the last line of code at bottom of page.

mcmark64  Nov 09, 2011  Aug 29, 2014
Printed, PDF,
Page 340
Sharpen Pencil solution for generate_data.py

A previous errata pointed out that athlete_name should be changed to athlete_id. However, it was accidentally changed to athlete_is instead of athlete_id.

Note from the Author or Editor:
Change "athlete_is" at the start of the 4th last line of code to be "athlete_id".

mcmark64  Nov 09, 2011  Aug 29, 2014
Printed, PDF,
Page 77
Comment on right under last code box

There is an extraneous colon in the comment which reads: ... "line_spoken": is assigned the string "Is this the right room for an argument?" Remove the the colon.

Note from the Author or Editor:
Within the final hand-written comment, remove the ":" after "line_spoken".

mcmark64  Nov 09, 2011  Aug 29, 2014
Printed, PDF,
Page 286
Do this! box. First sentence.

The filename has a dash, but should have an underscore.

"change cgi-bin/generate-data.py"
should read:
"change cgi-bin/generate_data.py"

Note from the Author or Editor:
Change the "Do This!" box so that it reads "generate_data.py", that is an underscore instead of a dash in the file name.

Taliesin L. Smith  Nov 03, 2011  Aug 29, 2014
Printed, PDF,
Page 260
First sentence.

"Understandably, the coach won't let your"
Should read:
"Understandably, the coach won't let you"

Note from the Author or Editor:
Change "your" to "you" in first sentence.

terracoda  Nov 03, 2011  Aug 29, 2014
Printed, PDF,
Page 277
Relax Box Title. Second word.

"If you app doesn't run"

Should read:

"If your app doesn't run"

By the way, I'm using the Indian edition if that makes a difference.

Note from the Author or Editor:
Change "you" to "your" in the Relax element.

terracoda  Nov 03, 2011  Aug 29, 2014
Printed, PDF,
Page 264
First paragrpah. Last sentence. First word.

"Simplty tap" should be "Simply tap"

Note from the Author or Editor:
Change "Simplty" to "Simply" as indicated at end of opening paragraph.

terracoda  Nov 02, 2011  Aug 29, 2014
Printed, PDF,
Page 41
handwrite at top right

The text needs to be much clearer for windows users that they need to open the command prompt and, using cd, change the directory to the one where the nester folder is located- this is the Windows equivalent of Linux' opening 'a terminal window within your nester folder'.

In Windows 7 there are constraints about changing files in the program files (x86) folder, which is where python resides. These are for security purposes, but may get in the way of easy operating. If you locate nester there you may get problems with refused permissions when setup.py tries to create new files.

Note from the Author or Editor:
Noted. Something to fix in the next edition.

Anonymous  Sep 24, 2011 
Printed, PDF,
Page 101
Para 2

There is already an errata item for this, but it is listed as having been corrected on May 11, 2011. However, it was *not* corrected. (Other typos with that date have been corrected.) The phrase "when your were" should have been changed to "when you were."

Note from the Author or Editor:
Change "your" to "you".

mcmark64  Sep 22, 2011  Aug 29, 2014
Printed, PDF,
Page 58
Rest of the chapter

By the time one hits this point in the book, the print_lol function has been updated, but there is no mention of re-installing the updated version into the local version of Python. Therefore the code listed at the top of page 58 will not work. In subsequent sections the book talks about updating PyPI, but it still doesn't mention updating the local version of the nester module.

Note from the Author or Editor:
It was implied that an update to PyPI would trigger an fresh download, install and update to the local module. I should've been more clear on this.

mcmark64  Sep 22, 2011 
Printed, PDF,
Page 49
2nd question/answer

Q: And when I press F5 in IDLE?s edit window, it?s as if the module?s code is imported with an import statement, right?
A: Yes, that is essentially what happens. The code in your edit window is compiled and executed by Python, and any names in the edit window are imported into the namespace being used by IDLE?s shell. ...

Although the answer makes things somewhat clear, the statement of the question is confusing. From what I understand, if I am editing code in an IDLE edit window, that code is not really treated like a Python module. It may not be a module at all. So to state that "the module's code is imported with an import statement" is confusing. If it were a module that was essentially imported with an import statement, then it would have a module namespace name and would be imported into that namespace and not the namespace being used by IDLE's shell. It's more like pressing F5 is copying and pasting that code into IDLE's shell. Correct?

Note from the Author or Editor:
Yes, the question is ill-formed and the answer is a little off, too. IDLE's edit window is a convenient way to enter large amounts of code into the IDLE prompt, and is not the same as using import.

mcmark64  Sep 21, 2011 
Printed, PDF
Page 51
Middle section, 1st sentence

The first sentence in the section under "Yeah, that might just work.", i.e., the sentence that ends with "to perform the nested printing", is missing a period at the end.

Note from the Author or Editor:
Add a period (.) after "nested printing" in middle paragraph.

mcmark64  Sep 21, 2011  Aug 29, 2014
Printed, PDF,
Page 38
Last sentence of third answer

Typo: "to remember when you actually put it" should be "to remember where you actually put it".

Note from the Author or Editor:
Change "when" to "where" is third answer.

mcmark64  Sep 17, 2011  Aug 29, 2014
Printed, PDF,
Page 32
10th bullet point

The phrase "or count the number of items" should be "or count of the number of items" (or possibly "or counts the number of items").

Note from the Author or Editor:
Change "count the number" to "counts the number".

mcmark64  Sep 15, 2011  Aug 29, 2014
Printed, PDF,
Page 31
Penultimate sentence

Missing apostrophe: "in your (and others) programs" should be "in your (and others') programs".

Note from the Author or Editor:
Change "(and others)" to "(and others')".

mcmark64  Sep 15, 2011  Aug 29, 2014
Printed, PDF,
Page 29
Comment in the top right corner of page

Missing apostrophe: "start of your functions code suite" should be "start of your function's code suite".

Note from the Author or Editor:
Change functions to function's in hand-written comment at top-right of page.

mcmark64  Sep 15, 2011  Aug 29, 2014
Printed, PDF,
Page 20
First line of code in "An IDLE Session" box

The "single quotes" in the first line of code in the "An IDLE Session" box which assigns a list to the "names" variable are not of the proper type. If you cut and paste this line of code into the IDLE shell you will get a syntax error.

Note from the Author or Editor:
The single quotes around Michael and Terry displayed as (what I call) typographical quotes... they need to be (what I call) programmer quotes.

mcmark64  Sep 15, 2011  Aug 29, 2014
Printed, PDF,
Page 19
In comment on last line of code in the "An IDLE Session" box

The comment: The "for" loop prints each item of the outer loop ONLY. Should read: The "for" loop prints each item of the outer list ONLY. (I.e., change "outer loop" to "outer list".)

Note from the Author or Editor:
Change "outer loop ONLY" to "outer list ONLY".

mcmark64  Sep 15, 2011  Aug 29, 2014
Printed, PDF,
Page 64
An Idle session, 1st paragraph, 3rd sentence

"Start be..." should be "Start by..."

Note from the Author or Editor:
Change "Start be" to read "Start by" in first paragraph.

Corinne Welsh  Sep 11, 2011  Aug 29, 2014
Printed, PDF,
Page 56
Exercise Solution box, 2nd comment, 2nd sentence

Erroneous apostrophe "it's" should be "its".

Note from the Author or Editor:
Change it's to its.

Corinne Welsh  Sep 11, 2011  Aug 29, 2014
Printed, PDF,
Page 55
Exercise box, 2nd comment, 2nd sentence

Erroneous apostrophe "it's" should be "its".

Note from the Author or Editor:
Change it's to its.

Corinne Welsh  Sep 11, 2011  Aug 29, 2014
Printed, PDF,
Page 62
2nd thought bubble

Erroneous apostrophe: "TypeError's" should be "TypeErrors".

Note from the Author or Editor:
Remove the ' from TypeError's - it should not be there.

Corinne Welsh  Sep 04, 2011  Aug 29, 2014
Printed, PDF,
Page 42
picture

I am using python 3.2.1 on Mac OS.
When I checked the folder, there was no nester.pyc.
Is it version specific?

Note from the Author or Editor:
The .pyc version of any module only comes into existence *after* Python has processed the module (i.e., compiled it and - assuming success - run it). In versions of Python less than 3.2, the .pyc files were always put in the same folder as the module - which is how it is described in the book. From 3.2 onwards (which appeared after the book published), this behaviour has changed (here's an explanation: http://stackoverflow.com/questions/5149832/where-are-the-pyc-files). Regardless of which version of Python you are running, I think it is safe to not worry too much about .pyc files as Python pretty much looks after them for you. --Paul.

Kweon  Jul 20, 2011 
Printed, PDF,
Page 16
In the for loop usage graphic, in the first box

In the for loop usage graphic, the one that uses the large font size. In the first box after "for" it is written "target identifer" when it should be "target identifier".

Note from the Author or Editor:
Change "target identifer" to read "target identifier" within the box that follows the large "for" (in the diagram).

Matt Muzzi  Jul 07, 2011  Aug 29, 2014
Printed
Page 356
second code box

Two issues with the code box containing:

handlers:
- url: /.*
script: sayhello.py

1) The colon after url is almost completely obscured by the "hand-written" circle around the "/.*" portion of the code.

2) I spent a lot of time banging my head against the wall before realizing that I needed two spaces before "script:" to make this code work. It is formatted correctly in the book, but very subtle and definitely frustrating because I missed it and went around and around in circles trying to figure out what was going wrong!

Note from the Author or Editor:
Adjust the circle around the /.* to uncover the ":", and add a short annotation pointing to "script" as follows: "Be sure to insert two spaces here".

Douglas Calhoun  Jun 26, 2011  Aug 29, 2014
Printed
Page 374
last line

"...adding the following lines to the handlers section of your app.yaml file:

-url /static
static_dir

"

It appears that if this code is added after the existing

- url: /.*
script: hfwwg.py

code instead of before it, the .css formatting will not work. This is not at all clear from the text in the book and my natural inclination was to add it at the end of the current code.

Note from the Author or Editor:
The /.* URL should always be the last handler in the app.yaml file. The text does not make this clear (but should). [Note that the downloaded code from the support website has things in the correct order].

Douglas Calhoun  Jun 26, 2011  Aug 29, 2014
Printed
Page 395
3rd bullet point, right box

"...is based on the one use in the..." : "use" -> "used"

Note from the Author or Editor:
Change "use" to read "used".

Douglas Calhoun  Jun 26, 2011  Aug 29, 2014
PDF
Page 239
"watch it" section top of the page

The shebang there is:
#! /usr/local/bin/python3
which may be invalid. For example, I am using Ubuntu 10.04 64bit, and my python3 is in /usr/bin/python3 (for whatever reason).
Maybe you could hint to the user to invoke 'which python3' or similar to learn where their python is?

Note from the Author or Editor:
Yes, use 'which python3' to work out where your Python 3 lives and adjust this command-line as appropriate.

wujek  May 14, 2011 
PDF
Page 270
"Sharpen your pencil" top of the page

The hand-written code says:

def get_names_from_store():
athletes = get_from_store()
response = [athletes[each_ath].name for each_ath in athletes]
return(response)

Whereas this is not an error, the code to get the names seems over-complicated. In the for comprehension, the each_ath is already a name as athletes is a dictionary; the transformation is unnecessry and totally misleading. Let alone that you could just say:
response = athletes.keys().

I am writing this on behalf of my friend, who is a total newbie - he was completely perplexed with the code, and wanted me to explain, and it took a while, and I think I failed.

You just invented the worst way to get the keys of a dictionary I have ever seen ;d No offense meant.

Note from the Author or Editor:
Yes - it's not the nicest code (and I can't for the life of me remember why I did it that way). Too much emphasis on the list comprehension, I guess.

wujek  May 14, 2011 
Printed, PDF, , Other Digital Version
Page 234
lower left corner

The files for chapter 7 inlcude the stylesheet "coach.css". Since it comes directly from "Segway'n USA" in "Head First HTML with CSS & XHTML" it requests an image called "backpack.gif".

This image does not belong to Coach Kelly's files and its request prints a confusing 404-error to the terminal when running "cgi-bin/generate_timing_data.py" in chapter 7.

Solve this error by removing line 70 in hfpy_code/chapter7/webapp/coach.css.

Note from the Author or Editor:
Yes, that can be annoying, but it's not the end of the world. ;-) And this is what I get - of course - for borrowing the CSS in the first place! Thanks for pointing this out. As you say, removing the reference to the GIF from within the CSS file makes the message go away.

Anonymous  Apr 29, 2011 
Printed, PDF,
Page 302
Code on page

The downloaded page302.py file in chapter9.zip doesn't match the text in the book. It looks like it matches the add_timing_data.py file from later in the chapter.

Note from the Author or Editor:
Yes, the code in the download is a little out of whack here. p302.py should contain the code from page 302 in the book.

Clifton Shak  Apr 01, 2011  Aug 29, 2014
Printed, PDF,
Page 315
2nd-to-last paragraph

You can include code like this in your program. It is also possible to interact with ==> you <== SQLite data from within IDLE?s shell. Whichever option you choose, you are interacting with your database using Python.

Should be "your". Very minor, I know....

Note from the Author or Editor:
Change "you SQLite" to "your SQLite" in second-to-last paragraph.

Brent Bollmeier  Mar 08, 2011  May 11, 2011
Printed, PDF,
Page 262
Bottom right-hand corner

Change:

"Don't worry; yours in"

to:

"Don't worry, yours is"

Note from the Author or Editor:
Change "yours in" to "yours is" within the bottom-right annotation.

Anonymous  Feb 26, 2011  May 11, 2011
Printed, PDF,
Page 192
2nd paragraph

Athlete().__init__(a)

Instead, it should be:

Athlete.__init__(a)


There are no brackets for Athlete.

Note from the Author or Editor:
Remove the () from after Athlete within the middle code box.

Anonymous  Feb 23, 2011  May 11, 2011
Printed
Page 191
Middle of the page, in code example

On page 191 in the code block that begins with, "class Athlete," there is a grammatical error. A comment states "# The code to initialize a "Athlete" object," where "a" should be "an."

Note from the Author or Editor:
Change "a Athlete" to "an Athlete" within the comment within the first code block.

Luke Fox  Feb 12, 2011  May 11, 2011
Printed
Page 171
Middle of the page

On page 171, "Test Drive," the image shown is presumably incorrect. The image for the old code is shown, whereas the Test Drive image should be of the newly created function get_coach_data() used in action instead of the old with open() loops.

Note from the Author or Editor:
Yes, the image is an older screenshot - the code for get_coach_data() should be shown.

--Paul.

Luke Fox  Feb 12, 2011  Aug 29, 2014
Printed, PDF,
Page 116
Header

On page 116 at the top left corner of the screen it says, "no dumb questiohns," where it should say, "no dumb questions."

Note from the Author or Editor:
Change "questiohns" to "questions" in page title.

Luke Fox  Feb 05, 2011  May 11, 2011
PDF, , Other Digital Version
Page 15
Last sentence above, "It?s time to iterate"

Missing "it"

Change this:

becomes such a chore that you would rather find an excuse not to have to do.

to this:

becomes such a chore that you would rather find an excuse not to have to do it.

Note from the Author or Editor:
Change "...not to have to do." to be "...not to have to do so."

Anonymous  Feb 02, 2011  May 11, 2011
Printed, PDF,
Page 96
first balloon

you --> your

Note from the Author or Editor:
Change "you" to "your" in first speech bubble.

Richard Moores  Jan 23, 2011  May 11, 2011
Printed
Page 56
in Exercise Solution, 2nd line from bottom

change print("\t", end=")
to print("\t", end='')

Note from the Author or Editor:
The " associated with the end= is two single quotes, not a double quote. Unfortunately, the font/typeface used in the solution is making this a little confusing, as two single quotes in that typeface looks like a double. Just be sure to use '', not ".

Richard Moores  Jan 21, 2011 
Printed
Page 43
The Note in middle of page

>>> import nester.py
Traceback (most recent call last):
File "<string>", line 1, in <fragment>
builtins.ImportError: No module named py

Therefore Note should read:
Note: don't include the ".py" extension when naming your module.

Note from the Author or Editor:
The annotation is perhaps a little misleading. The key point is that when creating and saving a module, you include the ".py" extension in the file-name. However, when importing the module into a Python program the extension is assumed, so it's an error to include it. Saying "import mymodule" tells Python to find the "mymodule.py" file and import its code.

Richard Moores  Jan 18, 2011 
Printed, PDF,
Page 102
paragraph under sample code

Of course if *an* different type of...

*an* should be 'a'

Note from the Author or Editor:
Change "an different" to "a different".

Brian Ball  Jan 08, 2011  May 11, 2011
Printed, PDF,
Page 101
second paragraph - first sentence

it's ignored or *a* error message is ...

*a* should be 'an'

Note from the Author or Editor:
Change "a error" to "an error".

Brian Ball  Jan 08, 2011  May 11, 2011
Printed, PDF,
Page 438
second to last paragraph - first sentence

.... operating systems command line

should be system's command line with an apostrophe s

Note from the Author or Editor:
Yes ... the command-line belongs to the OS, so change "system" to read "system's".

Brian Ball  Jan 08, 2011  May 11, 2011
Printed
Page 438
3rd sentence of paragraph 3

These exist in separate files from *you* code and allow...

*you* should be 'your'

Note from the Author or Editor:
Change "you code" to read "your code".

Brian Ball  Jan 08, 2011  May 11, 2011
Printed, PDF,
Page 264
Bottom of page

With the latest version of Google's Android SDK, some of the utilities in the "tools" folder have been moved to a new folder called "platform-tools". One of the tools impacted is "adb". So, if you are using an Android SDK that is newer than the one in the book, instead of using the "tools/adb" command, use the "platform-tools/adb" command instead.

Paul Barry
Paul Barry
 
Dec 28, 2010  Aug 29, 2014
PDF, , Other Digital Version
Page 421
Last line of the example code

Change "The predicited time running" to "The predicted time running".

Note from the Author or Editor:
Last line of code in screenshot, change "predicited" to "predicted".

spiceisland  Dec 21, 2010  Aug 29, 2014
Printed, PDF,
Page 406
Last paragraph

Change "strucutre" to "structure".

Note from the Author or Editor:
Change "strucutre" to "structure" in last paragraph.

spiceisland  Dec 21, 2010  May 11, 2011
Printed, PDF,
Page 389
2nd paragraph

Change "and he isn?t not logged in" to "and he isn't logged in".

Note from the Author or Editor:
Change "isn't not logged" to "is not logged" in second paragraph.

spiceisland  Dec 21, 2010  May 11, 2011
Printed, PDF,
Page 387
2nd paragraph

One my Linux system (Ubuntu 10.10) with GAE v1.4.0, the GAE "admin" URL seems to be:

http://localhost:8080/_ah/admin/

i.e. port 8080 instead of 8081

Just something to be aware of ...

Note from the Author or Editor:
This is (somewhat) platform specific. The GUI's on Mac OS X and Windows keep track of (and let you manage) many "active" webapps at a time, and the GUI tool assigns sequential protocol ports to each app (8080, 8081, 8082, and so on). On Linux, there's no GUI, and only one webapp is active at a time, and by default App Engine always uses 8080 on Linux.

spiceisland  Dec 21, 2010 
Printed, PDF,
Page 333
Code example for get_athlete_from_id()

This code only retrieves the first three values from the timing-data, whatever order they are in. This is fine for the values converted from the original text files (which happen to be in the correct order), but values added afterwards (see later in this chapter) may be better times yet not chosen for retrieval.

Need to change the SQL line from:

results = cursor.execute("""SELECT value FROM timing_data WHERE athlete_id=?""",
(athlete_id,))

to:

results = cursor.execute("""SELECT value FROM timing_data WHERE athlete_id=? ORDER BY value""",
(athlete_id,))

Note from the Author or Editor:
Change the SQL SELECT statement to include the ORDER BY clause as suggested above. The previous model code ensured that the top3 always were in order, but the SQL implementation does not. That's why the ORDER BY clause is needed in this case.

spiceisland  Dec 19, 2010  May 11, 2011
Printed, PDF,
Page 348
Code example for add_timing_data.py

The following line:

form = cgi.FieldStorage()

should be rewritten as:

form_data = cgi.FieldStorage()

Note from the Author or Editor:
Within the screenshot, change "form = " to be "form_data =" when calling cgi.fieldStorage().

spiceisland  Dec 19, 2010  Aug 29, 2014
Printed, PDF,
Page 159
Bottom

"As expected, the outout matches that from earlier."

outout should be output

Note from the Author or Editor:
Change "outout" to "output" within first line after screen-shot.

Jeff Blaine  Dec 17, 2010  May 11, 2011
Printed, PDF,
Page 128

Technically, "print" doesn't get changed to "print_lol". It gets changed to "nester.print_lol" because the imported module is "nester" and not "from nester import print_lol" according to your answers on page 128.

Note from the Author or Editor:
When using "print_lol" be sure to prefix it with "nester."

Jeff Blaine  Dec 17, 2010  Aug 29, 2014
Printed, PDF,
Page 223
2nd line in code: "from athletelist import AthleteList"

Code assumes you have put the AthleteList in a module file but there was no instruction to do this in the previous chapter. There was only mention that one "could" do it on page 209 at the end of chapter 6.

Note from the Author or Editor:
Yes, I should have been explicit in telling readers to create the required module prior to starting into Chapter 7.

Anonymous  Dec 14, 2010  Aug 29, 2014
Printed, PDF,
Page 340
Sharpen Pencil Solution for generate_data.py

The final print() statement seems to be a hangover from the previous code. Now have an 'athlete' rather than a list of 'athletes'. Also, the 'athlete' is already in the form of a dictionary and does not require further conversion. So, change:

print(json.dumps(athletes[athlete_name].as_dict))

to:

print(json.dumps(athlete))

Note from the Author or Editor:
Change last line of code to read: "print(json.dumps(athlete))".

spiceisland  Dec 12, 2010  May 11, 2011
Printed, PDF,
Page 339
Sharpen Pencil Solution for generate_timing_data.py

This is a repeat of the problem found by Ygam Retuta for page 340, but for generate_timing_data.py instead of generate_data.py ... instead of:

athlete_name = form_data['which_athlete'].value

change to:

athlete_id = form_data['which_athlete'].value

Note from the Author or Editor:
Change "athlete_name" to "athlete_id".

spiceisland  Dec 12, 2010  May 11, 2011
Printed, PDF,
Page 285-286
Throughout both pages

Descriptive text talks about adding a "to_dict" method to the AthleteList class.

However, the sample code to the exercise, given on page 286, actually implements a method called "as_dict".

The name "as_dict" is the one actually present in the chapter8 webapp code downloaded from the HeadFirstPython website.

Note from the Author or Editor:
Page 285 should refer to the method with the name "as_dict", as opposed to "to_dict" (change four times on page 285 and once on page 286).

spiceisland  Dec 11, 2010  May 11, 2011
Printed, PDF,
Page 279
First task, second paragraph

Change:

"a call to thensend_to_server() function"

to:

"a call to the send_to_server() function"

Note from the Author or Editor:
Change "then" to "the" on second paragraph.

spiceisland  Dec 11, 2010  May 11, 2011
Printed, PDF,
Page 299
1st line

should be 'test_form.py' not 'test-form.py'

Note from the Author or Editor:
On the first line, change "test-form.py" to read "test_form.py" as that's the name used in the screenshot.

Monte Milanuk  Dec 10, 2010  May 11, 2011
Printed, PDF,
Page 270
3rd line

'all' should be 'call'

Note from the Author or Editor:
Change the word "all" to "call" within the 3rd line.

Monte Milanuk  Dec 10, 2010  May 11, 2011
Printed, PDF,
Page 340
Sharpen Pencil Solution for generate_data.py

instead of:

athlete_name = form_data['which_athlete'].value

change to:

athlete_id = form_data['which_athlete'].value

Note from the Author or Editor:
Yes, on the next line of code, I use "athlete_id" in the call to the get_athlete_from_id() function, so the previous line should assign the variable to "athlete_id" not "athlete_name".

Ygam Retuta  Dec 09, 2010  May 11, 2011
Printed, PDF,
Page 320
Code Magnet Solution

On Ubuntu machines (unconfirmed for any other distros), an absolute path to the sqlite database file must be provided instead of a relative path.
So instead of:

connection = sqlite3.connect('coachdata.sqlite')

do:
connection = sqlite3.connect('/path/to/coachdata.sqlite')

Note from the Author or Editor:
On some platforms you need to be explicit about the path to your SQLite3 database file.

Ygam Retuta  Dec 09, 2010  Aug 29, 2014
Printed, PDF,
Page 225
Beginning of second code block

Using the files 'sarah.txt', 'james.txt', etc. in the example as shown will not give the results as depicted - there is no name/dob data in those files; need to use 'sarah2.txt', 'james2.txt, etc.

Note from the Author or Editor:
The wrong files are used in the IDLE session. Be sure to use the "2" versions.

Monte Milanuk  Dec 06, 2010  Aug 29, 2014
Printed, PDF,
Page 234
First line of second paragraph

'wedapp' should be 'webapp'

Note from the Author or Editor:
Change "wedapp" to "webapp".

Monte Milanuk  Dec 06, 2010  May 11, 2011
Printed, PDF,
Page 198
Last-but-one question

james.times.append(['1.21', '2.22'])

should use list.extend() rather than list.append(), i.e.:

james.times.extend(['1.21', '2.22'])

Note from the Author or Editor:
The second question on the RHS should read "james.times.extend(['1.21', '2.22'])" - it should NOT use .append().

spiceisland  Dec 04, 2010  May 11, 2011
Printed, PDF,
Page 128, 129
Step 1

Adding fourth argument with default value of 'fh=sys.stdout' causes program to fail with the following trace back:

Traceback (most recent call last):
File "/Users/monte/Desktop/Projects/hfpython/persistent3.py", line 2, in <module>
from nester import print_lol
File "/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages/nester.py", line 4, in <module>
def print_lol(the_list, indent=False, level=0, fh=sys.stdout):
NameError: name 'sys' is not defined


Adding 'import sys' before def print_lol() in the nester.py module and rebuilding seems to fix this. Using Python 3.1.3 on Mac OSX 10.6.5.

Note from the Author or Editor:
The "sys" module is mentioned at the bottom of page 126 (in the Scholar's Corner), but I failed to mention that it needs to be imported for the code on pages 128/129 to work. Simply add "import sys" to the top of the code.

Monte Milanuk  Dec 02, 2010  May 11, 2011
Printed, PDF,
Page 41
Step 4

Command 'sudo python3 setup.py install' will not work on Windows platform. A note earlier on the page (upper right corner) discusses using 'c:\python31\python.exe' (windows) instead of 'python3' (linux/osx) but no mention of *not* using 'sudo' as well.

Errata has been already submitted about the command in the text not matching what is shown in the screen output but stated only that they should match; no mention of 'sudo' not being available/necessary on Windows.

Note from the Author or Editor:
Yes, "sudo" not needed when using Windows.

Monte Milanuk  Dec 02, 2010  May 11, 2011
Printed, PDF,
Page 384
2nd paragraph

"If you make it too hard for your users to enter data into your system, things will likely things break."

Should be "...things will likely break."

Note from the Author or Editor:
Yes, too many "things".

Monte Milanuk  Dec 02, 2010  May 11, 2011
Printed, PDF,
Page 19
End sentence in paragraph titled "Yes, that?s correct: the loop code isn?t complete."

"What?s we need here is some" should be "What we need here is some"

Note from the Author or Editor:
Change "What's we need" to "What we need".

Jeff Blaine  Nov 29, 2010  May 11, 2011
Printed, PDF,
Page 41
Step 4

In step 4 (Install your distribution into your local copy of Python)
the directions above the terminal graphic says "sudo python3 setup.py install" but the command in the actual window omits the "sudo" command.

Note from the Author or Editor:
The command-line in the bottom graphic console window needs to use the "sudo" command, as described in the text for point 4.

Anonymous  Nov 29, 2010  May 11, 2011
Printed, PDF,
Page 101
Para 2

"occured earlier when your were..." should be "when you were"

Note from the Author or Editor:
Change "when your were" to "when you were".

Anonymous  Nov 29, 2010  May 11, 2011
PDF,
Page xxxi
links

You were so kind to mix THIS book with the HeadFirst Programming.In Your book You depend in most places and excersise on web data appended to this book's web page. I would like to ask kindly where on YOUR site are the files tor THIS book? Or do You mine the books files are interchangable?

Kind regards

Missing Files

Note from the Author or Editor:
The files for Head First Python are here: http://www.headfirstlabs.com/books/hfpython/ - there's another errata entry that explains how this happened.

Anonymous  Nov 28, 2010  Aug 29, 2014
Printed, PDF,
Page 239
Watch It box

On my system (Lubuntu) I have to replace:

#! /usr/local/bin/python3

with:

#! /usr/bin/python3

Im not sure if this constitutes errata as Im sure the first path would work for most - however if someone else has the same error:

OSError: [Errno 2] No such file or directory

check your path!

Thanks

Note from the Author or Editor:
It's probably best to use the "which python3" command and then replace the path in the script with the value reported. But, yes, this can vary based on the Linux you are running.

Raphael Chambers  Nov 24, 2010 
PDF
Page xxxi
The hyperlinks at top of page.

The hyperlinks direct to the pages for Head First Programming, not Head First Python. Whoops! :) In your browser, replace "hfprog" with "hfpython" and "programming" with "python" to get to the correct sites. The URLs on the printed page are OK, it's the hyperlinks that are wrong.

Note from the Author or Editor:
And that's what I get for reusing the preface from Head First Programming on this book! ;-)

Paul Barry
Paul Barry
 
Nov 24, 2010  Aug 29, 2014
Printed, PDF,
Page 127
2nd line of the 2nd paragraph

"...have been removed from this COD, but be sure to update your comments..." COD should be CODE

Note from the Author or Editor:
Yes, "cod" should be "code" within the brackets in part 1.

Joseph  Nov 23, 2010  May 11, 2011
Printed, PDF,
Page 100
Note box #1

Note box #1 begins: "The code on the RIGHT starts by...". It should say: "The code on the LEFT starts by..."

Note from the Author or Editor:
Yes, "code on the right" should be "code in the left" for point 1.

Joseph  Nov 23, 2010  May 11, 2011
Printed, PDF,
Page 62
2nd paragraph

"In your rush to release the LATES and greatest version of your module" should be "In your rush to release the LATEST and greatest version of your module"

Note from the Author or Editor:
Change "lates" to "latest" in paragraph under the picture of the computer.

Joseph  Nov 22, 2010  May 11, 2011
Printed, PDF,
Page 68
Exercise Solution #3

Says to use "python3 setup.py sdisk upload" to upload changes to PyPi website.

Should be "python3 setup.py sdist upload".

Note from the Author or Editor:
Yes, that's a minor typo - "sdisk" should be "sdist".

Joe Casper  Nov 22, 2010  May 11, 2011