Skip to content

[doc] mention that os.mkdir() raises FileNotFound if path does not exist #74862

Closed

Description

@ebianchi
mannequin
BPO 30677
Nosy @bitdancer, @miss-islington, @iritkatriel, @slateny
PRs
  • bpo-30677: [doc] mention that os.mkdir() can raise FileNotFoundError #31548
  • [3.10] bpo-30677: [doc] mention that os.mkdir() can raise FileNotFoundError (GH-31548) #31877
  • [3.9] bpo-30677: [doc] mention that os.mkdir() can raise FileNotFoundError (GH-31548) #31878
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2022-03-14.20:53:04.659>
    created_at = <Date 2017-06-15.14:08:58.623>
    labels = ['easy', '3.9', '3.10', '3.11', 'type-feature', 'docs']
    title = '[doc] mention that os.mkdir() raises FileNotFound if path does not exist'
    updated_at = <Date 2022-03-14.20:53:04.659>
    user = 'https://bugs.python.org/ebianchi'

    bugs.python.org fields:

    activity = <Date 2022-03-14.20:53:04.659>
    actor = 'iritkatriel'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2022-03-14.20:53:04.659>
    closer = 'iritkatriel'
    components = ['Documentation']
    creation = <Date 2017-06-15.14:08:58.623>
    creator = 'ebianchi'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30677
    keywords = ['patch', 'easy']
    message_count = 5.0
    messages = ['296097', '296107', '415179', '415186', '415187']
    nosy_count = 6.0
    nosy_names = ['r.david.murray', 'docs@python', 'ebianchi', 'miss-islington', 'iritkatriel', 'slateny']
    pr_nums = ['31548', '31877', '31878']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue30677'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    Activity

    1. ebianchi commented on Jun 15, 2017

      ebianchimannequin
      MannequinAuthor

      Currently, documentation for os.mkdir() (see https://docs.python.org/3.6/library/os.html#os.mkdir ) reports only FileExistsError exception if directory exists. Please, add other exceptions (e.g. FileNotFoundError if directory is created in a non existent path) or report OSError as superclass of exceptions returned from this method

    2. added
      docsDocumentation in the Doc dir
      type-featureA feature request or enhancement
      on Jun 15, 2017
    3. bitdancer commented on Jun 15, 2017

      @bitdancer
      Member

      We don't generally document all exceptions that a method can raise, only those that are relevant to its specific API. In this case, documenting the exception answers the question, "what happens if the directory already exists?" This question is relevant to the API since the other reasonable possibility is that it would act as if the mkdir had succeeded. As for documenting OSError, I'm sure there are ways to get os.mkdir to raise an exception that is not an OSError.

      However, there is an argument to be made for documenting FileNotFound: the other reasonable thing the function could do in that case would be to create all intermediate path parts, but it does not do that (you use os.makedirs for that). Since os.makedirs is documented right after os.mkdir, I'm not sure it is worth adding, but one can make the argument :)

    4. changed the title [-]Enhance documentation of os.mkdir()[/-] [+][doc] mention that os.mkdir() raises FileNotFound if path does not exist[/+] on Jan 11, 2022
    5. iritkatriel commented on Mar 14, 2022

      @iritkatriel
      Member

      New changeset 879fbd9 by slateny in branch 'main':
      bpo-30677: [doc] mention that os.mkdir() can raise FileNotFoundError (GH-31548)
      879fbd9

    6. miss-islington commented on Mar 14, 2022

      @miss-islington
      Contributor

      New changeset efa7250 by Miss Islington (bot) in branch '3.10':
      [3.10] bpo-30677: [doc] mention that os.mkdir() can raise FileNotFoundError (GH-31548) (GH-31877)
      efa7250

    7. miss-islington commented on Mar 14, 2022

      @miss-islington
      Contributor

      New changeset b4fd91b by Miss Islington (bot) in branch '3.9':
      [3.9] bpo-30677: [doc] mention that os.mkdir() can raise FileNotFoundError (GH-31548) (GH-31878)
      b4fd91b

    8. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.10 (EOL)end of life3.11only security fixes3.9 (EOL)end of lifedocsDocumentation in the Doc direasytype-featureA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions