Re: [Zope-dev] Using Zope from a console script

2002-11-05 Thread Leonardo Rochael Almeida
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

You can also use ZEO and do your debugging in a separate Zope (ZEO
Client) instance.
http://www.zope.org/Products/ZEO

-- 
Ideas don't stay in some minds very long because they don't like
solitary confinement.


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Using Zope from a console script

2002-11-05 Thread Gilles Lenfant
- Original Message -
From: Leonardo Rochael Almeida [EMAIL PROTECTED]
To: Gilles Lenfant [EMAIL PROTECTED]
Cc: Zope Developers list [EMAIL PROTECTED]
Sent: Tuesday, November 05, 2002 8:34 PM
Subject: Re: [Zope-dev] Using Zope from a console script


 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 ?

 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.

Cheers

--Gilles




___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Using Zope from a console script

2002-11-05 Thread Jerome Alet
On Tue, Nov 05, 2002 at 09:46:03PM +0100, Gilles Lenfant wrote:
 
 But just want to run a console application, not running it from another Zope
 instance.

xml-rpc should be the way to go.

bye,

Jerome Alet

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Using Zope from a console script

2002-11-05 Thread Gilles Lenfant
- Original Message -
From: Jerome Alet [EMAIL PROTECTED]
To: Gilles Lenfant [EMAIL PROTECTED]
Cc: Leonardo Rochael Almeida [EMAIL PROTECTED]; Zope Developers list
[EMAIL PROTECTED]
Sent: Tuesday, November 05, 2002 9:40 PM
Subject: Re: [Zope-dev] Using Zope from a console script


 On Tue, Nov 05, 2002 at 09:46:03PM +0100, Gilles Lenfant wrote:
 
  But just want to run a console application, not running it from another
Zope
  instance.

 xml-rpc should be the way to go.

Yes,

That's the way I started to do the stuff but this requires too many Zope
side xmlrpc handlers I should not need if accessing directly to the Zope
objects.
In addition, running through xmlrpc slows down dramatically the stuff.
xmlrpc is the good solution when you need few transactions with the server,
that is not my case where I use lots of arbitrary methods on objects.

Please don't cross-post this problem to a PHP/MySQL mailing list, they would
laught out loudly :)

Cheers

--Gilles




___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Using Zope from a console script

2002-11-05 Thread Jerome Alet
On Tue, Nov 05, 2002 at 10:25:23PM +0100, Gilles Lenfant wrote:
 
 That's the way I started to do the stuff but this requires too many Zope
 side xmlrpc handlers I should not need if accessing directly to the Zope
 objects.

shamelessplug mode=again_and_again

Did you try to manipulate your ZODB with ZShell ?

You can also do it in a limited way through xml-rpc with the help
of Andy McKay's ZShellCLI, but ZShell commands can manipulate 
several (**many**) objects at a time, so the slowdown would be
minimal.

depending on what you want to achieve this may be useful.

get it from http://www.librelogiciel.com/software/

upcoming versions of ZShellScripts will provide easier xml-rpc
access to ZShell functionnalities.

/shamelessplug

hth

Jerome Alet

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Using Zope from a console script

2002-11-05 Thread Leonardo Rochael Almeida
On Tue, 2002-11-05 at 18:46, Gilles Lenfant wrote:
 - Original Message -
 From: Leonardo Rochael Almeida [EMAIL PROTECTED]
 
  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.


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Using Zope from a console script

2002-11-05 Thread Martijn Pieters
On Tue, Nov 05, 2002 at 09:46:03PM +0100, Gilles Lenfant wrote:
  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.

ZEO gives you a connection to the ZODB, sharing it with any Zope instances.
ZEO makes database access distributed, and thus is *exactly* what you want.

-- 
Martijn Pieters
| Software Engineer  mailto:mj;zope.com
| Zope Corporation   http://www.zope.com/
| Creators of Zope   http://www.zope.org/
-

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Using Zope from a console script

2002-11-05 Thread Gilles Lenfant
- Original Message -
From: Jerome Alet [EMAIL PROTECTED]
To: Gilles Lenfant [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, November 05, 2002 10:21 PM
Subject: Re: [Zope-dev] Using Zope from a console script


 On Tue, Nov 05, 2002 at 10:25:23PM +0100, Gilles Lenfant wrote:
 
  That's the way I started to do the stuff but this requires too many Zope
  side xmlrpc handlers I should not need if accessing directly to the Zope
  objects.

 shamelessplug mode=again_and_again

 Did you try to manipulate your ZODB with ZShell ?

 You can also do it in a limited way through xml-rpc with the help
 of Andy McKay's ZShellCLI, but ZShell commands can manipulate
 several (**many**) objects at a time, so the slowdown would be
 minimal.

 depending on what you want to achieve this may be useful.

 get it from http://www.librelogiciel.com/software/

 upcoming versions of ZShellScripts will provide easier xml-rpc
 access to ZShell functionnalities.

 /shamelessplug

 hth

 Jerome Alet

 ___
 Zope-Dev maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope-dev
 **  No cross posts or HTML encoding!  **
 (Related lists -
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope )



Bonjour Jérôme.

ZShell is great but this is not really suited to what I'm doing.
The console script (that works perfectly when the server is down) indexes in
a ZCatalog a big amount of fake objects that are not stored in the ZODB.
This is an (almost successful) attempt to use a ZCatalog for a search engine
that targets non Zope documents repositories.

* Word docs in a samba FS
* Other (non Zope) sites
* ...

I just try to have it working when the Zope server is up because the script
may work some dozen of minutes (fetching visible text of web pages,
transforming word docs to plain text...) in real (production) situation.

Cheers

--Gilles




___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Using Zope from a console script

2002-11-05 Thread Gilles Lenfant
 
  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.

I'm not a fcntl guru bu I didn't see any fcntl.F_GETFL in the doc of
Python 2.1.3. Probably a really deprecated stuff. But I'm not capable of
fixing this correctly by myself.
It will go to the Collector tomorrow (if not already recorded)


   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

The fact is that my script works when Zope server is down and crashes when
it is up (Data.fs doesn't seem to be usable concurrently by two different
processes)
I didn't get exactly what's ZEO. I'm gonna dive into this.

Many thanks again

--Gilles




___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )