Skip to content

os module does not have the documented EX_NOTFOUND attribute #54142

Closed

Description

@kisielk
mannequin
BPO 9933
Nosy @loewis, @birkenfeld, @bitdancer, @briancurtin

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 2010-09-24.07:10:38.926>
created_at = <Date 2010-09-23.23:48:34.206>
labels = ['type-bug', 'docs']
title = 'os module does not have the documented EX_NOTFOUND attribute'
updated_at = <Date 2010-09-24.07:10:38.918>
user = 'https://bugs.python.org/kisielk'

bugs.python.org fields:

activity = <Date 2010-09-24.07:10:38.918>
actor = 'georg.brandl'
assignee = 'docs@python'
closed = True
closed_date = <Date 2010-09-24.07:10:38.926>
closer = 'georg.brandl'
components = ['Documentation']
creation = <Date 2010-09-23.23:48:34.206>
creator = 'kisielk'
dependencies = []
files = []
hgrepos = []
issue_num = 9933
keywords = []
message_count = 9.0
messages = ['117245', '117246', '117249', '117250', '117251', '117252', '117260', '117261', '117263']
nosy_count = 6.0
nosy_names = ['loewis', 'georg.brandl', 'kisielk', 'r.david.murray', 'brian.curtin', 'docs@python']
pr_nums = []
priority = 'normal'
resolution = 'works for me'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue9933'
versions = ['Python 3.1', 'Python 2.7', 'Python 3.2']

Activity

  1. kisielk commented on Sep 23, 2010

    kisielkmannequin
    MannequinAuthor

    The library documentation (http://docs.python.org/library/os.html) states:

    """
    os.EX_NOTFOUND
    Exit code that means something like “an entry was not found”.

    Availability: Unix.

    New in version 2.3.
    """

    However, on both my Linux and OS X installs of OS X this happens:

    python
    Python 2.6.2 (r262:71600, Oct 24 2009, 03:15:21) 
    [GCC 4.4.1 [gcc-4_4-branch revision 150839]] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    im>>> import os
    >>> os.EX_NOTFOUND
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    AttributeError: 'module' object has no attribute 'EX_NOTFOUND'
    >>> 

    Unfortunately I don't have another Python version available to test with at the moment so I'm not sure if this affects other versions as well.

  2. added
    stdlib
    type-bug
    on Sep 23, 2010
  3. kisielk commented on Sep 23, 2010

    kisielkmannequin
    MannequinAuthor

    That should have read "Linux and OS X installs of *Python*".

  4. briancurtin commented on Sep 24, 2010

    @briancurtin
    Member

    The following code exists in Modules/posixmodule.c

    8167 /* These come from sysexits.h */
    ...
    8216 #ifdef EX_NOTFOUND
    8217 if (ins(d, "EX_NOTFOUND", (long)EX_NOTFOUND)) return -1;
    8218 #endif /* EX_NOTFOUND */

    sysexits.h on my Mac has no mention of EX_NOTFOUND. I'm guessing it was removed some time ago or maybe it never existed? I wasn't able to find anything after a quick Google search.

    Was there any particular reason you need EX_NOTFOUND other than that it's documented? Just trying to trace where this thing came from and went.

  5. bitdancer commented on Sep 24, 2010

    @bitdancer
    Member

    Perhaps this constant existed at some point on some linux systems...google found one comment about it referencing posix.2. I also found it mentioned in a specific version of sendmail, and in bash. When it appears it seems to most often have the value 127.

    I suspect the mention of this constant should just be deleted from the docs. Google code search finds no mention of it in any sysexits.h file anywhere it has searched, so the chances are this constant will never be defined by Python.

  6. added
    docs
    and removed
    stdlib
    on Sep 24, 2010
  7. bitdancer commented on Sep 24, 2010

    @bitdancer
    Member

    s/linux/unix/

  8. briancurtin commented on Sep 24, 2010

    @briancurtin
    Member

    +1 for removing it from the docs.

  9. kisielk commented on Sep 24, 2010

    kisielkmannequin
    MannequinAuthor

    I mostly wanted to just report the issue rather than propose a solution, so I'm in favor of whatever everyone feels is best.

    As for how I came across the issue, it was mostly curiosity, I wanted to see the numerical value of all the os.EX_* constants and was printing them out on the screen when I stumbled upon this.

    If there's no chance of it working, which seems to be the case, I agree it should probably be just removed from the documentation.

  10. loewis commented on Sep 24, 2010

    loewismannequin
    Mannequin

    I fail to see the issue. The documentation clearly says, above the block of all the EX_* constants:

    Note

    Some of these may not be available on all Unix platforms, since there is some variation. These constants are defined where they are defined by the underlying platform.

    That seems to explain the situation well, no?

  11. birkenfeld commented on Sep 24, 2010

    @birkenfeld
    Member

    I agree with Martin.

  12. 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

    docstype-bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions