[issue15228] os.utime() docs not clear on behavior on nonexistant files
New submission from Daniel Grace <thisgenericname@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@python components: Documentation messages: 164422 nosy: dewin, docs@python priority: normal severity: normal status: open title: os.utime() docs not clear on behavior on nonexistant files type: enhancement _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15228> _______________________________________
Brian Brazil <brian.brazil@gmail.com> added the comment: Here's a patch that should clarify this. ---------- keywords: +patch nosy: +bbrazil Added file: http://bugs.python.org/file26306/issue15228-utime-touch-doc.patch _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15228> _______________________________________
Changes by Larry Hastings <larry@hastings.org>: ---------- nosy: +larry _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15228> _______________________________________
Larry Hastings <larry@hastings.org> added the comment: I don't think this needs clarifying. If you think the reference to "touch" currently only muddles the issue, let's remove it entirely. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15228> _______________________________________
Roundup Robot added the comment: New changeset 62321359c35b by Georg Brandl in branch '3.3': Closes #15228: remove reference to Unix "touch"; it is confusing since the path needs to exist for os.utime() to succeed http://hg.python.org/cpython/rev/62321359c35b ---------- nosy: +python-dev resolution: -> fixed stage: -> committed/rejected status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15228> _______________________________________
participants (4)
-
Brian Brazil
-
Daniel Grace
-
Larry Hastings
-
Roundup Robot