On Fri, Dec 02, 2005 at 08:10:41PM -0500, Mike Meyer wrote: > Inyeol Lee <[EMAIL PROTECTED]> writes: > > On Fri, Dec 02, 2005 at 07:33:20PM -0500, Mike Meyer wrote: > >> > The problem is that myscript.py and some modules that myscript.py > >> > imports are not in the current directory, but in another place in the > >> > filesystem, say, /path/to/stuff. If this was a tcsh script, I would > >> > just do: > >> > > >> > setenv PYTHONPATH /path/to/stuff > >> > python myscript.py > > How about using python -m? > > Assuming Make uses Bourne shell, > > > > %.abc: %.def > > PYTHONPATH=/path/to/stuff:/path/to/another python -m myscript > > That will break __name__ (at least with 2.4.2). Whether or not it > matters will depend on the script. >
$ python -V Python 2.4.2 $ cat foo/bar.py print __name__ $ (cd foo; python bar.py) __main__ $ PYTHONPATH=$PWD/foo python -m bar __main__ $ Am I missing something? I don't see any issue regarding __name__. -- Inyeol Lee -- http://mail.python.org/mailman/listinfo/python-list