Errata

Raspberry Pi Cookbook

Errata for Raspberry Pi Cookbook

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
Other Digital Version
Kindle Location 3408
Second code paragraph under the Solution header

When following exercise 7.9 Pickling, the Solution's first part gave me an error as follows:

>>> import pickle
>>> mylist = ['some text', 123, [4,5, True]]
>>> f = open('mylist.pickle', 'w')
>>> pickle.dump(mylist, f)
Traceback (most recent call last):
File "<pyshell#98>", line 1, in <module>
pickle.dump(mylist, f)
TypeError: must be str, not bytes

After which I changed it to f = open('mylist.pickle', 'wb') so that there's a 'b' in there. This may cause the second part code to "unpickle" to not work. I'm using the Python 3.4.1 Shell and after the first two lines, I get this error:

>>> f = open('mylist.pickle')
>>> other_array = pickle.load(f)
Traceback (most recent call last):
File "<pyshell#109>", line 1, in <module>
other_array = pickle.load(f)
TypeError: 'str' does not support the buffer interface

Note from the Author or Editor:
This is because of a difference between Python v2 and Python v3. The fix below replaces both code sections and works on v2 and v3

>>> import pickle
>>> mylist = ['some text', 123, [4, 5, True]]
>>> f = open('mylist.pickle', 'wb')
>>> pickle.dump(mylist, f)
>>> f.close()

>>> f = open('mylist.pickle', 'rb')
>>> other_array = pickle.load(f)
>>> f.close()
>>> other_array
['some text', 123, [4, 5, True]]

Anonymous  Oct 05, 2014 
Other Digital Version
Kindle Location 3587
First code snippet

First of all, a big thank you for your fantastic book. It's very well done and I appreciate your efforts in putting this together. As someone brand new to Python, this is a great guide. I hope the below feedback helps make it even more wonderful in the later versions released.

In section 7.13: Making Web Request from Python, this page's code appears to be written for Python2 but it's not stated. Using Python 3.4.1 Shell, I get this error because it appears to be written for Python 2. I confirmed this code works with Python 2.7.3 Shell.

>>> import urllib2
Traceback (most recent call last):
File "<pyshell#52>", line 1, in <module>
import urllib2
ImportError: No module named 'urllib2'


To improve the user experience in following your book, since we're usually using one version of Python while following your book, it'd be nice to have in-page clarification whenever you're using Python2 vs. Python 3 code (e.g. if you ran into a compatibility issue where you weren't able to use Python 3). If you refer to "Python", then should we assume Python 2 unless you explicitly state Python 3? This appears to be covered in Kindle Location 1995 (section 5.1 Deciding between Python 2 and Python 3), where it's said we should use Python 3 until we run into a problem in which case we should use Python 2. However it's also stated: "The examples in this book are written for Python 3 unless otherwise stated...my strategy is to write in Python 3 wherever possible, and revert to Python 2 when I have to because of compatibility problems". I don't see "unless otherwise stated" being followed consistently such as in my last errata report, and in this errata report (i.e. section 7.13's code) where the version of Python being used is Python 2, not 3. It would help tremendously to state the Python version being used when presenting the code.


