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

Wrong ImportError message if module is not readable #49626

Closed
vstinner opened this issue Feb 26, 2009 · 4 comments
Closed

Wrong ImportError message if module is not readable #49626

vstinner opened this issue Feb 26, 2009 · 4 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@vstinner
Copy link
Member

BPO 5376
Nosy @birkenfeld, @vstinner
Files
  • issue5376.tar.gz
  • 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 2009-04-05.16:33:04.504>
    created_at = <Date 2009-02-26.15:56:32.851>
    labels = ['interpreter-core']
    title = 'Wrong ImportError message if module is not readable'
    updated_at = <Date 2009-04-05.16:33:04.503>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2009-04-05.16:33:04.503>
    actor = 'georg.brandl'
    assignee = 'none'
    closed = True
    closed_date = <Date 2009-04-05.16:33:04.504>
    closer = 'georg.brandl'
    components = ['Interpreter Core']
    creation = <Date 2009-02-26.15:56:32.851>
    creator = 'vstinner'
    dependencies = []
    files = ['13193']
    hgrepos = []
    issue_num = 5376
    keywords = []
    message_count = 4.0
    messages = ['82766', '82785', '82786', '85526']
    nosy_count = 2.0
    nosy_names = ['georg.brandl', 'vstinner']
    pr_nums = []
    priority = 'normal'
    resolution = 'wont fix'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue5376'
    versions = ['Python 2.6', 'Python 3.0', 'Python 3.1', 'Python 2.7']

    @vstinner
    Copy link
    Member Author

    __import__() raises an ImportError "No module named ..." if the module
    file is not readable or module directory is not executable. The
    expected message is something like "Module named ... is not readable".

    Directory tree for the test:
    ------------------------------
    marge$ ls -lRF .
    .:
    drwxrwxrwx 2 haypo haypo 4096 2009-02-26 16:51 module/
    -rw-rw-rw- 1 haypo haypo 9 2009-02-26 16:48 module2.py
    -rw-r--r-- 1 haypo haypo 414 2009-02-26 16:50 test.py

    ./module:
    -rw-r--r-- 1 haypo haypo 10 2009-02-26 16:45 __init__.py
    ------------------------------

    Success with correct file permissions:
    ------------------------------

    $ python test.py
    __import__('/home/haypo/xxx/module') ...
    PI = 3.14
    __import__('/home/haypo/xxx/module2') ...
    E = 2.72

    Change module/ and module2.py permissions to 000 (no read, no write,
    no execute):
    ------------------------------
    __import__('/home/haypo/xxx/module') ...
    No module named /home/haypo/xxx/module
    __import__('/home/haypo/xxx/module2') ...
    No module named /home/haypo/xxx/module2
    ------------------------------

    @vstinner vstinner added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Feb 26, 2009
    @vstinner
    Copy link
    Member Author

    Oops, my first .tar.gz doesn't create files in a subdirectory. New
    archive fixes that.

    @vstinner
    Copy link
    Member Author

    Oooh, import by filename has been disabled in Python 2.6: see issue
    bpo-1776.

    @birkenfeld
    Copy link
    Member

    Since this is not supported anyway (and never was), closing as "won't fix".

    @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
    interpreter-core (Objects, Python, Grammar, and Parser dirs)
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants