[Pythonmac-SIG] Can't run Python scripts from Terminal

Paul Berkowitz berkowit@silcom.com
Sun, 13 Apr 2003 17:24:58 -0700


On 4/13/03 3:00 PM, I wrote:

> But now I'm back to an earlier issue. I remembered that I had once found a
> way to run files from the Terminal by using 'python filename' without
> needing to specify the full path, as long as the directory was included in
> PYTHONPATH. But I can't do this any more. I have made an 'environment.plist'
> file in an invisible ~/.MacOSX/ directory according to Russell Owen's recipe
> at <http://www.astro.washington.edu/owen/AquaEnvVar.html>. (I worried about
> Mac line endings there myself, but they are indeed Unix line-endings. Both
> cat in the Terminal and the Property List Editor see the separate lines.) I
> also have a setenv PATH in ~/Library/init/tcsh/path. No joy. I wonder what
> I've got wrong this time.


Well, I've discovered that Python can _import_ my own modules from that
specified directory no matter where my current directory is, with just the
module name, no file paths. So undoubtedly that's what at least one of those
files  is actually meant to accomplish. If I just give Python the file name
(without full path) to run it, Python says it can't open the file, but it
can import it fine in the interactive interpreter without the path.




-- 
Paul Berkowitz