Hi All, have a question
Ben Finney
bignose-hates-spam at and-benfinney-does-too.id.au
Wed Feb 11 17:45:51 EST 2004
On Wed, 11 Feb 2004 15:08:21 -0600, Paul Metzger wrote:
> Hi, I'm still a relative Python newbie, though I am learning more with every
> project:)
Glad you're charging ahead with your learning.
> I put
> the #!/usr/bin/python in the front
Presumably you mean this was placed on the first line.
To make your script a little more portable, the shebang line should be:
#!/usr/bin/env python
This will execute the "python" command from wherever it resides,
presuming it is in the user's execution PATH environment variable.
> try to run it as a executable, it comes up and tells me the module
> can't be imported
Please show the exact command you're typing, and the exact error
message.
To make a script that can be imported as a module *and* executed as a
script, put the "do this stuff when run as a script" at the end in the
following conditional block:
if ( __name__ == '__main__' ):
# do the main purpose of this script
More here:
<http://www.python.org/doc/current/lib/module-main.html>
--
\ "I installed a skylight in my apartment. The people who live |
`\ above me are furious!" -- Steven Wright |
_o__) |
Ben Finney <http://bignose.squidly.org/>
More information about the Python-list
mailing list