The errata list is a list of errors and their corrections that were found after the product was released.
The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.
| Version |
Location |
Description |
Submitted By |
| Printed |
Page 5
paragraph 2 |
The original wording in this pararaph was mangled somewhere during the
edit process. The sentence:
"And although Python is _dynamically_ typed -- types are tracked automatically
instead of being declared (it is still _strongly_ typed) -- every operation
is sanity checked as your program runs."
was originally written as
"And although Python is _dynamically_ typed -- types are tracked automatically
instead of being declared, it is still _strongly_ typed -- every operation
is sanity checked as your program runs."
The modified version works in a way, but is difficult to parse, and subtly
different enough from its original intent to be broken.
|
Anonymous |
| Printed |
Page 38
Example 2-2 |
In example 2-2, the source file is named make_db_files.py. However, thereafter it is referred to as make_db_file.py. (without the 's')
|
Anonymous |
| Printed |
Page 42
Example 2-7 |
In the title of Example 2-7 the file is called "update-db-pickle.py" however, it is referenced as "update_db_pickle.py" (using '_' instead of '-')thereafter.
|
Anonymous |
| Printed |
Page 48
Paragraph on encapsulation |
"...without breaking their users."
I think the last word in the paragraph was meant to be "uses" not "users".
|
Anonymous |
| Printed |
Page 63
Example 2-27 |
In customizegui.py, the "from Tkinter import *" line at the very top of this
example is missing in the book (the result of an unfortunate cut and paste,
apparently). Without it, the "mainloop()" call at the end is undefined. This
was fixed in the examples distribution package (version 1.1), but not in the
book.
|
Anonymous |
| Printed |
Page 74
Example 2-32 -- webserver.py |
The coding of the webserver example tripped me up. I couldn't get the webserver to run. It would either crash with a "permission denied" error, or "address in use" error when run as root.
A more experience user pointed out that port 80 is reserved so no user but root could run the thing, and that apparently some process was already running on that port. The workaround was to change the port to 8080 (or somesuch, anything over 1023) and to modify the url to localhost:8080 (or whatever). This worked fine and I'm back to work.
I'd suggest a footnote identifying the issue and providing a workaround.
|
Anonymous |
| Printed |
Page 107
3rd paragraph |
the statement:
os.sep.split(dirpath)
must be replaced by:
dirpath.split(os.sep)
|
Anonymous |
| Printed |
Page 116
1/4 up from bottom |
C: emp>cd C:PP2ndEdexamples
Should be:
C: emp>cd C:PP3rdEdexamples
|
Anonymous |
| Printed |
Page 126
3rd code example |
maybe not an error, I am a new user (Python2.6), but cannot figure this out - stream redirection on a windows command console:
when I type >teststreams.py < input.txt
I get:
Hello stream world
Enter a number>Bye
it does not seem to use the input.txt
for input, I created a txt file with an 8 on the first line, and a 6 on the second line, saved as input.txt in the same file as teststreams.py.
if I type >type input.txt
I get:
8
6
I cant figure out what is going wrong here - why teststreams.py does not square the 8 and 6, as it does in the book. Any help would be greatly appreciated. I apologize in advance if this is the incorrect forum for a question such as this. Im a newbie to Python
|
KS |
| Printed |
Page 128
Middle of page |
C:...PP3ESystemStreams>python sorter.py < data.txt sum file
1164
should be:
C:...PP3ESystemStreams>python adder.py < data.txt sum file
1164
|
Anonymous |
| Printed |
Page 157
first block of code |
The script opens a file named 'data.txt', yet the description immediately following the code references the file 'hillbillies.txt'. The example file is in fact 'hillbillies.txt'; the script as provided does not work unless the file data.txt happens to exist in the same drive as 'hillbillies.txt'.
|
Anonymous |
| Printed |
Page 203
Last example |
(Tiny comment, but the text might confuse people new to Linux.)
The example uses
$ echo $status
to query the status code and write that this is the way to do it "on Linux".
In fact, it is the way to do in in the C shell family of command language
interpreters. My Linux distribution defaults to the GNU Bourne-Again Shell
(bash) where you query the question-mark variable:
$ python -c 'import sys; sys.exit(42)'
$ echo $?
42
(If you ever wondered where perl got most of its "line noise syntax" from,
wonder no more.)
The valuable "status" is typically not defined. Once upon a time there was
only the Bourne Shell on *nix machines and this behaviour is found in all
command language interpreters derived from it.
I suggest changing the last text paragraph from
"On Linux, for example, ..."
to
"On Linux using the C shell, for example, ..."
If you want to be careful, add a footnote about the Bourne shell family
(sh, ksh, bash).
|
Anonymous |
| Printed |
Page 231
4th line from bottom [line 36 of launchmodes.py] |
The launchmodes.py program fails in some modes when python is installed in a
directory containing a space, e.g.,
C:Program FilesPython24
The System and Popen classes must quote the python executable's full pathname
when building command strings that use it on the Windows platform.
For instance, the
System('Pyedit', program)()
call in selftest() fails with an error message to the effect that it cannot
find the executable "C:Program".
Changing the format string in line 36 of launchmodes.py from
'%s %s'
to
'"%s" %s'
fixes the problem on my Windows platform. But it will probably break it
under Unix.
A similar problem affects the Popen class. However, it just fails to
launch PyEdit silently in selftest.
A portable fix would probably require tweaking findPythonExe to quote
(or escape blanks in) the return value if it contains blanks in a platform
dependent manner.
|
Anonymous |
| Printed |
Page 239
Example session in middle of page |
The example session is purportedly run on a Windows machine, but the 'ls'
command is not available on Windows.
|
Anonymous |
| Printed |
Page 242
Example session in middle of page |
Again, in this example, which is purportedly run on Windows, the 'ls'
command is used, which is not available on Windows.
|
Anonymous |
| Printed |
Page 245-247
Sample outputs |
Repeated use of 'ls' command in purported Windows sessions.
This is a Unix command, not available from a DOS prompt in a standard Windows
environment.
|
Anonymous |
| Printed |
Page 283
1st paragraph |
The user typed command
">>> print open.__doc__"
does not match with the printed output
"file(name[, mode[, bhuffering]]) -> file object".
The correct user typed command has to be instead
">>> print file.__doc__"
|
Anonymous |
| Printed |
Page 309
Footnote * |
I found the references to find.find in the footnote and on the following page
confusing. On my platform (Linux), PP3E/PyTools/fixeoln_all.py does not use
find.find but instead calls the shell's find(1) function.
Trying to follow the instructions in the footnote, I naively tried an
import find
which failed because I wan't in the PyTools directory. Instead I used
from PP3E.PyTools import find
which worked like a charm. I must have mentally blocked out all the Dos
specific code fragments in my reading of the examples.
Suggestion: Using the external command in example 7-4 probably doesn't add
much over the examples we have already had, so why not use your PP3E.PyTools
version? That would make the footnote and the discussion on 'Rewriting with
os.path.walk' easier for us "Unix ghetto dwellers" to follow.
(And of course you could re-rewrite it to os.walk instead, but then you'd
lose a huge footnote on page 311.)
|
Anonymous |
| Printed |
Page 339
Example 7-24 and others |
The example in the book is actually fine, but the file distributed from the
web site still has
from PP2E.PyTools.visitor import FileVisitor
instead of the correct
from PP3E.PyTools.visitor import FileVisitor
There are 18 other files in the pack with potentially the same problem:
$ python PyTools/visitor_collect_quiet1.py 'from PP2E'
Found these files:
./Dstruct/TreeView/alts/treeview_left.py
./Dstruct/TreeView/alts/treeview_subclass.py
./Integrate/Extend/Stacks/exttime.py
./PyTools/visitor_poundbang.py
./PyTools/wcall_find.py
./PyTools/wcall_find_patt.py
./System/App/apptools.py
./System/App/Clients/mtool3.py
./System/App/Clients/mtoolapp.py
./System/App/Clients/myapp.py
./System/App/Clients/myapp2.py
./System/App/Clients/myapp4.py
./System/App/Clients/tools.py
./System/App/Clients/tools2.py
./System/App/Clients/unpackapp2.py
./System/App/Kinds/interact.py
./System/App/Kinds/internal.py
./System/App/Tests/apptest.py
|
Anonymous |
| Printed |
Page 413
First sentence after example 8-24 |
Sentence reads: "When run, the Bye button here prints to stdout and Bye closes...
should be:
"When run, the Hye button here prints to..."
|
Anonymous |
| Printed |
Page 430
Example description |
Example 9-7. PP3E\Gui\Tour\xd5 uitter.py
should read:
Example 9-7. PP3E\Gui\Tour\quitter.py
Otherwise future examples won't work correctly.
File name is mislabeled.
|
Anonymous |
| Printed |
Page 430
8th line down in example 9-7 |
widget.pack(side=LEFT)
should read:
widget.pack(side=TOP, fill=BOTH)
This won't cause an error but it will not look the same as the other buttons if not formatted this way.
|
Anonymous |
| Printed |
Page 523
The example |
Line 46 of the simpleedit.py example causes a run-time exception to be thrown using Python 2.5:
Exception in Tkinter callback
Traceback (most recent call last):
File "/home/jdavies/devl/projects/devtools/Python-2.5.1/Lib/lib-tk/Tkinter.py", line 1403, in __call__
return self.func(*args)
File "simpleedit.py", line 46, in onFind
pastit = where + ('+%dc' % len(target)) # index past target
TypeError: unsupported operand type(s) for +: '_tkinter.Tcl_Obj' and 'str'
|
Anonymous |
| Printed |
Page 646
Example 12-3 |
PyEdit has a legacy import of the form "from PP2E.Gui.Tools..." which must
be "from PP3E.Gui.Tools..." in order to run. This was fixed in the examples
distribution, but not in the book. It reflects the fact that the examples
were scattered between two directory trees during development of this
edition; this reference slipped through the cracks when the trees were merged.
|
Anonymous |
| Printed |
Page 825
3rd paragraph (in box; code example) |
The code example in the box is missing a couple of newlines:
1. The first line is
import timegmt = time.gmtime(time.time())
but should be
import time
gmt = time.gmtime(time.time())
2. The last line reads
hdr = 'Date: ' + strprint hdr
but should be
hdr = 'Date: ' + str
print hdr
|
Anonymous |
| Printed |
Page 1010
Example 16-15 |
There seems to be an extra and superfluous "<form>" tag in this HTML file;
you may have to delete one of the two to make this example work. This was
fixed in the examples distribution package, but not in the book.
|
Anonymous |
| Printed |
Page 1539
N section of index |
no index entry for "not" Python keyword
|
Anonymous |
| Printed |
Page 1539
N section of index |
no index entry for "not" Python keyword
|
Anonymous |