Here's the log when I get the import problem with Webware 0.6a1. Note that I 
have added a context for a thing called SiteManager and it's inside that 
package directory that one finds sites.xfd and sites.py. Meanwhile, the 
XMLForms directory which contains the framework code resides in the same 
directory as the WebKit directory - XMLForms and WebKit are siblings.

I'm running AppServer from inside the WebKit directory, which has always worked 
in the past, and I don't have PYTHONPATH set. Here, the XMLFormsServletFactory 
class is attempting to forward the request to the sites.py handler (servlet):

"""
[Fri Oct 26 17:59:00 2001] [error] WebKit: Error while executing 
script /home/httpd/html/SiteManager/sites.xfd
Traceback (most recent call last):
  File "WebKit/Application.py", line 341, in dispatchRequest
    self.handleGoodURL(transaction)
  File "WebKit/Application.py", line 489, in handleGoodURL
    self.respond(transaction)
  File "WebKit/Application.py", line 610, in respond
    transaction.respond()
  File "WebKit/Transaction.py", line 93, in respond
    self._servlet.respond(self)
  File "XMLForms/XMLFormsServletFactory.py", line 181, in respond
    trans.application().forwardRequestFast(trans, self.handler)
  File "WebKit/Application.py", line 601, in forwardRequestFast
    return self.includeURL(trans, url)
  File "WebKit/Application.py", line 583, in includeURL
    self.createServletInTransaction(trans)
  File "WebKit/Application.py", line 887, in createServletInTransaction
    inst = self.getServlet(transaction,path,cache)
  File "WebKit/Application.py", line 814, in getServlet
    inst = factory.servletForTransaction(transaction)
  File "WebKit/ServletFactory.py", line 178, in servletForTransaction
    module = self.importAsPackage(transaction, path)
  File "WebKit/ServletFactory.py", line 103, in importAsPackage
    module = self._importModuleFromDirectory(fullname, name, moduleDir, 
forceReload=1)
  File "WebKit/ServletFactory.py", line 133, in _importModuleFromDirectory
    fp, pathname, stuff = imp.find_module(moduleName, [directory])
ImportError: No module named sites
"""

If I print the value of moduleName and directory I get this:

"""
sites /home/paulb/Software/Python/Webware/WebKit/SiteManager
"""

And if I interrupt AppServer and try this interactively, the following happens:

"""
Python 2.0 (#5, Aug  5 2001, 12:20:24)
[GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import imp
>>> imp.find_module("sites",
        ["/home/paulb/Software/Python/Webware/WebKit/SiteManager"])
(<open file '/home/paulb/Software/Python/Webware/WebKit/SiteManager/sites.py',
 mode 'r' at 0x81d4300>,
 '/home/paulb/Software/Python/Webware/WebKit/SiteManager/sites.py',
 ('.py', 'r', 1))
>>>
"""

Sorry for the formatting, but I think the above communicates the events 
adequately. Now, if I replace the imp.find_module and imp.load_module calls 
with a call using __import__, it works:

"""
module = __import__(os.path.join(directory, moduleName), None, None,
    [fullModuleName])
"""

In Webware 0.5.1rc2 I didn't need to change anything - regardless of whether I 
set up a context or just dropped my resources into the Examples directory, it 
just worked. But on 0.6a1, neither of these arrangements seems to function - I 
get the above error either way.

Is it just me who is experiencing these bizarre events?

Paul

-- 
Get your firstname@lastname email for FREE at http://Nameplanet.com/?su

_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to