I've deleted most of this page for use here. For the full story, see either www.rmi.net/~lutz/pp4e-updates.html live, or the snapshot of the book's website in this package's changes\book-web-site\snapshot-feb11 folder.
if askuser: try: text = open(file, 'r', encoding=askuser).read()to the following, adding the new first line (the rest of this code is unchanged):
self.text.focus() # else must click if askuser: try: text = open(file, 'r', encoding=askuser).read()Second, on page 704, at code line 8 near top of page, similarly change:
if askuser: try: text.encode(askuser)to the following, again just adding the new first line:
self.text.focus() # else must click if askuser: try: text.encode(askuser)Reprints: please let me know if there is not enough space for the inserts; I'd rather avoid altering page breaks in the process. This patch will also be applied to future versions of the book's examples package; in the package, the code in question is in file PP4E\Gui\TextEditor\textEditor.py, at lines 298 and 393.
server = smtplib.SMTP(self.smtpServerName) # this may fail too server = smtplib.SMTP(self.smtpServerName, timeout=15) # this may fail tooSimilarly, change code line 4 on page 970 from the first of the following to the second:
server = poplib.POP3(self.popServer) server = poplib.POP3(self.popServer, timeout=15)In the book examples package, these changes would be applied to line 153 of mailSender.py, and line 34 of file mailFetcher.py, both of which reside in directory PP4E\Internet\Email\mailtools. They'll be patched in a future examples package version.
tmp = open(tempname, 'wb') # already encoded tmp.write(asbytes) webbrowser.open_new('file://' + tempname)to read as follows, adding the text that starts with the semicolon (I'm combining statements to avoid altering page breaks):
tmp = open(tempname, 'wb') # already encoded tmp.write(asbytes); tmp.close() # flush output now webbrowser.open_new('file://' + tempname)In the book's examples package, this code is located at line 209 in file PP4E\Internet\Email\PyMailGUI\ListWindows.py; it will be patched there too in a future examples package release (version 1.2, date TBD).