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


Groups > comp.lang.python > #19441

Re: Where to put data

From bvdp <bob@mellowood.ca>
Newsgroups comp.lang.python
Subject Re: Where to put data
Date 2012-01-25 14:27 -0800
Organization http://groups.google.com
Message-ID <11648482.1955.1327530436292.JavaMail.geo-discussion-forums@prfc16> (permalink)
References <8184572.1820.1327512393386.JavaMail.geo-discussion-forums@prj1> <e1d7be3a-e260-4847-a42a-be89a64ebb9d@q8g2000yqa.googlegroups.com>

Show all headers | View raw


> I would not put anything in the toplevel Python folder. You need to
> place everything under site-packages --> "Python27\Lib\site-packages
> \PackageName\blah". Of course client created files should be saved to
> a more accessible place.

Oh. Just looking at my setup (Ubunutu 11.10) and I see that /usr/lib/python2.7 doesn't have a site-packages directory. However, /usr/local/lib/python2.7 has both dist-packages and site-packages. 

So, my stuff should probably go into /usr/local/lib/python2.7/site-packages?

Interesting (?) that these are empty dirs right now?

Also, if I look at my sys.path value I see that /usr/local/lib/python2.7/dist-packages is in the path; but site-packages is not.

> Considering mymodules is a valid python package, you can do:
> py> from mymodules import foobar

Yes. Understand that part. And then I can just call 'foobar()'. What I was wondering is if there was a way to set something in __init__.py to shorten the calls. So, if I have:

     /usr/local/lib/python2.7/dist-packages/myprogram
           mymods
               __init__.py
                mod1.py
                mod2.py
           mylibs
           __init__.py


Is there some magic I can put into myprogram/__init__.py which forces modules to be imported from mymods instead of myprogram/mymods?

Thanks.

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


Thread

Where to put data bvdp <bob@mellowood.ca> - 2012-01-25 09:26 -0800
  Re: Where to put data Rick Johnson <rantingrickjohnson@gmail.com> - 2012-01-25 10:33 -0800
    Re: Where to put data bvdp <bob@mellowood.ca> - 2012-01-25 14:27 -0800
  Re: Where to put data Evan Driscoll <edriscoll@wisc.edu> - 2012-01-25 12:48 -0600
    Re: Where to put data bvdp <bob@mellowood.ca> - 2012-01-25 14:29 -0800
      Re: Where to put data Michael Torrie <torriem@gmail.com> - 2012-01-25 20:30 -0700
        Re: Where to put data bvdp <bob@mellowood.ca> - 2012-01-26 08:30 -0800
          Re: Where to put data Michael Torrie <torriem@gmail.com> - 2012-01-26 20:20 -0700
            Re: Where to put data bvdp <bob@mellowood.ca> - 2012-01-27 19:11 -0800
            Re: Where to put data bvdp <bob@mellowood.ca> - 2012-01-27 19:11 -0800
        Re: Where to put data bvdp <bob@mellowood.ca> - 2012-01-26 08:30 -0800
    Re: Where to put data bvdp <bob@mellowood.ca> - 2012-01-25 14:29 -0800
  Re: Where to put data "Martin P. Hellwig" <martin.hellwig@gmail.com> - 2012-01-26 02:16 +0000
  Re: Where to put data John Nagle <nagle@animats.com> - 2012-01-27 14:15 -0800
    Re: Where to put data bvdp <bob@mellowood.ca> - 2012-01-27 19:13 -0800

csiph-web