[Tutor] Need some help with setuptools for my project.

Anubhav Yadav anubhav1691 at gmail.com
Tue Apr 7 17:50:54 CEST 2015


I apologise, my method was for distutils, not setuptools. I get the two
> muddled. The mechanism for creating a console script like you describe with
> setuptools is described here[1]. The post you linked also has a section on
> it under the heading ‘Executable scripts’. It allows for the multiple file
> approach you have.
>
> This is it, here's what I did:

I edited my setup.py and added the following:
  entry_points={
        'console_scripts':[
            'scorer = scorer.app.main'
            ]
        },

As the main function is in scorer/app.py.

Now after running sudo python setup.py install, I can see that there is a
scorer binary installed in my system, but when I run that, I get the
following error.

Traceback (most recent call last):
  File "/usr/bin/scorer", line 9, in <module>
    load_entry_point('scorer==0.1', 'console_scripts', 'scorer')()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line
546, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line
2666, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line
2339, in load
    return self.resolve()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line
2345, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ImportError: No module named main

I am this close I guess!

As an aside, I would also suggest that you look at PEP8, the Python style
> guide[3]. Your code should really conform to it as much as possible.
>

And thanks a lot for giving me the PEP8 link, it will be helpful.

>
> [1]
> https://pythonhosted.org/setuptools/setuptools.html#automatic-script-creation
> [2] https://www.python.org/dev/peps/pep-0008/
>
>
>>
> Dylan Evans
>



-- 
Regards,
Anubhav Yadav
KPIT Technologies,
Pune.


More information about the Tutor mailing list