[Tutor] import'ing problems (path) P.S.!!
tim at johnsons-web.com
Tue Oct 5 21:11:36 CEST 2004
* Kent Johnson <kent_johnson at skillsoft.com> [041005 10:51]:
> It looks like WebKit doesn't want to see the Webware level in the package
> hierarchy. You could take everything out of the Webware directory and put
> it directly in site-packages or add the Webware directory to sys.path as I
> described before. Then try import WebKit.Page (without the WebWare prefix).
Okay! add the following line:
and the import is successful.
This is an excercise in understanding the python import protocol,
and I would welcome References to documentation of the topic so
that I may better understand it.
Thanks for the support Kent.
> You might have better luck with this on the Webware mailing list.
> At 10:29 AM 10/5/2004 -0800, Tim Johnson wrote:
> >* Kent Johnson <kent_johnson at skillsoft.com> [041005 05:10]:
> >> Tim,
> > Hi Kent:
> >> Did you run the WebWare installer or just unpack the distribution file?
> > I ran the Webware installer, it did not appear to copy files
> > elsewhere.
> >> Usually third-party libraries are installed in Python/lib/site-packages.
> > So... I reinstalled, by unpacking to
> > /usr/local/lib/python2.3/site-packages/Webware,
> > then ran the webware installer again, said installation was
> > successful.
> > Now, Page.pyc is at
> > /usr/local/lib/python2.3/site-packages/Webware/WebKit
> > Now, if I code:
> > import Webware.WebKit ## and stop the program here, there is no
> > ## ImportError exception thrown
> > If I code
> > import Webware.WebKit.Page
> > ## I get the ImportError: "No module named MiscUtils"
> > MiscUtils is a directory at the same level ast WebKit.
> > Not sure where to go from here.......
> > whew!
> > tim
> >> This directory is automatically added to sys.path.
> >> Alternatively you can make a permanent, global modification to sys.path
> >> creating a file
> >> Python/lib/site-packages/sitecustomize.py
> >> containing the two lines
> >> import sys
> >> sys.path.append('/home/tim/downloads/python/Webware-0.8.1')
> >Tim Johnson <tim at johnsons-web.com>
> > http://www.alaska-internet-solutions.com
> >Tutor maillist - Tutor at python.org
> Tutor maillist - Tutor at python.org
Tim Johnson <tim at johnsons-web.com>
More information about the Tutor