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
Safari Books Online
Chapter 5 1st paragraph 1st sentence

There are no page numbers for the Safari Books online. (even though there’s still lots to of Python to learn) Should be (even though there’s still lots of Python to learn)

Anonymous  Dec 01, 2016  Jan 06, 2017
Safari Books Online
Chapter 7 "Consider what you're trying to reuse" second paragraph 1st sentence

It’s should be clear...... should be It should be clear......

Anonymous  Dec 12, 2016  Jan 06, 2017
PDF
Page 8
middle of page

I really like this book, but you commit a common sin, which is using a term before you explain it. You do this a lot in the 1st chapter. Examples of this are when you first use the terms "module", "attribute", and "method".

Note from the Author or Editor:
Noted for next major update, but: the assumption is that readers have programmed before so should have a familiarity with such terms (although I take the point that I could do a better job of it here).

Jon Forrest  Jun 02, 2017 
PDF
Page 8
2nd paragraph

"enture stndard"

Rachel Vishnepolsky  Jan 03, 2016  Nov 04, 2016
Printed, PDF, ePub
Page 11
4th paragraph

(This is a minor issue) "we are interested in the current time’s hours (%H) and minutes (%M) values" -> "we are interested in the current time’s hour (%H) and minute (%M) values"

Note from the Author or Editor:
Middle paragraph of page 11, adjust as per this reader's suggestion.

Jon Forrest  Jun 02, 2017  Jul 07, 2017
PDF
Page 14
2nd to last paragraph

"When today is invoked, it returns a “time object,” " There are two problems with this. 1) (Very trivial) The comma should be outside the quoted string. 2) today doesn't return a time object, e.g. >>> from datetime import datetime >>> type(datetime.today()) <class 'datetime.datetime'> It looks like today returns a datetime object. The rest of this paragraph should be (slightly) modified to reflect this fact.

Note from the Author or Editor:
Change opening sentence for the largest paragraph on this page from: "When today is invoked, it returns a “time object,” which..." to: "When today is invoked, it returns a “time object” (of type datetime.datetime), which..." Note: the "datetime.datetime" bit should be shown in courier/code font.

Jon Forrest  Jul 02, 2017 
Printed, PDF, ePub
Page 14
1st paragraph

You're inconsistent in your use of "line of code". On Pg 13 you say "The next three lines of code in our program" to refer to the three lines that make up the list assignment statement. Fine so far. But, on Pg 14 you say "Take another look at the third line of code:". Based on your first usage, the third line of code is actually the one that starts with "21, 23,". But your usage on Pg 14 refers to the assignment statement giving "right_this_minute" a value. You need to distinguish between a "line of code", which is just a single line, and a "statement", which consists of one or more lines of code. There are other examples of this inconsistency later in the book.

Note from the Author or Editor:
Noted. This is something that will be dealt with in the next major update. The reader is right: a single Python statement can span more than one line of code, and my usage needs to be clearer.

Jon Forrest  Jun 02, 2017 
Printed, PDF, ePub
Page 17
2nd paragraph

