Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ebianchi mannequin opened this issue Jun 15, 2017 · 5 comments
Closed

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

ebianchi mannequin opened this issue Jun 15, 2017 · 5 comments
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes docs Documentation in the Doc dir easy type-feature A feature request or enhancement

Comments

@ebianchi
Copy link
Mannequin

ebianchi mannequin commented Jun 15, 2017

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']

    @ebianchi
    Copy link
    Mannequin Author

    ebianchi mannequin commented Jun 15, 2017

    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

    @ebianchi ebianchi mannequin added the 3.7 (EOL) end of life label Jun 15, 2017
    @ebianchi ebianchi mannequin assigned docspython Jun 15, 2017
    @ebianchi ebianchi mannequin added docs Documentation in the Doc dir type-feature A feature request or enhancement labels Jun 15, 2017
    @bitdancer
    Copy link
    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 :)

    @iritkatriel iritkatriel added easy 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes and removed 3.7 (EOL) end of life labels Jan 11, 2022
    @iritkatriel iritkatriel changed the title Enhance documentation of os.mkdir() [doc] mention that os.mkdir() raises FileNotFound if path does not exist Jan 11, 2022
    @iritkatriel
    Copy link
    Member

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

    @miss-islington
    Copy link
    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

    @miss-islington
    Copy link
    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

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes 3.11 only security fixes docs Documentation in the Doc dir easy type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants