views:

119

answers:

1

I'm using setuptools for a Python script I wrote

After installing, I do:

$ megazord -i input -d database -v xx-xx -w yy-yy

Like I would if I was running it ./like_this

However, I get:

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)

Which looks like setuptools is not sending my arguments to main() to be parsed (by optparse)

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',
        ]
}

Any ideas?

+1  A: 

setuptools console_scripts entry point wants a function of no arguments.

Happily, optparse doesn't need to be passed any arguments, it will read in sys.argv[1:] and use that as it's input.

Jeffrey Harris