setup.py, how to find main program/module?

ant ant at anthive.com
Wed Dec 19 08:52:04 EST 2018


dieter wrote:
> ant <ant at anthive.com> writes:
>> ...
>>   yet not quite all the way yet.  i run the 
>> commands to make the sdist and wheels and upload
>> it using twine to my test account, but when
>> i install it and try to run it the ngfp.py is
>> not found (i've also tried nfgp and main).
>> ...
>>   i suspect i've not really understood entry 
>> points and may not have it specified correctly in
>> setup.py.
>>
>>   any help appreciated.  :)
>
> I think you are right: the problem is likely with the
> "entry_points" specification.
>
>
> My "dm.zopepatches.ztest" package has
>       entry_points = dict(
>          console_scripts = [
>            'ztest = dm.zopepatches.ztest:main',
>            ]
>         ),
> This is responsible for the creation of a script called
> "ztest" in Python's "bin" directory.
>
>
> Does your "entry_points" specification look similar?

  yes.


> Do you find corresponding scripts in Python's "bin" directory?

  thank you,

  yes, it is there:


=====
(env) me at ant(9)~/src/env/bin$ more ngfp 
#!/home/me/src/env/bin/python3
# EASY-INSTALL-ENTRY-SCRIPT: 'ngfp','console_scripts','ngfp'
__requires__ = 'ngfp'
import re
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(
        load_entry_point('ngfp', 'console_scripts', 'ngfp')()
    )


=====

(env) me at ant(11)~/src/test$ ngfp
Traceback (most recent call last):
  File "/home/me/src/env/bin/ngfp", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3126, in <module>
    @_call_aside
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3110, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3139, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 581, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 898, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 784, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'ngfp' distribution was not found and is required by the application

=====

  so, actually, the problem isn't what i expected it to be.
but i'm still not sure how to fix it.  :)


  ant



More information about the Python-list mailing list