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

Mike Olson Mike.Olson@fourthought.com
27 Jul 2002 17:41:03 -0600


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.

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.

Mike

> 
> I tested it after blowing away build and site-packages/Ft.  Works.  It
> gives the error message in the install dir, and doesn't outside of it.
> 
> All is well, I think.
> 
> 
> -- 
> 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
-- 
Mike Olson                                Principal Consultant
mike.olson@fourthought.com                +1 303 583 9900 x 102
Fourthought, Inc.                         http://Fourthought.com 
4735 East Walnut St,                      http://4Suite.org
Boulder, CO 80301-2537, USA
XML strategy, XML tools, knowledge management