Newbie question here.
I'm trying the code provided from: How to get file creation & modification date/times in Python?
The exact code I'm running is:
# -*- coding: utf-8 -*-
import os.path, time
myFile = open('IMG_4847.PNG', 'rb')
print "last modified: %s" % time.ctime(os.path.getmtime(myFile))
But, I'm getting the following error:
Traceback (most recent call last):
File "test.py", line 4, in <module>
print "last modified: %s" % time.ctime(os.path.getmtime(myFile))
File "C:\Python27\lib\genericpath.py", line 54, in getmtime
return os.stat(filename).st_mtime
TypeError: coercing to Unicode: need string or buffer, file found
What am I missing here?