[IronPython] problem with IronPython 1.0 and os.utime ?

Bern.McCarty at bentley.com Bern.McCarty at bentley.com
Thu Sep 7 21:38:45 CEST 2006


I am using IronPython 1.0 under Windows XP and using the python
libraries from ActivePython 2.4 Build 243. When I run this program under
IronPython:

import os
import stat

def printFileTimes(st):
    print 'Last Access:       ', st[stat.ST_ATIME]
    print 'Last Modification: ', st[stat.ST_MTIME]
    print 'Creation Time:     ', st[stat.ST_CTIME]
    print

def main():
    filename = 'testfile.txt'
    oOutFile = open(filename , 'w')
    oOutFile.writelines(['Line 1\n', 'Line 2\n', 'Line 3\n'])
    oOutFile.close()

    st1 = os.stat(filename)
    printFileTimes(st1)
    print 'Now set the last-access and last-mod times to what they
supposedly already are.'
    os.utime(filename, (st1[stat.ST_ATIME], st1[stat.ST_MTIME]))
    st2 = os.stat(filename)
    printFileTimes(st2)
    print 'So what is up with that last-access time now? Why did it
change?'

if __name__ == '__main__':
    main()



I get this output:



Last Access:        63293240071
Last Modification:  63293240071
Creation Time:      63293239100

Now set the last-access and last-mod times to what they supposedly
already are.
Last Access:        125428808071
Last Modification:  63293240071
Creation Time:      63293239100

So what is up with that last-access time now? Why did it change?


Whereas under Cpython it works as expected.



More information about the Ironpython-users mailing list