Python 2 urllib2 code: (https://docs.python.org/2/library/urllib2.html)

For Python 3 the reader could instead follow this https://docs.python.org/3/howto/urllib2.html

I used this code for Python 3, which gave a similar result:
>>> import urllib.request
>>> response = urllib.request.urlopen('http://python.org/')
>>> html = response.read()
>>> print(html)

Note from the Author or Editor:
I have applied the necessary changes into the second edition.

Allan  Oct 05, 2014 
PDF
Page Chapters 2 and 3
varies

Text in the "Problem" section switches between "I" and "You". Please make consistent.
Most are second person. 2.6/2.9/2.11/2.12 use first person.
There are even mixed cases:
2.10.: "You have setup VNC, but would like to share the screen on your Raspberry Pi as if it was another Mac on my[sic!] network."
3.1.: "You want to move files around using a graphical interface like I [sic!] can on a Mac or PC."
3.11: "Sometime commands don?t work because you have insufficient privileges. How do I [sic!] issue commands with super user privileges?"

Note from the Author or Editor:
fixed in copy edit.

H. Bongartz  Nov 12, 2013  Dec 03, 2013
ePub
Page 2
1st paragraph

"you van also" should be "you can also"

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Aug 22, 2013  Dec 03, 2013
PDF
Page 2
Second paragraph

Page 2, second paragraph (starting with second sentence):
"This table also includes the original Revision 1 Model B board that was soon updated with revision 2. You can tell if you have one of these boards beacuse they have a black audio socket rather than the blue socket of the revision 2 boards."

There is a typo in the last sentence of the paragraph: "beacuse" instead of "because".

The last two sentences (quoted above) of the paragraph should be reworded as there is some confusion over what "one of these boards" refers to in the last sentence. I was reading it as a reference to the last thing mentioned in the previous sentence which was a revision 2 board. The last part of the sentence makes it seem it was referring to a Rev 1 board. I have a Rev 2, model B with a blue audio socket.

Note from the Author or Editor:
fixed in proof

Kevin C.  Aug 24, 2013  Dec 03, 2013
ePub
Page 3
Under Discussion section

chose shold be choose

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Aug 22, 2013  Dec 03, 2013
ePub
Page 4
The paragraph under Figure 1-1

The word "can" was fat-fingered.

"You van also see the bare solder pads behind the USB socket ..."
Should be
"You can also see the bare solder pads behind the USB socket ..."

Note from the Author or Editor:
fixed

Jason  Jul 08, 2013  Dec 03, 2013
PDF
Page 4
Last paragraph of the page

"dong very much" should be "doing very much".

Note from the Author or Editor:
fixed in copy edit

Kevin C.  Aug 25, 2013  Dec 03, 2013
PDF
Page 5f
Discussion section

Problem 1.4.: "Selecting an Operating System Distribution"
You should mention here which distribution you are using for the examples in the book. There could be slight differences even between various Debian-based distris.

Note from the Author or Editor:
fixed in proofs

H. Bongartz  Nov 12, 2013  Dec 03, 2013
PDF
Page 6
Second paragraph under "See Also"

In the URL shown as "http://learn.adafruit.com/adafruit-raspberry-pi-educational-linux-distro/occidentalis-v0-dot-2" is copied and pasted in to a web browser it is missing the "-" between "adafruit" and "raspberry".

Note from the Author or Editor:
fixed in copy edit

Kevin C.  Aug 25, 2013  Dec 03, 2013
PDF
Page 6
Paragraph under "Problem" of section 1.5

"Operating System" should not be capitalized. It is a reference to something and not a proper name of something specific. This issue also on pages 8 and 9 in the paragraphs under the "Problem" header of the 1.6 and 1.7 recipes.

Note from the Author or Editor:
fixed in copy edit

Kevin C.  Aug 25, 2013  Dec 03, 2013
Printed
Page 8
2nd Paragraph, first sentence under Discussion.

" ... correctly onto the SD crd, the card..." should be "card"

Note from the Author or Editor:
2nd Paragraph, first sentence under Discussion.
... correctly onto the SD crd, the card..." should be "card"

Kent Peterson  May 21, 2014  Aug 22, 2014
PDF
Page 11
Last line of the page

"attache" should be "attach".

Note from the Author or Editor:
fixed in proof

Kevin C.  Aug 25, 2013  Dec 03, 2013
PDF
Page 12
First paragraph on the page

The first paragraph ends with the statement "you should avoid the Bluetooth variety of wireless peripherals". It would be helpful to explain why that statement was made.

Note from the Author or Editor:
fixed in copy edit

Kevin C.  Aug 25, 2013  Dec 03, 2013
ePub
Page 18
Under figure

Change "This is just" to "This just"

Note from the Author or Editor:
fixed in proof

Geoffrey Mickleson  Aug 22, 2013  Dec 03, 2013
Printed
Page 21
Under Discussion section

sudo passwd changes the password for superuser (root) - in Raspberian at least. To change the password for the pi user you just need passwd. There's other ways of course, but I think the example means to use just passwd.

Note from the Author or Editor:
On page 21, change the code that says:

$ sudo passwd

to be just:

$ passwd

Anonymous  Dec 27, 2013  Aug 22, 2014
PDF
Page 30
Second last paragraph

There is a missing word in the first sentence which reads (in part) "Setting up a wireless is very easy ...". It should be "Setting up a wireless connection is very easy ...".

Note from the Author or Editor:
fixed in copy edit

Kevin C.  Aug 25, 2013  Dec 03, 2013
ePub
Page 31
Warning box

This isn't really an issue or question, but a suggestion.

The warning box mentions that rm does not normally ask for confirmation before removing the file.

You might include a section in the book about setting up command aliases etc within the bash_profile/bashrc files.
Some good examples (related to the previously mentioned warning) are:
alias rm='rm -i'
alias mv='mv -i'
alias cp='cp -i'

-i (interactive) will cause the command to confirm before overwriting/deleting a file. You can override the -i with a -f. This may or may not affect commands run with sudo. I don't remember how sudo treats aliases or if it's aware of them.

Note from the Author or Editor:
I have added a section for this.

Jason  Jul 08, 2013  Dec 03, 2013
ePub
Page 38
Under See Also

Change "which I credits" to "which I credit in"

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Aug 22, 2013  Dec 03, 2013
ePub
Page 38

hookup would more correctly be "hook up" OR connect

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Aug 22, 2013  Dec 03, 2013
ePub
Page 41
2/3 down page

Fine the line should be Find the line (Fine should be Find)

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Aug 22, 2013  Dec 03, 2013
ePub
Page 54
First paragraph of Solution section for Reading User Input

In the first sentence of the solution, "input_raw" should be "raw_input".

Note from the Author or Editor:
fixed

Selby  Jul 10, 2013  Dec 03, 2013
ePub
Page 56
See Also in "Converting Strings to Numbers" recipe

The sentence under See Also states "For the reverse operation of turning a string into a number, see the next recipe (Converting Numbers to Strings)."

Converting numbers to strings is the previous recipe, not the next.

Note from the Author or Editor:
fixed

Selby  Jul 10, 2013  Dec 03, 2013
ePub
Page 57
Solution for Replacing one string with another recipe

The example code does not match the description.

The example code replaces "X" with "times". The description states it will replace "X" with "Jane".

Note from the Author or Editor:
fixed

Selby  Jul 10, 2013  Dec 03, 2013
PDF
Page 68
3rd paragraph from bottom

Problem 3.12.: "Understanding File Permissions"
You write: "This field only makes sense if the listing entry is for a directory, it[sic!] it is a file, it will always be just 1."
1.) It is not true that the link count will always be 1 for files. The column shows the number of hard links to a file. You can most probably find examples in /bin or /usr/bin. But I think you won't want to explain hard links to your readers. So probably leave the second part away and replace "only" with "mostly".
2.) "it it" should read "if it".

