[4suite] Re: [XML-SIG] problem whith the error " ImportError: cannot import name boolean"

Uche Ogbuji uche.ogbuji@fourthought.com
27 Jul 2002 23:52:31 -0600


On Sat, 2002-07-27 at 17:41, Mike Olson wrote:
> On Fri, 2002-07-26 at 23:52, Uche Ogbuji wrote:
> > On Fri, 2002-07-26 at 13:49, Mike Olson wrote:
> > > On Fri, 2002-07-26 at 12:00, Uche Ogbuji wrote:
> > > > 
> > > > Can't we fix this with an import hook inside Ft/Lib/__init__.py?
> > > > 
> > > > I'm sure that's not clear, so I'll do a bit of experimentation and
> > > > report back.
> > > 
> > > 
> > > Nope, unless we move DistExt.
> > > 
> > > The problem is that in setup.py we do "from Ft.Lib import DistExt".  If,
> > > in Ft/Lib/__init__.py you mess with boolean, which does not exist at
> > > install time, then we won't be able to install.
> > 
> > Was this meant to be a challenge?  No better way to get me to fix the
> > problem  :-)
> > 
> > And fix it I did.  No boolean.py necessary.  All I did was use
> > os.environ to flag when we were in setup.py.
> 
> Yah thought of this as well but it doesn;t seem as clean to me. 
> Actually, Jeremy recommended using builtins as opposed to the
> environment.

Whatever is unclean about it?  It is using the environment for just what
it is supposed to be.  Do you say that having clashing modules with the
same name is cleaner?  I hardly think so.

Can you give a practical problem with my fix?  You yourself already
provided a practical problem with your own.

As for using builtings, I do think this would be too hacky.  The
environment is just ideal for this sort of thing, as long as you're not
on one of the small minority of POSIX OSes that treat the environment in
strange ways.  And if you're on one of those, you have bigger problems
with the environment.

> Actually, it is easier then that.  Looking at import precidence,
> boolean.so will always get imported before boolean.py.  So, the only
> time that boolean.py will get imported is in the installation
> directory.  We should keep both boolean.py and rename booleanc.so back
> to boolean.so, then we won't have any problems.

I already removed boolean.py.  I think it's a bad idea, and unnecessary,
to boot.


-- 
Uche Ogbuji                                    Fourthought, Inc.
http://uche.ogbuji.net    http://4Suite.org    http://fourthought.com
Track chair, XML/Web Services One Boston: http://www.xmlconference.com/
Basic XML and RDF techniques for knowledge management, Part 7 -
http://www-106.ibm.com/developerworks/xml/library/x-think12.html
Keeping pace with James Clark -
http://www-106.ibm.com/developerworks/xml/library/x-jclark.html
Python and XML development using 4Suite, Part 3: 4RDF -
http://www-105.ibm.com/developerworks/education.nsf/xml-onlinecourse-bytitle/8A1EA5A2CF4621C386256BBB006F4CEC