Why my Python Click command is not working? -
here project code structure:
pynique ├── cli │ ├── __init__.py │ └── pynique_ops.py ├── pynique │ ├── __init__.py ├── readme.md ├── setup.cfg └── setup.py
my setup.py
content is:
from setuptools import ( find_packages, setup ) print find_packages() setup( name='pynique', version='0.1.1.dev1', description='pynique app', classifiers=[ 'development status :: 2 - pre-alpha', 'license :: osi approved :: mozilla public license 2.0 (mpl 2.0)' ], packages=find_packages(exclude=['tests']), include_package_data=true, install_requires=[ 'jinja2', 'pyyaml', 'click' ], entry_points=''' [console_scripts] start-pynique=pynique.cli.pynique_ops:start ''', )
i've done inside pynique top folder project: - pip install -e .
but start-pynique
not working, throws error:
traceback (most recent call last): file "/home/agung/.virtualenvs/pynique/bin/start-pynique", line 11, in <module> load_entry_point('pynique', 'console_scripts', 'start-pynique')() file "/home/agung/.virtualenvs/pynique/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 542, in load_entry_point return get_distribution(dist).load_entry_point(group, name) file "/home/agung/.virtualenvs/pynique/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2569, in load_entry_point return ep.load() file "/home/agung/.virtualenvs/pynique/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2229, in load return self.resolve() file "/home/agung/.virtualenvs/pynique/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2235, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) importerror: no module named cli.pynique_ops (pynique)
do know why failed have module named cli.pynique_ops
? there wrong setup.py?
i know fix. python setup.py install publish directory inside root directory (pynique
) package name.
so if still using same folder structure question stated, cli
, pynique
installed python package. fix should start-pynique=cli.pynique_ops:start
.
but, instead of using folder structure, change this:
pynique ├── pynique │ ├── cli │ │ ├── __init__.py │ │ ├── pynique_ops.py ├── readme.md ├── setup.cfg ├── setup.py
so, can still use start-pynique=pynique.cli.pynique_ops:start
valid setup.
Comments
Post a Comment