【发布时间】:2011-02-20 15:19:17
【问题描述】:
我正在为我编写的 Python 脚本使用 setuptools
安装后,我会这样做:
$ megazord -i input -d database -v xx-xx -w yy-yy
就像我运行它一样。/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)
这是我的 entry_points 的 setuptools 配置:
entry_points = {
'console_scripts': [
'megazord = megazord.megazord:main',
'megazord-benchmark = megazord.benchmark:main',
'megazord-hash = megazord.mzhash:main',
'megazord-mutate = megazord.mutator:main',
]
}
有什么想法吗?
【问题讨论】:
-
呃。没关系,我说得太早了。
-
我在 def main() 中还有一个剩余的 argv。由于某种原因,我之前运行脚本时并没有给我一个错误。
标签: python setuptools distutils