Note from the Author or Editor:
fixed in proofs

H. Bongartz  Nov 12, 2013  Dec 03, 2013
PDF
Page 73
Discussion section

Problem 3.16.: "Installing Software with apt-get"
You explain how to install (and in the next recipe remove) software packages, but I'm missing some hint about /finding/ new software. The user must know the package name from somewhere to be able to install it with apt-get. You could mention "apt-cache search ..." for this or a graphical package manager.

Note from the Author or Editor:
fixed in proofs.

H. Bongartz  Nov 12, 2013  Dec 03, 2013
PDF
Page 73
Remark at middle of page

Gratuitous underscore, probably missing italicization for "E: Problem with MergeList /var/lib/dpkg/status".

Note from the Author or Editor:
fixed in proofs

H. Bongartz  Nov 12, 2013  Dec 03, 2013
PDF
Page 73
2nd paragraph from bottom

Uppercase "You", twice, in problem section of problem 3.17.

Note from the Author or Editor:
Fixed by copy editor

H. Bongartz  Nov 12, 2013  Dec 03, 2013
PDF
Page 74
Discussion section of problem 3.17

The --purge option to "apt-get remove" does _not_ remove pre-requisite packages. It deletes any configuration files for the package, in addition to the package contents itself. A normal "apt-get remove" without that option leaves the config files alone in case you ever want to install that package again and do not want to rewrite your carefully crafted configuration.
If you want to remove pre-requisite packages, use "apt-get autoremove"!

