[New-bugs-announce] [issue15228] os.utime() docs not clear on behavior on nonexistant files

Daniel Grace report at bugs.python.org
Sat Jun 30 21:55:23 CEST 2012

New submission from Daniel Grace <thisgenericname at gmail.com>:

The documentation for os.utime() at http://docs.python.org/py3k/library/os.html#os.utime states:

"Set the access and modified times of the file specified by path. [...] The effect is similar to running the Unix program touch on the path.)"

Unlike 'touch', os.utime() will not create an empty file if called on a file that does not exist.  IMO the current behavior is correct, but the comparison of os.utime() to touch implies that it would create empty files.

I suggest clarifying the documentation to emphasize that os.utime() will not create new files and raises OSError in the event that the file does not exist.

assignee: docs at python
components: Documentation
messages: 164422
nosy: dewin, docs at python
priority: normal
severity: normal
status: open
title: os.utime() docs not clear on behavior on nonexistant files
type: enhancement

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list