linkedin / linkedin/shiv

Entrypoint resolution issue

Open
#67 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.9k
Forks
114
PR merge metrics
No merged PRs in 30d

Description

$ shiv -o glances.pyz -e glances:main glances
$ ./glances.pyz
Traceback (most recent call last):
  File "./glances.pyz/_bootstrap/__init__.py", line 125, in bootstrap
TypeError: 'module' object is not callable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "./glances.pyz/__main__.py", line 3, in <module>
  File "./glances.pyz/_bootstrap/__init__.py", line 130, in bootstrap
AttributeError: module 'glances.main' has no attribute 'main'

Glances (strangely enough) has a module named main as well as a function named main. These work:

import glances.main; glances.main()
import glances; getattr(glances, "main")()

This (shiv's technique) does not:

from importlib import import_module
import_module("glances.main")()

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the command shown in the issue and start at _bootstrap/init.py around the traceback's bootstrap call, comparing it with Python's import_module("glances.main") behavior. Trace how the -e glances:main entrypoint is resolved; done means an entrypoint where a package has both a main module and main function runs successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.