Setuptools不传递entry_points参数 [英] Setuptools not passing arguments for entry_points
问题描述
我正在为我编写的Python脚本使用setuptools
I'm using setuptools for a Python script I wrote
安装后,我会这样做:
$ megazord -i input -d database -v xx-xx -w yy-yy
就像我运行它一样。/like_this
Like I would if I was running it ./like_this
但是,我得到:
Traceback (most recent call last):
File "/usr/local/bin/megazord", line 9, in <module>
load_entry_point('megazord==1.0.0', 'console_scripts', 'megazord')()
TypeError: main() takes exactly 1 argument (0 given)
setuptools似乎没有将我的参数发送到要解析的main()中(通过optparse)
Which looks like setuptools is not sending my arguments to main() to be parsed (by optparse)
这是我的用于入口点的setuptools配置:
Here's my setuptools config for entry_points:
entry_points = {
'console_scripts': [
'megazord = megazord.megazord:main',
'megazord-benchmark = megazord.benchmark:main',
'megazord-hash = megazord.mzhash:main',
'megazord-mutate = megazord.mutator:main',
]
}
有任何想法吗?
推荐答案
setuptools console_scripts入口点需要一个没有参数的函数。
The setuptools console_scripts entry point wants a function of no arguments.
很高兴, optparse (命令行选项解析器)不需要被传递任何参数,它将读取sys.argv [1:]并将其作为输入。
Happily, optparse (Parser for command line options) doesn't need to be passed any arguments, it will read in sys.argv[1:] and use that as it's input.
这篇关于Setuptools不传递entry_points参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!