2

I need to install a python module in the site packages that also will be used as a command line application. Suppose I have a module like:

app.py

def main():
  print 'Dummy message'

if __name__ == '__main__':
    main()

setup.py

 import distutils

 try:
   from setuptools import setup
 except ImportError:
   from distutils.core import setup

 if __name__ == '__main__':

    setup(name = 'dummy',
            version = '1.0',
            packages = ['dummy'],
    )

Creating the dist by:

    setup.py sdist

Install:

    setup.py install

And now I would like to use it as a command line application by opening the command window and typing just: dummy

Is it possible to create such application under windows without to carry out registering system pat variables and so on ...

2 Answers 2

2

You can use the options in setup.py to declare command line scripts. Please refer to this article. On Windows, the script will be created in "C:\Python26\Scripts" (if you didn't change the path) - lots of tools store their scripts there (e.g. "easy_install", "hg", ...).

Sign up to request clarification or add additional context in comments.

Comments

0

Put the following in dummy.cmd:

python.exe -m dummy

Or is it dummy.app...

Oh well, it's one of those.

2 Comments

Wow, and thats all? Shell I include this to the package distribution as well?
I personally wouldn't bother, because it's just so not difficult.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.