p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Python Projects (http://p2p.wrox.com/forumdisplay.php?f=773)
-   -   P79, Try It Out - Download Code (http://p2p.wrox.com/showthread.php?t=94798)

jc. August 7th, 2015 09:44 AM

P79, Try It Out - Download Code
 
Hi,

The book (correctly) starts with:

Code:

import csv
from datetime import datetime

But the downloaded code (incorrectly) starts with:

Code:

import csv, datetime
As a result, strptime (and presumably strftime) are not found and you get:

Code:

AttributeError: 'module' object has no attribute 'strptime'

Alan G August 7th, 2015 04:03 PM

I've no idea how that has happened because the zip file that I submitted
clearly has the dual import as per the book.

So my apologies for that, but my code which I tested has a

from datetime import datetime

line.

And certainly to make the code work you need that style of import.

jc. August 8th, 2015 10:58 AM

Thanks for confirming Alan.

It was actually quite good; I learn more, probably, in the troubleshooting.


All times are GMT -4. The time now is 09:59 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.