Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #41391

How to add the current dir to sys.path when calling a python file?

Date 2013-03-17 22:56 -0500
Subject How to add the current dir to sys.path when calling a python file?
From Peng Yu <pengyu.ut@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.3407.1363579363.2939.python-list@python.org> (permalink)

Show all headers | View raw


Hi,

man python says "If a script  argument  is  given,  the directory
containing the script is inserted in the path in front of $PYTHONPATH.
The search path can be manipulated from  within a Python program as
the variable sys.path." Instead I want to have the current directory
inserted to the front of $PYTHONPATH without changing anything the
script. Is there a way to do so?

-- 
Regards,
Peng

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

How to add the current dir to sys.path when calling a python file? Peng Yu <pengyu.ut@gmail.com> - 2013-03-17 22:56 -0500
  Re: How to add the current dir to sys.path when calling a python file? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-18 06:54 +0000
    Re: How to add the current dir to sys.path when calling a python file? Peng Yu <pengyu.ut@gmail.com> - 2013-03-18 08:52 -0500
  Re: How to add the current dir to sys.path when calling a python file? rusi <rustompmody@gmail.com> - 2013-03-18 00:35 -0700

csiph-web