[Zope-dev] Using Zope from a console script
Leonardo Rochael Almeida
leo@hiper.com.br
05 Nov 2002 19:50:26 -0200
On Tue, 2002-11-05 at 18:46, Gilles Lenfant wrote:
> ----- Original Message -----
> From: "Leonardo Rochael Almeida" <leo@hiper.com.br>
>
> > On Tue, 2002-11-05 at 17:27, Gilles Lenfant wrote:
> > > I tried (successfully) to play with Zope objects with console scripts
> using
> > > the hints in $ZOPEROOT/doc/ZODB.txt
> > > Unfortunately, it works only if the Zope server is down.
> > > I need to run this script on a running server, and I'd prefer not using
> > > xmlrpc stuffs for a better efficiency.
> > >
> > > Any hint, config, examples ?
> >
> > You can use the monitor port, see z2.py help and
> > http://www.zope.org/Documentation/Misc/DEBUGGING.txt
> >
>
> Leonardo,
>
> Thanks for that fast answer.
>
> But it's buggy for me (Zope 2.5.1/Python 2.1.3/FreeBSD) :
>
> bash-2.05a$ python ZServer/medusa/monitor_client.py localhost 8099
> /usr/local/lib/python2.1/regsub.py:15: DeprecationWarning: the regsub module
> is deprecated; please use re.sub()
> DeprecationWarning)
> Enter Password:
> Traceback (most recent call last):
> File "ZServer/medusa/monitor_client.py", line 114, in ?
> stdin = stdin_channel (0)
> File "/usr/src/Zope-2.5.1-src/ZServer/medusa/asyncore.py", line 551, in
> __init__
> flags = fcntl.fcntl (fd, fcntl.F_GETFL, 0)
> AttributeError: 'fcntl' module has no attribute 'F_GETFL'
>
> Do you think I should record this in the collector or did I miss something ?
It's probably not your fault. Not many people use the monitor port, and
it's possible it's been broken by recent zope versions. By the looks of
the error message, it doesn't look like it should be difficult to fix. A
Collector issue might be in order.
> > You can also use ZEO and do your debugging in a separate Zope (ZEO
> > Client) instance.
> > http://www.zope.org/Products/ZEO
>
> But just want to run a console application, not running it from another Zope
> instance.
A Zope instance that is a ZEO client sees the same objects as other Zope
instances. For all intents and purposes, it is as if you're talking to a
single Zope instance. Since you described that you could use Zope from
python console if you didn't start it, using a ZEO instance the same way
looks like it's exactly what you need. You might not understand what I'm
talking about until you try and install ZEO for yourself
Cheers, Leo
--
Ideas don't stay in some minds very long because they don't like
solitary confinement.