"Take a closer look at the else statement" There is no "else" statement in Python. Nor is there an "elif" statement (as mentioned lower on the page). The official Python tutorial calls them "parts" (https://docs.python.org/3/tutorial/controlflow.html). I didn't find a name for them in the official language definition. Many online references make the same mistake.

Note from the Author or Editor:
The use of "else statement" in paragraph 2 should be "else part". (This reader is correct: "else" is part of the "if" statement). Same goes for use of "elif statements" at the end of the paragraph at the end of the first paragraph in the "Neither. Python spells it elif." subsection. It should read "elif parts". Both "else" and "elif" are part of the "if" statement, and are not statements in their own right.

Jon Forrest  Jun 02, 2017  Jul 07, 2017
PDF
Page 18
2nd paragraph

"jsut"

Rachel Vishnepolsky  Jan 03, 2016  Nov 04, 2016
PDF
Page 52
3rd paragraph

(Minor suggestion) "The values associated with a key can be any object." -> "The values associated with a key can be any type of object."

Note from the Author or Editor:
End of second paragraph under point 3. Change last line from: "The values associated with a key can be any object." to: "The values associated with a key can be any object (of any type)."

Jon Forrest  Jul 03, 2017 
Printed
Page 59
1st paragraph

Did you mean to change the spelling of the example from a few pages ago to "Millyways"? It was: "Milliways" a few pages ago and that changes the number of vowels in the word (unless you are setting up a "sometimes 'y'" scenario).

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

jlcooke  Dec 09, 2016  Jan 06, 2017
Printed, PDF, ePub
Page 72
1st sentence

"When to comes to copying an existing list" -: "When it comes to copying an existing list"

Note from the Author or Editor:
Change first use of "to" to "it" in first paragraph.

Jon Forrest  Jun 05, 2017  Jul 07, 2017
Printed
Page 88
1st illustration

The word "Paranoid" is misspelled in the illustration. This throws the indexing off so that the statement in the final paragraph on the page is contradicted by the indexes in the illustration.

Note from the Author or Editor:
The first illustration at the top of the page has an extra 'r' in index position 16, which invalidates the diagram. Note to production: when you come to apply this fix, email me and I'll provide an updated illustration.

John D Ogden  Jan 17, 2017  Jul 07, 2017
Printed, PDF
Page 90
6th paragraph

(This is extremely minor) "in that there’s tags on the left" -> "in that there are tags on the left"

Note from the Author or Editor:
On, man, I'm forever doing that (and my editor is going to be annoyed that she missed that one!). Thanks for pointing that out. We'll fix in in the next reprint. First paragraph after napkin images: "there's" should read "there are".

Jon Forrest  May 29, 2017  Jul 07, 2017
PDF
Page 116
1st line of code, after the 3rd paragraph

hfpy [2017-01-06], i got the following error when running >>> fruits Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'fruits' is not defined the dictionary should be initialised before enumerating. the first line of key should be. fruits = {}

Note from the Author or Editor:
The first line of code in the middle of this page should read: >>> fruits = {} This initializes the dictionary before first use.

Anonymous  Jan 14, 2017  Jul 07, 2017
PDF
Page 125
Lower right page. "Comment" typeface.

"Python conversts" should be "Python converts"

jlcooke  Dec 11, 2016  Jan 06, 2017
Printed, PDF, ePub
Page 139
1st paragraph

. . . display it in a easier-to-read format. . . Should be: . . . display it in an easier-to-read format. . .

Note from the Author or Editor:
Change "a easier" to "an easier" in first paragraph.

Rick Rakin  Jun 08, 2017  Jul 07, 2017
Printed, PDF
Page 171
Example with keyword assignment.

On Page 171 there is example with argument keyword assignment use for invoking function. Below search4letters(letters='xyz', phrase='galaxy') def search4letters(phrase:str, letters:str='aeiou') -> set There is information, that result of the function is y and z, which is mistake as result should be y and x.

Note from the Author or Editor:
The first sentence of the last paragraph on this page should end as follows: "... a set containing the letters x and y."

Mateusz Muller  Mar 31, 2017  Jul 07, 2017
PDF
Page 182
under "Step 3 on UNIX-like OSes?" near the bottom of page, at the end of the first line of the first paragraph of text

"dict" should be "dist"

O'Reilly Media, Inc.
 
Jan 06, 2017  Jul 07, 2017
Printed, PDF
Page 189
5th paragraph, start of sentence

As written, "One more, ..." I believe "Once more, ..." is intended. Thanks for a very useful and well thought out book.

Note from the Author or Editor:
Change "One more" to "Once more" at start of second paragraph in "Recalling our code" section.

chrsclrk  Feb 06, 2017  Jul 07, 2017
PDF
Page 189
The large note to the right of the page

The URL for pytest does not hyperlink to the correct page and needs to be updated in the PDF.

Note from the Author or Editor:
should go to https://docs.pytest.org/en/latest/

Paul Barry
Paul Barry
 
Jan 23, 2017  Jul 07, 2017
Printed, PDF, ePub, Mobi, Safari Books Online, Other Digital Version
Page 207
Top of second last paragraph (opening sentence)

The opening sentence currently reads: "The route decorator lets you associate a URL web path with an existing Python function." This should be changed to read: "The route decorator lets you associate a URL web path with the Python function which immediately follows the route decorator in your code." In the same paragraph, the closing sentence currently reads: "The route decorator then waits for any output produced by the decorated function before returning the output to the server, which then returns it to the waiting web browser." This should be changed to read: "The route decorator then waits for any data returned from the decorated function before returning it to the server, which then returns the data to the waiting web browser." My thanks to reader Jon Forrest for bringing both of these to my attention. Jon's suggestions make it clearer what's going on here. --Paul.

Paul Barry
Paul Barry
 
Jun 10, 2017  Jul 07, 2017
Printed, PDF
Page 209-210
In the exercise text

The phrase "life, the universe, and everything" should NOT have a trailing '!'. The code and subsequent screenshots are correct - the description of what the reader is to do (and the phrase to use) on page 209 and 210 incorrectly includes the '!' symbol at the end of the string.

Paul Barry
Paul Barry
 
Jan 24, 2017  Jul 07, 2017
Printed, PDF, ePub
Page 213
3rd paragraph

(This is extremely minor. Sorry) "but it’s not a absolute" -> "but it’s not an absolute"

Note from the Author or Editor:
Change "a absolute" to "an absolute" in the sentence immediately above the "Create the HTML..." subheading.

Jon Forrest  Jun 08, 2017  Jul 07, 2017
PDF
Page 215
2nd line

(This is very minor) "a HTML form" -> "an HTML form" Note: this error appears a bunch of times. If you search for "a HTML" you'll see what I mean.

Note from the Author or Editor:
Change "a HTML" to read "an HTML" on pages 226, 229, 234, 277, and 349. This brings these usages in line with the rest of the book.

Jon Forrest  Jul 11, 2017 
Printed, PDF
Page 218
Under point 3, middle of page.

The value associated with 'the_title' key is missing a closing single quote after "web!". Note: the code at the bottom of the page is correct.

Paul Barry
Paul Barry
 
Jan 23, 2017  Jul 07, 2017
PDF
Page 220
Last line

(This is very minor.) The last line on the page shows a 304 status return code. The first time somebody visits the web page mentioned, this will be a 200 status return code. This should be mentioned.

Note from the Author or Editor:
At bottom of page, the second-last annotation reads "You request the HTML form...". This should be changed to read "You request the HTML form (which results in a 200 status code)..."

Jon Forrest  Jun 08, 2017  Jul 07, 2017
PDF
Page 222
1st paragraph

"every web request generates an HTTP status code response." -> "every web request generates an HTTP status code in the response." The way it was worded makes it sound like the response is just an HTTP status code. In reality it's an HTTP status code and other information.

Note from the Author or Editor:
At end of first paragraph, change "status code response" to "status code in its response".

Jon Forrest  Jul 11, 2017 
Printed, PDF, ePub
Page 237
3rd bullet point

On Pg 206 you say that __name__ is "the name of the currently active module. On Pg 237 you says that it's "the currently active namespace". Although you say you'll go into more about the currently active namespace later, I suggest keeping the same wording on Pg 237 that you use on Pg 206. Since we don't know what a namespace is on Pg 237, there's no point to this change.

Note from the Author or Editor:
On page 237, in the Bullet Points box, third bullet point, change "active namespace" to read "active module".

Jon Forrest  Jun 08, 2017  Jul 07, 2017
Printed, PDF
Page 246
Result of print(chore) function

Very small mistake on page 246 where results for called function : for chore in tasks: print(chore) we can find "File tax return.", where should be "Prepare tax return."

Note from the Author or Editor:
Change "File tax return." to "Prepare tax return." (at bottom of page) as per text written to the todos.txt file on the previous page.

Mateusz Muller  Apr 11, 2017  Jul 07, 2017
PDF
Page 248
4th paragraph

(This is extremely minor) You generally use italics for method names. However, in the 4th paragraph you say "forgetting to call close" without putting "close" in italics.

Note from the Author or Editor:
Change the use of "close" on fourth line of fourth paragraph to be in courier/code font as per the other uses on this page.

Jon Forrest  Jun 25, 2017  Jul 07, 2017
Printed, PDF, ePub
Page 255
screen shot

The {'a'} in the output in the screen shot should be {'x','y'} to maintain consistency with the three example searches from pages 252-253.

Note from the Author or Editor:
This reader is correct - some of the screenshots are out-of-sync with the text. Note for Production: please contact me whenever the next update to the PDF is happening and I'll provide updated screenshots for pages 255, 256, and 258. On page 259, the third "<Request>" line at the top of page should end in {'x', 'y'} as opposed to {'a'}.

Rick Rakin  Jun 22, 2017  Jul 07, 2017
Printed, PDF
Page 258
1st paragraph, last sentence

Current text: "…then call escape on the string returned from calling the *join* method:" But there is no *join* method in the code. This should probably be: "…then call escape on the string returned from calling the *log.read()* method:"

Note from the Author or Editor:
This issue presents on a number of pages. Page 254: Referring to paragraph 5 after the with open('vsearch.log') as log line of code. The end of the first sentence should read: "...need to read all the data from the file." That is, the word "lines" should be "data". Also on page 254: The last annotation on the right is wrong. It should read: 'Take the data in contents and return it.' (with 'contents' shown in code font). Page 258: The end of the first paragraph on this page should read: "...then call escape on the string in contents:" (with 'escape' and 'contents' shown in code font). Page 271 and 272: The code for view_the_log() is incorrect. It should match the code on page 258. Page 271: After the code, the exercise states: "This code reads the data from the log file into a list of strings." and it should read: "This code reads the data from the log file into a string."

Jørgen W. Lang  Mar 16, 2017  Jul 07, 2017
Printed, PDF
Page 259
Exercise section

In Exercise steps descriptions there is: "2.Save vsearch4log.py" where should be vsearch4web.py

Note from the Author or Editor:
Confirmed. See note for errata on page 264.

Mateusz Muller  Apr 11, 2017  Jul 07, 2017
Printed, PDF
Page 264
Exercise section

In Exercise steps descriptions there is: "1.Save vsearch4log.py" where should be vsearch4web.py

Note from the Author or Editor:
Point 1 in box near top of page, "vsearch4log.py" should read "vsearch4web.py" on this page, as well as on page 259 (point 2 near bottom of page).

Mateusz Muller  Apr 11, 2017  Jul 07, 2017
Printed, PDF
Page 267
last paragraph

The first sentence states that the logged data is read as a list of strings thanks to the readline method. But this method has been never used before. The view_the_log function shown on page 258 uses the read method and returns a single string.

Note from the Author or Editor:
Please change the opening sentance to the last paragraph on this page to read: "When the logged data is read from the vsearch.log file, it can arrive in your code as a list of strings if you use the readlines method (as readlines converts a file's text to a list of strings on input)."

Pavlo Gotsonoga  Mar 02, 2017  Jul 07, 2017
Printed, PDF, ePub, Mobi, Safari Books Online
Page 268
return statement in last example

In prior examples changes to code have been highlighted in a light-blue. The last example of the return statement for this function I could find is on page 258: "return escape(contents)". My question is: did I miss where I should have changed the statement to "return escape(''.join(contents))" or should this statement be highlighted. I suspect the join example should be inserted somewhere earlier (or I missed it) because I could not get the early examples of log_request() to work (p. 261). I kept getting an exception when attempting to print (ImmutableMultiDict is not a string). I corrected it with a "str(req.form)". But seeing this page makes me think you meant to supply "join" earlier.

Note from the Author or Editor:
Yes, I should be highlighting that return statement in blue (the last line of code on page 268) to note that it has changed. The very next paragraph of text does discuss it (for what it's worth).

jlcooke  Dec 22, 2016  Jan 06, 2017
Printed, PDF
Page 268
Code near bottom of page

The last three lines of code shown for view_the_log are not identical to the previously shown version (way back on page 258). Specifically, the last line is slightly different. The surrounding text discusses this change, but the last line of code should be highlighted better than it is on this page.

Paul Barry
Paul Barry
 
Jan 23, 2017  Jul 07, 2017
PDF
Page 268
3rd from last paragraph

"which read the data from the file and produce the large string:" -> "which read the data from the file and produce the large string from the list:"

Note from the Author or Editor:
Add "from the list" to the end of the last sentence of the 3rd from last paragraph.

Jon Forrest  Jul 12, 2017 
PDF
Page 271
In example code

Up until now, you've always said "-> str". Now, all of a sudden, you say "-> 'str'" (note the quotes). In fact, on this page you have both. You first quoted a return type on Pg. 218 with 'html'. I know that Python doesn't care what the denotations are but you should be consistent.

Note from the Author or Editor:
Change usage of: -> 'str' to read: -> str on pages 271, 272, 273, and 276. Also, on pages 271 and 272, the @app.route('/viewlog') line of the shown code (the first) should not use typographical quotes around /viewlog. These should be straight code quotes instead, as used on page 273.

Jon Forrest  Jul 14, 2017 
PDF
Page 285
The paragraph immediately above the screenshot

The embedded hyperlink for dev.mysql.com (at the top of the paragraph) does not include the entire URL, so your browser takes you to the mysql.com site, but not the correct page (/downloads/connector/python).

Paul Barry
Paul Barry
 
Jan 23, 2017  Jul 07, 2017
Printed, PDF
Page 310
The large note to the right of the page

It should read "...lets you..." not "...lets your..."

Paul Barry
Paul Barry
 
Jan 23, 2017  Jul 07, 2017
Printed, PDF
Page 313
bottom example, top right annotation

"Create another new object, and assign it to an object called “c”." Should probably be: Create another new object, and assign it to a variable called “c”.

Note from the Author or Editor:
Yes, change the third from bottom annotation on the RHS of page to replace "object called c" to read "variable called c".

Jørgen W. Lang  Mar 23, 2017  Jul 07, 2017
Printed, PDF
Page 341
1. para, 2nd line

"Here’s the code from the last chapter, rewritten to use a with statement, which itself…" refers to Ch 8, but the code presented below was created in Ch 7. Suggested correction: "Here’s the code from chapter 7, rewritten to use a with statement, which itself…"

Note from the Author or Editor:
Change second sentence to read: "Here's the code from Chapter 7, rewritten..."

Jørgen W. Lang  Mar 28, 2017  Jul 07, 2017
Printed, PDF
Page 345
3rd paragraph

exec_type should be "exc_type". Shown correctly in the example code.

Note from the Author or Editor:
Yes, "exec_type" should be "exc_type" in middle of third paragraph.

jlcooke  Dec 23, 2016  Jan 06, 2017
Printed, PDF
Page 358
First line of text below heading

"It’s now time to return to the questions first posed in Chapter 7:" should actually be It’s now time to return to the questions first posed in Chapter 6: ## (on page 244)

Note from the Author or Editor:
On page 358: change the first sentence to read: "It’s now time to return to the questions first posed at the end of Chapter 6:". Also, on page 359: change first half of first sentence to read: "Let’s take our data questions one by one, ..."

Jørgen W. Lang  Mar 29, 2017  Jul 07, 2017
PDF
Page 371
1st paragraph

"When we opened up Safari (or you can use Edge if you are on Windows), we used the webapp’s other URL, /getuser, to retrieve the current value of user from the webapp." You write as if you had shown an example of using the /getuser URL. But, I don't see such an example on the preceding pages. Is something missing?

Note from the Author or Editor:
Change the first paragraph on this page to read: If you open up Safari (or Edge if you are on Windows), and use the webapp’s other URL, /getuser, you'd expect to retrieve the current value of user from the webapp. However, when you do this in Safari (or Edge), you’re greeted with a rather intimidating error message:

Jon Forrest  Jul 30, 2017 
PDF
Page 390
2nd annotation on the right

Missing right bracket in annotation after "list.". Should be: Many arguments (which, in this example, are all numbers, but could be anything: numbers, strings, booleans, list.)

Note from the Author or Editor:
Add the closing ) to the annotation half-way down the page.

Jørgen W. Lang  Apr 07, 2017  Jul 07, 2017
Printed, PDF
Page 392
Second example of invoking search4letters function.

We have an example of seach4letters function to be invoked two different ways. By values or keyword arguments. Example 1 is ok : search4letters(letters='xyz', phrase='galaxy') But in Example 2 we have definition of function in fact : "def search4letters(phrase:str, letters:str='aeiou') -> set" Where invoking should look like : search4letters('galaxy','xyz')

Note from the Author or Editor:
Change the annotation at top-right of this page to read: "Note how the interpreter matches up the arguments by name, no matter the order in which they are specified."

Mateusz Muller  Apr 19, 2017  Jul 07, 2017
PDF
Page 395
Whole page

You list 4 features that a decorator must have. But, the decorators that we've used already, such as one first defined on page 207, only include the first of these features. How can the decorators we've used be decorators with these features missing?

Note from the Author or Editor:
Note for editor: There is *no* change required to the text. However, a clarification is needed here: In order to use an existing decorator, all you need to know is what it does, and how to use it (as per the example on page 207). To create your own decorator (which can later be used by you and/or by others) you need to know about and understand the four things listed on page 395. When it comes to creating a decorator, these four things are prerequisites from a knowledge point-of-view, not absolute requirements from an implementation point-of-view. That is, knowing about them helps you get your head around what's possible with decorators. What your decorator ends up doing is an implementation-dependent detail as the decorator machinery is a generic mechanism which can be put to many uses.

Jon Forrest  Aug 03, 2017 
PDF
Page 404
whole page

Your description of decorators needs more meat. For example, 1) You've used the word decorator in 2 ways, e.g as the thing on the line starting with a '@' character, and as the function that must meet the requirements stated on page 395. Is this correct? 2) What's the syntax for invoking a decorator? We've seen 3 examples @app.route('/page1') @wraps(func) @check_logged_in The first 2 use a similar syntax, but only the 2nd explicitly passes the name of the function being decorated. The 3rd says nothing. When does a decorator require arguments? 3) What does @check_logged_in actually do at runtime? 4) Apparently the decorated function is magically passed as an argument to the decorator. How does this work?