You write: "The apt-get clean option will do some further tidying up of unused package installation files."
I would stress the importance of "apt-get clean" more. "apt-get clean" is most important to reclaim disk space, as it removes all downloaded package files. It should be called after every larger update, if disk space is scarce. The only reason to keep those files is if you plan to remove and install packages again without the need to download them another time.
(Keeping those files can be seen as a remnant of the times when downloading packages was slow or expensive. Today this is not the case for most users, so "apt-get clean" can be called without hesitation.)

Note from the Author or Editor:
fixed in proofs

H. Bongartz  Nov 12, 2013  Dec 03, 2013
PDF
Page 74f
Solution and discussion of problem 3.18.

You should mention that the URL might need quoting or just quote it in the example.
Many URLs contain characters as '~', '!' or '$' that are interpreted by the shell and can lead to hard to recognize errors.

Note from the Author or Editor:
fixed in proofs

H. Bongartz  Nov 12, 2013  Dec 03, 2013
PDF
Page 75
1st paragraph

Replace 'wfor' by 'for'.

Note from the Author or Editor:
fixed in proffs

H. Bongartz  Nov 12, 2013  Dec 03, 2013
ePub
Page 99
Under Discussion

ALthough should be Although

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Aug 22, 2013  Dec 03, 2013
PDF
Page 99
Near bottom

demon should be daemon

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 104
Under See Also

Minecreaft should be Minecraft

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
ePub
Page 106

All instances of E.g. thoughout book should be e.g. (no capital E)
Same with I.e. being i.e. (no capital I)

Note from the Author or Editor:
fixed in proofs

Geoffrey Mickleson  Aug 22, 2013  Dec 03, 2013
Printed
Page 127
5.19 soultion

<=] instead of <=, right square bracket inserted.

Note from the Author or Editor:
Remove the ']' character from the section Solution on page 127

Anonymous  Jul 24, 2014  Aug 22, 2014
ePub
Page 150

What does (two just) mean?

Should it be (just two instead of four) OR (only two instead of four)

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Aug 22, 2013  Dec 03, 2013
ePub
Page 151
Under Problem

knoww should be know

Change "and find" to be "and to find" in this sentence.

Note from the Author or Editor:
fixed in proof

Geoffrey Mickleson  Aug 22, 2013  Dec 03, 2013
ePub
Page 153
Under See Also

Cobler should be Cobbler

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Aug 22, 2013  Dec 03, 2013
ePub
Page 160
Under See Also

hight capacity should be high-capacity

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Aug 22, 2013  Dec 03, 2013
PDF
Page 203
Top

"using 470ohm" should be "using a 470ohm"

Note from the Author or Editor:
fixed in proofs

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 205
United States

has extra indentations in last 2 lines of program

currently"

while (True):
GPIO.output(18, True)
time.sleep(0.5)
GPIO.output(18, False)
time.sleep(0.5)
"

should be "

while (True):
GPIO.output(18, True)
time.sleep(0.5)
GPIO.output(18, False)
time.sleep(0.5)
"

Note from the Author or Editor:
In the code example on page 205, the two lines should be tabbed left to be directly level with the two lines above them.

GPIO.output(18, False)
time.sleep(0.5)

Anonymous  Jul 25, 2014  Aug 22, 2014
PDF
Page 205
Second paragraph

k should be right next to the Ohm symbol
i.e. kOhm not k Ohm

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 208
Under Solution

femaile should be female

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 210
Everywhere

All occurrences of high power or High power should be high-power.
Likewise low-voltage for low voltage.

Note from the Author or Editor:
fixed in proofs

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 213
Under Discussion

sortenned should be shortened
over specify should be over-specify

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 214
Top

