[Distutils] setuptools: Problem with auto-scripts and standalone scripts

Frank McIngvale fmcingvale at gmail.com
Thu Jul 5 17:55:20 CEST 2007


Thanks! That did the trick.

frank

On 7/5/07, Nathan R. Yergler <nathan at yergler.net> wrote:
>
> Scripts need to address a callable, not a module.  See
>
> http://peak.telecommunity.com/DevCenter/setuptools#automatic-script-creation
> and inline below for corrections.
>
> On 7/5/07, Frank McIngvale <fmcingvale at gmail.com> wrote:
> > Hi, I'm trying to use setuptools auto-script feature with standalone
> scripts
> > and am having problems.
> >
> > Say I have a script "mypkg/scripts/foo.py":
> > ---------------------
> > import sys
> > print "Hello foo! My args are:", sys.argv
>
> import sys
>
> def main():
>    print "Hello foo! My args are:", sys.argv"
>
> if __name__ == '__main__':
>    # here for compatibility
>    main()
>
> > ---------------------
> >
> > When I try wrapping it like this:
> >
> >             'console_scripts': [
> >                 'foo = mypkg.scripts.foo',
> >             ]
>
>              'console_scripts': [
>                  'foo = mypkg.scripts.foo:main',
>              ]
>
> >
> > Then run like this:
> >  $ foo aa bb cc
> >
> > It appears to start OK (and it gets the cmdline args) but crashes with a
> > traceback:
> > ------------
> > Hello foo! My args are:
> > ['c:\\frank\\py25\\Scripts\\foo-script.py', 'aa', 'bb',
> > 'cc']
> > Traceback (most recent call last):
> >   File "c:\frank\py25\Scripts\foo-script.py", line 8, in <module>
> >     load_entry_point('mypkg==0.99.50-rc1', 'console_scripts', 'foo')()
> > TypeError: 'module' object is not callable
> > ------------
> >
> > Am I setting up 'console_scripts' incorrectly, or is this kind of usage
> not
> > supported?
> >
> > thanks,
> > Frank
> >
> > _______________________________________________
> > Distutils-SIG maillist  -  Distutils-SIG at python.org
> > http://mail.python.org/mailman/listinfo/distutils-sig
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/distutils-sig/attachments/20070705/347dbf3c/attachment.htm 


More information about the Distutils-SIG mailing list