Lib Directory
Steve Holden
sholden at holdenweb.com
Wed Jan 10 16:54:37 EST 2001
"Hendrik du Toit" <hendrikt at payware.co.za> wrote in message
news:mailman.979156032.17886.python-list at python.org...
> Hi there,
>
> I am using the mxODBC and mxDateTime modules on Windows NT and Python
> 2.0. When the modules are extracted (unzipped) it places the modules on
> a ODBC and DateTime directories. It is then instructed to copy these
> files to the lib sub directory. I am using the above as an example but
> my question is more generic:
>
> 1. Should I copy the contents of the directory directly to the lib
> directory i.e.
> Lets say the extraction directory is ODBC with the .pyd modules and
> __init__.pyc in this directory and other directories are ODBC\Doc
> ODBC\Misc. Should the final result then be to copy the __init__.pyc
> file in the d:\python20\lib directory and the rest of the directories
> will create a structure called d:\python20\lib\doc &
> d:\python20\lib\misc?.
No. mxDOBC and mxDateTime are *packages*, not modules, and the __init__.py
files (and their compiled variants) inform the system about the structure of
the package.
> This does not make sense because there is already
> a __init__.pyc file in d:\python20\lib and there might be other products
> with a doc directory. This will screw up the grouping of the products
> in the d:\python20\lib directory or;
Correct. You don't want to tangle with this.
> 2. Should I copy the entire ODBC sub directory to d:\python20\lib so
> that I have d:\python20\lib\odbc with __init__.pyc located in this
> directory and the rest of it will be d:\python20\lib\odbc\doc &
> d:\python20\lib\misc? If the later is the case, will python
> automatically find the .pyc modules in these sub directories or should I
> set dome environment variables?
>
Consider creating a "site-packages" subdirectory in D:\Python20\Lib.
Then create a D:\Python20Lib\sitecustomize.py file containing:
import site
site.addsitedir(r"D:\Python20\Lib\site-packages")
The relevant subset of my directory tree looks like this:
D:\Python20
Lib
site-packages
DateTime
ODBC
Pmw
Each of the subdirectories of D:\Python20\Lib\site-packages has its own
__init__.py, declaring the structure of the package.
> I am a willing reader. If anybody can point me to some documentation
> about this I will go a find it there.
>
> Regards,
> Hendrik
>
The current documentation at the end of section 6.11 says:
"""[XXX Can't be bothered to spell this out right now; see the URL
http://www.python.org/doc/essays/packages.html for more details, also about
how the module search works from inside a package.] """
regards
Steve
More information about the Python-list
mailing list