Python Programming on Win32 by Mark Hammond and Andy Robinson Unconfirmed error reports are from readers. They have not yet been approved or disproved by the author or editor and represent solely the opinion of the reader. If you have any error reports or technical questions, you can send them to booktech@oreilly.com. (Please specify the printing date of your copy.) This page was last updated July 6, 2001. Here's the key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification UNCONFIRMED errors and suggestions from readers: {82} 3rd paragraph; Does the module "dates.py" actually exist? I couldn't find it on www.python.org or the vaults of parnassus. It did come with my Python for Win32 or Python for Unix. [82] last paragraph; The excercise does not work with the latest Python release from ActiveState Tools. It cannot find sec2asc() and requires one argument for mktime(). mktime() should have nine arguments. {83} 2nd example code; The comment '# returned in alpha order' should follow the statement 'sales.items()' instead of 'sales['South']' {85} IN the third and tenth line of the example, the following lines: >>> T1.date = asc2sec('1/1/1999') ... >>> T2.date = asc2sec('5-Jan-1999') Should read as follows: >>> T1.date = transac.asc2sec('1/1/1999') ... >>> T2.date = transac.asc2sec('5-Jan-1999') If not the following error will occur: Traceback (innermost last): File "", line 1, in ? NameError: asc2sec {88} In the first sentence of the third paragraph, the url given for examples, http://starship.python.net/crew/mhammond/ppw32/, is a deadlink as of 2/6/2000 7 pm est. {91} In line 6; "renameAccount(seDates lf, oldAcct..." ??? {118} The fourth sentence in the first paragraph in the section titled "Unpacking Variant Arrays", it now reads: "VarArrayHighBound(array, dimension) and VarArrayHighBound(array, dimension) are the eqivalents of UBound() and LBound()." Should read; "VarArrayHighBound(array, dimension) and VarArrayLowBound(array, dimension) are the eqivalents of UBound() and LBound()." {144} In the second code example on the page delete the extra: >>> x1App.Workbooks(1).Sheets(1).Cells(1,1).Value = "Python Rules!" which appears as the second-to-last line in the code listing. {163} bottom line; self.getStyleDictionary() should be self.getStyleList() [165] 2nd code snippet; The last 3 lines are missing from addStyledPara() - it should read def addStyledPara(self, text, stylename): if text[-1] <> '\n': text = text + '\n' self.wordSel.InsertAfter(text) self.wordSel.Style = stylename self.selectEnd() as per the code in ppw_samples.zip (208) Label of table 12-2 (at top); The label for Table 12-2 is back-to-front. It reads: "Default Python Object to VARIANT Translation" it should read: "Default VARIANT to Python Object Translation" (cf table 12-1 on previous page) {210} Sample code, constant definition (line 6); The declared constant FMTID_UserDefinedProperties should really be named FMTID_SummaryInformation, in order to agree with ObjIdl.h. Note that the value corresponds to the correct name, so the code still works fine. It is only the name that is incorrect. {244} At the bottom of the page, the SQL statement needs to be enclosed in double quotes, or you will get a syntax error. It now reads: >>> mycursor.execute('UPDATE Invoices SET InvoiceDate={d '1999-04-15' } WHERE InvoiceID=199904001') Should read: >>> mycursor.execute("UPDATE Invoices SET InvoiceDate={d '1999-04-15' } WHERE InvoiceID=199904001") {246} In the second paragraph, 'cursor.commit()' should be 'conn.commit()' because commit() is a method of the connection object, not the cursor object. {252} The second code sample now reads: >>> for i in range(daoRS.Fields.Count): ... daoField = daoRS.Fields[i] <===== ... print '%s = %s' % (daoField.Name, daoField.Value) The index in the first line in the if loop should use parens instead of square brackets, like in the example above the for loop. So it should read: >>> for i in range(daoRS.Fields.Count): ... daoField = daoRS.Fields(i) <===== ... print '%s = %s' % (daoField.Name, daoField.Value) {277} Line 17 in the first code sample now reads: (server_msg, body, octets) = a.retr(1) Should read: (server_msg, body, octets) = a.retr(thisNum) With the code as written, the program will retrieve the first mail message NumMsgs times instead of retrieving each mail message. (314) first code example; A *very minor* typo: The first line in the function compute_size says: "uses walker3 to compute the size" It should read: "uses walker4 to compute the size" [350] 1st paragraph; The name of the paragraph is "Installing, Debugging and Running a Python Service" but I can't find the Debugging part. should read: "Installing and Running a Python Service" {356} 1st paragraph; In the description of the functions that log messages to the NT Event Log, the text lists LogInfoMsg(), LogErrorMsg(), and LogWarningMessage()--this last does *not* abbreviate 'Msg' as the others do, and calling it fails with an Attribute Error stating that LogWarningMessage is not found. The Appendix does list all three functions as ending in ...Msg() rather than ...Message(). {374} The fourth line of code from the top of the page now reads: "myport.send('ATI\015') # ask modem to identify itself" I suggest this should read: "myport.write('ATI\015') # ask modem to identify itself" No send method exists my Serial.py module, but a write method is present. Subsequent examples (p377, bottom third of the page) do not repeat this mistake: they demonstrate the use of the write method. {383} 1st code section in page; the code line clientsock.connect('tahoe',8578) should read clientsock.connect( ('tahoe',8578) ) {416} On Line 20 of the code sample, there should be a semicolon after the expression: "frame = MyFrame(NULL, -1, "Hello from wxPython") Should read: "frame = MyFrame(NULL, -1, "Hello from wxPython"); {416} On Line 17 of the code sample, the expression reads: "menu.Append(ID_EXIT, "E&xit", "Termainate the program")" Should read: "menu.Append(ID_EXIT, "&Exit","Terminate the program")" Also, menu.AppendSeparator() gets an AttributeError: (version problem or placement?) I'm new to wxPython, and these are somewhat obvious errors unless you are a newbie. {434} The second line of code on the page now reads: "dateOK = (date == dates.testasc(date))" Should read: "dateOK = (date == string.split(dates.testasc(date))[0]) #nk" {569} table in section "Messages"; The last 4 lines in the table say that the values 1-9 can be used for generic messages (Message Text = "%1"). But in the source-file "PythonServiceMessages.mc" the definition is: ---------- MessageId=0xF000 Severity=Error SymbolicName=MSG_ER1 Language=English %1 ---------- so I think the right values are 0xF000 - 0xF008. {online examples} I recently downloaded the examples for this book. I discovered an error within the module 'dates.py'. In line 53 it reads: LATE = mktime(2038,1,15,0,0,0,0,0,0) It should read: LATE = mktime((2038,1,15,0,0,0,0,0,0)) It is just a minor thing, but the whole dtbrowse won't work with this error.