Followup to my own post:

I am sticking pretty closely to this example from Mike Driscoll which, 
admittedly, is based on Python 2.6:

http://www.blog.pythonlibrary.org/2012/07/08/python-201-creating-modules-and-packages/

I'm trying to do this one step at a time.  First try a local import, then 
install the module.

When I execute ./foo/__init__.py directly, from within its own directory, all 
the import statements work.  Suppose that one of those import statements reads, 
"from bar import baz".  And, suppose that there are others, which refer to 
other names we want to import from other files.

Next, I execute another program from the parent directory of foo which says 
"from foo import bar".  It finds ./foo/__init__.py.  But when it tries to 
execute "from bar import baz", an ImportError is raised.  That strikes me as 
odd.  Since the foo directory is clearly already found, why isn't foo (at 
least, temporarily) searched for modules?

Now, Mike suggests that, once you have built up the desired file hierarchy, 
"you can copy the folder into your Python’s site-packages folder."  Really?  
The safe, recommended way to do this is to use distutils.  Five years ago, I 
did it the same way that Mike shows.  

http://www.gossamer-threads.com/lists/python/python/653838

Windows would let you cheat that way, if you had admin privileges.  Linux 
stopped you, and made you use sudo.  That red flag is what made me ask what the 
recommended method of installing to site-packages was, and got me started with 
distutils.

So, why don't I just do that now?  As my first post indicated, I have tried.  
There must be something wrong with the setup.py files I have written.  I keep 
getting files installed in places I don't want them to be.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to