On 04Feb2017 12:16, Steve D'Aprano <steve+pyt...@pearwood.info> wrote:
On Sat, 4 Feb 2017 03:06 am, Neal Becker wrote:
I want to make sure any modules I build in the current directory overide
any
others.  To do this, I'd like sys.path to always have './' at the
beginning.

What's the best way to ensure this is always true whenever I run python3?

For some definition of "always"...
I don't know about "best", but you can do this:

1. In your .bashrc file, or equivalent, set the environment
  variable PYTHONPATH:
export PYTHONPATH='./;$PYTHONPATH'

You want double quotes (allowing parameter substitution) instead of single quotes here. Or, of course, no quotes at all. And the separator is ":", not ";".

Personally, I'm against hacking the $PYTHONPATH this way at all.

Far better to invoke the Python script via a shell script that includes the absolute path of the current directory (or the module directory) in the $PYTHONPATH.

Cheers,
Cameron Simpson <c...@zip.com.au>

That article and its poster have been canceled.
       - David B. O'Donnell, Sysadmin, America OnLine
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to