On Sun, Sep 7, 2008 at 11:27 PM, Wayne Watson
<[EMAIL PROTECTED]> wrote:
> Well, maybe. Here's the file the change and results:
>
> # Using datetime to do date-time math on a file date-time stamp and
> # the creating the new stamp
> from datetime import datetime, timedelta
>
> Traceback (most recent call last):
>   File
> "C:/Sandia_Meteors/Improved_Sentinel/Sentinel_Playground/Utility_Dev/debugDateTime.py",
> line 7, in ?
>     d = datetime.datetime(*(time.strptime('20080321_113405', format)[0:6]))
> AttributeError: type object 'datetime.datetime' has no attribute 'datetime'

This is just some confusion about imports, abetted by the naming
scheme of the datetime module.

The datetime module contains a datetime class. The full name of the
class is datetime.datetime. If you "import datetime" then you have to
use the full name. Another way to import is "from datetime import
datetime". Now the name datetime refers to the class and you can just
use its name alone. So, try
  d = datetime(*(time.strptime('20080321_113405', format)[0:6]))

You can read about the import statement here:
http://docs.python.org/tut/node8.html

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to