[PyCrust] Re: [Pythoncard-users] Example of Zope in PyCrust
Brought to you by:
pobrien
From: <an...@ha...> - 2002-02-20 21:50:27
|
On Wed, 20 February 2002, "Patrick K. O'Brien" wrote: > > For anyone who wants to poke around Zope from inside PyCrust, here is an > example of how one starts. Zope must be installed on your machine, but can't > be running at the same time that PyCrust is accessing it. > > >>> import sys > >>> sys.path.insert(1, 'C:\\Zope\\lib\\python') > >>> import Zope > >>> app = Zope.app() > >>> > > The app object is the root of the Zope database. From here you can get to > everything. The easiest way is to drill down into stuff in the namespace > viewer. > > Note that the path you add to the PythonPath (sys.path) needs to match the > location on your machine. The example above happens to match where I have > Zope installed on a Windows machine. The default is for Zope to install > under Program Files. So in that case the line would be: > > >>> sys.path.insert(1, 'C:\\Program Files\\Zope\\lib\\python') > > If you get an error when you import Zope, you've done something wrong. ;-) > > --- > Patrick K. O'Brien > Orbtech > > There is always an awkward one isn't there. I think I may have confounded this by running Python 2.2 on my machine (Windows 2000, Zope 2.5.0, PyCrust 0.7 - from wxPython 2.3.2.1). When I add the zope home/lib/python to my path and "import Zope" I get a pop up stating "The dynamic link library python21.dll could not be found in the specified path " followed by the contents of my %PATH%. So, I added "E:\\Work\\Zope\\bin" to my path as well (the location of python21.dll) but that didn't solve the problem. I'm presuming that this is because I launch pycrust using Python 2.2 and that the dlls are somehow incompatible. Or, I could just be doing something wrong. Regards, Andy |