Note from the Author or Editor:
There's a lot more to decorators than space allowed me to cover in the 2nd edition. What's shown in Chapter 10 is by way of introduction, as doing a deep-dive with decorators would be considered one of the more advanced Python topics. What's shown is designed to prime a reader to tackle more detailed coverages in other texts (for instance: the Python Cookbook, 3rd edition, has some very good material). Your comments/questions are noted for inclusion/consideration in an updated edition. Thanks.

Jon Forrest  Aug 05, 2017 
Printed, PDF
Page 422
third paragraph ninth sentence

page 422 third paragraph ninth sentence As written “... parameterized SQL strings (with all those ? …” perhaps as intended “... parameterized SQL strings (with all those %s …” For me, SQL prepared statements are associated with the question mark. Thanks for a very useful and enjoyable book, warm regards, Chris

Note from the Author or Editor:
Yes, thanks: in point 3 "all those ? placeholders" should read "all those %s placeholders".

Chris Clark  Feb 22, 2017  Jul 07, 2017
PDF
Page 424
2nd to last line

(Another trivial issue) "The except statement and its suite is new code." -> "The except statement and its suite are new code."

Note from the Author or Editor:
Second last sentence at bottom of page. Change "The except statement and its suite is new code." to read: "The except statement (and its associated suite) is new code."

Jon Forrest  Aug 09, 2017 
PDF
Page 425
2nd figure caption

(a very trivial issue) "... produces a much friendlier messages ..." -> "... produces a much friendlier message ..."

Note from the Author or Editor:
Change "messages" to "message" in the annotation directly below the first image.

Jon Forrest  Aug 08, 2017 
PDF
Page 427
right-hand caption

(Another trivial error you've made before) "Here's the two exceptions ..." -> "Here are the two exceptions ..."

Note from the Author or Editor:
Annotation on RHS of page: "Here's the two" should read "Here are the two".

Jon Forrest  Aug 08, 2017 
Printed, PDF
Page 430
first paragraph second line

As written “interpreters, internals …” As intended, the internals owned by the interpreter: “interpreter’s internals …” Thanks a well written and thought out book, regards, Chris

Note from the Author or Editor:
Second line, first paragraph: "interpreters, internals" should read: "interpreter's internals".

Chris Clark  Feb 23, 2017  Jul 07, 2017
PDF
Page 430
2nd to last paragraph

"it does this without you having to remember to import the sys module" But you do have to remember to import the sys module for the sample above to work. The sample even clearly says "Be sure to import the "sys" module"

Note from the Author or Editor:
Second last paragraph, at the end of the sentence, it reads: "...and it does this without you having to remember to import the sys module, or wrangle with the tuple returned by that function." Change this to read: "...and it does this without you having to remember to import nor interact with the sys module, nor wrangle with the tuple returned by the exc_info function." Note 1: "exc_info" above should be in code-font. Note 2: This paragraph refers to the generic way try/except works which is explored over the page. I should've made this fact clearer.

Jon Forrest  Aug 09, 2017 
Printed, PDF
Page 438
1st paragraph, last word

/search should be /search4

Note from the Author or Editor:
Last word of first paragraph should read: "/search4".

Jørgen W. Lang  Apr 12, 2017  Jul 07, 2017
Printed, PDF
Page 444
Annotation 1

This annotation (#1) should read: Create a new class called “ConnectionError” that inherits from the “Exception” class. Note how the inherited-from class is specified within the parentheses to "ConnectionError".

Paul Barry
Paul Barry
 
Jan 23, 2017  Jul 07, 2017
Printed, PDF
Page 451
left annotation

Use opening (left) bracket instead of closing (right) bracket in )i.e., the code within the “with” suite).

Note from the Author or Editor:
Confirmed. Please change the opening bracket/parens within the annotation at left of page to be (.

Jørgen W. Lang  Apr 13, 2017  Jul 07, 2017
PDF
Page 453
In __exit__ method

"if exc_type is mysql.connector.errors.ProgrammingError:" You need to say something about why you used "is" rather than "==".

Note from the Author or Editor:
Noted for (potential) third edition.

Jon Forrest  Aug 10, 2017 
PDF
Page 453
Last sentence

"you can add an elif suite to the end of the __exit__ method that reraises the unexpected exception" You need to say something about why it is useful to reraise the unexpected exception. After all, it was unexpected before, why won't it be unexpected again?

Note from the Author or Editor:
I did start this paragraph off with the statement "If you want to be extra safe..." which was meant to hint that this was taking things to a bit of an extreme. I've made a note to extend this description in the next edition.

Jon Forrest  Aug 10, 2017 
Printed, PDF
Page 458
Chapter 11's code

Chapter 11's Code first page has the same code as Chapter 11 3/4's first page. As a result it has already : - import of copy_current_request_context - decorator @copy_current_request_context - def log_request nested in def log_request when all of those are described in forthcoming Chapter 11 3/4.

Note from the Author or Editor:
This reader is correct: the code shown at the end of Chapter 11 is the same as the code at the end of the next chapter, 11 3/4, and as such is presented too early for Chapter 11, as the material is not covered yet. The Chapter 11 code should mimic that from the ch11 folder of the online download. The correct code for 258 should *not* include any of the copy_current_request_context references - the updated code download reflects this. Chapter 11 3/4's code can be found in new ch11-3.4 folder included as part of the online download as of today (May 8, 2017). See python.itcarlow.ie/ed2/

Mateusz Muller  May 01, 2017  Jul 07, 2017
Printed, PDF
Page 459
Line 3 of Chapter 11's Code

There is unneeded closing bracket in "loq_request(request, results))".

Note from the Author or Editor:
Remove extra closing ")" from the end of the third line of code.

Mateusz Muller  Apr 27, 2017  Jul 07, 2017
Printed, PDF
Page 474
Bottom of third paragraph from bottom of page

On the last line "matter now long it takes" should read "matter how long it takes".

Paul Barry
Paul Barry
 
Jan 23, 2017  Jul 07, 2017
Printed, PDF
Page 475
Top of code (the first import line).

The continued importation of the "escape" function from Flask is no longer technically required here. It's OK that it's still here, but - if for no other reason than to tidy things up - it should be removed from this code listing. Note: my thanks to eagle-eyed reader Sajjad Taheri who very kindly took the time to email all of these errata which I've inserted into the list today (dated: Jan 23, 2017).

Paul Barry
Paul Barry
 
Jan 23, 2017  Jul 07, 2017