down side should be downside OR down-side

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 233
Bottom

navidate should be navigate

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 234
Bottom

pareamter should be parameter

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 269
Bottom

True for on should be True for On

Note from the Author or Editor:
fixed in proofs

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 285
At Bottom

PGIO should be GPIO

Note from the Author or Editor:
fixed in proofs

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
Printed
Page 288
United States

Programs 11.11 and 11.12 with pygame will not working in python 3 as there installed pygame will only work with python 2.

Note from the Author or Editor:
Please add the following text to the end of the first paragraph on page 290:

This recipe must be made using Python 2 rather than Python 3, as Pygame is not included with Python 3.

Anonymous  Jul 28, 2014  Aug 22, 2014
Printed, PDF
Page 290-291
Last paragraph of Solution and whole paragraph of Discussion

You wrote "If you press an arrow key or Shift key, the program will throw an error because those keys don?t have an ASCII value." in the last paragraph of the Solution, but also "which allows you to use the cursor and other non-ASCII keys (like the up arrow key and Home) on the keyboard." in the Discussion.
I think these descriptions contradict each other.

By the way, you wrote "In this case, Ctrl-C won?t stop this program from running." but, in fact, Ctrl-C causes error and effectively stops the program!

Note from the Author or Editor:
Page 290, last but one para. The text 'If you press an arrow or Shift key, ...' should read: If you press an arrow or Shift key with the first stdin read approach, ...'

Bun Mizuhara  Jun 02, 2014  Aug 22, 2014
PDF
Page 293
bottom

Should "ready made" be ready-made with a hyphen?

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 294
Middle

destinctive should be distinctive

Note from the Author or Editor:
fixed in proofs

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 296
middle

precidence should be precedence
Under the Discussion section; modue should be module
Whenever referring to real time clock module, it flows better to say "an RTC"
OR
A Real Time Clock module.
An when using the acronym, RTC

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 305
top

should read .... rather thick legs which are too thick ....

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 312
Under Discussion

sometime should be ... sometimes a ....

Note from the Author or Editor:
fixed in proofs

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 325
near bottom of page

raspberry should be Raspberry

Note from the Author or Editor:
fixed in proofs

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 329
Second paragraph

recoded should be recorded

Note from the Author or Editor:
fixed in proofs

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 342
link below 14.1

http://razzpisampler.oreilly.com does not work. Copy and paste still does not work. Search of O'Reilly site gives no results.

Note from the Author or Editor:
It appears that O'Reilly has changed their website, so that this URL no longer works.

Aug 2014: tested again and link is working.

David E Ulmer  Dec 10, 2013  Aug 22, 2014
PDF
Page 342
Middle of page

diaplays should be displays
Next sentence should read .... revision 2, then you will .....

Note from the Author or Editor:
fixed in proofs

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 344
Top of page

withan should be with an

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 345
5th line

32MB should be 32 kb

Note from the Author or Editor:
fixed at proof stage

Michael Harms  Nov 20, 2013  Dec 03, 2013
PDF
Page 347
Bottom of page

The Arduino IDE should be The Arduino

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 351
Under 14.3 Solution

should read .... so that they can communicate ....

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 353
Third paragraph

want to owner should be ... want to power ....

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
Printed
Page 355
figure 14-9

Figure 14-9 is called "Wiring diagram for Arduino and push switch" and is referred to as this in the text. Figure 14-9 is in fact a screen shot of the Arduino IDE! I would like to see the wiring diagram for the Arduino and push switch.

Anonymous  Jan 13, 2014  Aug 22, 2014
PDF
Page 355
Under Discussion section

Spurious "s" in the line after Recipe 9.7 should be as

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 356
Everywhere

all instances of "convertor" should be converter

Note from the Author or Editor:
fixed in proofs

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 358
Under Discussion

Whileit should be While it
convresion should be conversion

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013
PDF
Page 386
Under 15.2

3 inch should be 3 inches

Note from the Author or Editor:
fixed in copy edit

Geoffrey Mickleson  Oct 29, 2013  Dec 03, 2013