[Pythonmac-SIG] Where's the output?

Jack Jansen Jack.Jansen@cwi.nl
Wed, 1 May 2002 11:25:39 +0200

On Wednesday, May 1, 2002, at 03:58 , SNYDER, BARRON F (AIT) wrote:

> I'm probably missing the obvious but when I run a simple script at the
> command line, I see no output. What am I not doing?
> My script is as simple as:
> -----------------------------------
> #! /sw/bin/python
> print "hello"
> -----------------------------------
> At the command prompt %, I type: python hello.py
> but I see no results and no errors! If I enter the python interpreter,
> everything works fine.

This should work, and it works fine for me (even though I'm not using 
the fink distribution it shouldn't make a difference, especially since 
you *do* get the right Python for interactive work).

A few suggestion for tracking this:
- You have a #! line but say you're typing "python hello.py". Check that 
you're indeed using the Python you're expecting to use. "which python" 
will help you here.
- You don't have anything funny in your PYTHONSTARTUP or PYTHONHOME or 
so shell variable?
- Try "python -v hello.py" to see whether stderr is connected. Also, it 
may show problems during initialization.
- See whether it's actually the output getting lost, and not something 
else (like nothing hallening at all). Running a script like
     import time
should tell you (if it takes 10 seconds to come back then it probably 
did run).
- If interactive mode normally works, try "python -i hello.py" and see 
if you indeed get interactive mode, and maybe find out what is wrong 
with sys.stderr.
> --
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- Emma 
Goldman -