[Tutor] Creating easy-to-run files
Sean 'Shaleh' Perry
shaleh@valinux.com
Fri, 28 Jul 2000 11:30:39 -0700
On Fri, Jul 28, 2000 at 09:51:05AM +0100, F Wass wrote:
> Hi,
>
> I've just started using Python (and found it quite useful) for
> writing a conversion parser between two different formats.
> Is there an easy way of letting the user run the script by
> simply typing "start" or something similar at the Python prompt?
> I'm currently using Windows, but it's intended to be run under
> Linux.
>
On unix based platforms like linux, place the following as the first line:
#!/usr/bin/env python
and the user can run it like any other executable on their system. If you want
to make running from the python interactive interpreter easy add a start()
method to your objects:
#>>> import myclass
#>>> myclass.start()