AttributeError with 'time' module
Jason Friedland
jason at omeninternet.com.au
Mon Nov 18 23:47:48 EST 2002
More information about the Python-list mailing list
Mon Nov 18 23:47:48 EST 2002
- Previous message (by thread): AttributeError with 'time' module
- Next message (by thread): simple text editor w/ D&D of hyperlinks
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi there
I'm just starting out on Python so forgive me if this is a silly question.
I am attempting to make use of the time module (RH 7.3, Python 2.2.2)
and keep receiving the following error:
----------------------
AttributeError: 'module' object has no attribute 'strftime'
----------------------
Upon running the script below:
----------------------
import time
def writeLogFile(message, file_name):
file_date = time.strftime('%a, %d %b %Y %H:%M:%S', \
time.localtime(time.time()))
file_text = " - " + message
try:
file = open(file_name, "a")
except:
print "Couldn't append to file!"
sys.exit()
file.write(file_date)
file.write(file_text)
file.write("\n")
file.close()
----------------------
I have checked out the time module info at
http://www.python.org/doc/2.2.2/lib/module-time.html but this appears to
be the correct usage.
Is there something I'm missing here?
TIA
Jason Friedland
- Previous message (by thread): AttributeError with 'time' module
- Next message (by thread): simple text editor w/ D&D of hyperlinks
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list