organizing many python scripts, in a large corporate environment.

bruce bushby bruce.bushby at gmail.com
Mon Mar 14 16:31:16 EDT 2011


I'm probably going off on a tangent here......but has anybody seen any
efforts to allow python to "import modules via a socket" ...rather
then just a "dir path" ?





On Mon, Mar 14, 2011 at 7:56 PM, eryksun () <eryksun at gmail.com> wrote:

> On Monday, March 14, 2011 9:45:51 AM UTC-4, eryksun () wrote:
> >
> > If you're linking to a common file, couldn't you just add in
> > the base folder there?
> >
> > ...
> >
> > # script.py
> > import _path   # _path.py is a symbolic link
> >
> > # _path.py:
> > base = '/absolute/path/to/base'
> > import site
> > site.addsitedir(base)
>
> To be clear on the file structure, I'm picturing that 'base' is a path on
> each user's shell path where all the accessible scripts are linked, and that
> this is also the package directory. So when a linked script runs "import
> _path" it will import the _path.py that's located in base, which adds the
> base path to Python's sys.path. On the other hand, any subsequently imported
> modules will be found by searching sys.path. Thus each subdirectory needs
> the additional symbolic link back to the base _path.py. It's a bit
> convoluted, but so are the constraints of this problem -- at least to me.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110314/2449db42/attachment-0001.html>


More information about the Python-list mailing list