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


Groups > comp.lang.python > #51568

Re: importing modules

From Dave Angel <davea@davea.name>
Subject Re: importing modules
Date 2013-07-30 11:37 -0400
References <CAHc+NX2j9Y0ipgw5vV8_i7cguhYWjh0MH-+CDM4a-SXJqhB6LQ@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.5314.1375198689.3114.python-list@python.org> (permalink)

Show all headers | View raw


On 07/29/2013 05:57 PM, syed khalid wrote:
> I am attempting to import modules from Shogun to python from a non-standard
> python directory ie from my /home/xxx directory. is there a way on ubuntu
> to selectively some modules, scripts, data  from one directory and others
> modules, scripts from another directory. In other words, is there a file(s)
> that provide pointers to where these modules are located.
>

Your question is confusing, but the short answer is that import will 
search the sys.path list for you.  So in your main script, you can add a 
directory to that list,  before doing the imports.

It can also be done with an environment variable, or with the site file, 
but I don't bother.


-- 
DaveA

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


Thread

Re: importing modules Dave Angel <davea@davea.name> - 2013-07-30 11:37 -0400

csiph-web