This sure was tricky business, but it's working. Thanks to all who participated.

Now if I can my "tutor" posting problem squared away!

Kent Johnson wrote:
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

  

--
Signature.html
           Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

             (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
              Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet
            
          "If voting made any difference they wouldn't let us do it." 
                        -- Mark Twain
            
                    Web Page: <www.speckledwithstars.net/>
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to