Re: [ZODB-Dev] Zeo: connection problem

2006-06-08 Thread Richard Jennings
On Wednesday 07 June 2006 15:53, you wrote:
> You are missing Zope init/configuration (which initialize all Zope Products
> and python paths to them).
>
> I use this minimal script:
>
> import sys
> zope_home='/opt/pperegri/builds/F2.12/opt/Zope-2.8.6-final'
> instance_home='/opt/pperegri/builds/F2.12/instances/zope_rw'
> sys.path.append('%s/lib/python'%zope_home)
> import Zope2
> Zope2.configure('%s/etc/zcmd.conf'%instance_home)
> app=Zope2.app()
>
> The zcmd.conf file is a copy of my zope.conf where I remove all the
> zservers and also, as you are using zeo, you need to use a different client
> name in the  section to make sure the cache file is different.
>

Thanks, Pascal, your solution worked great.  Dieter's response to my query 
solved my immediate problem and your's got me to where I wanted to be.
Richard
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


Re: [ZODB-Dev] Zeo: connection problem

2006-06-08 Thread Richard Jennings
On Wednesday 07 June 2006 19:44, you wrote:
> Richard Jennings wrote at 2006-6-7 11:53 +0200:
> >I have a Zope2.7.2/Zeo2.2.2 instance running, using the standard zope.conf
> > & zeo.conf settings (exception: port=8081) and it works fine.  I want
> > read-only access to the instance zodb to read site object properties.  In
> > a test script, I have used the apparently classic pattern, shown below:
> >
> > addr = ('localhost', 8081)
> >storage = ClientStorage.ClientStorage(addr)
> >db = DB(storage)
> >conn = db.open()
> >root = conn.root()
> >app = root['Application']
> >
> >This results in the exception shown below.
> >The pattern is so basic and simple, it seems difficult to make a mistake,
> > but I am! Can someone tell me what?
> > ...
> >  File "/opt/zope/lib/python/ZODB/Connection.py", line 160, in __getitem__
> >klass=self._db._classFactory(self, module, name)
> >  File "/opt/zope/lib/python/ZODB/DB.py", line 128, in _classFactory
> >name)
> >AttributeError: 'module' object has no attribute 'Application'
>
> Almost surely, the module is "OFS.Application".
> This module defines the class "Application". If it is not there,
> then some cyclic import prevented it from being already defined.
>
> It may help to import it before you access the storage root.
Dieter, your observation was accurate and pointed me in the right direction to 
solve the specific problem I encountered, which was my PYTHONPATH.
Note for zeo newbies reading this later:  The above code does return the root 
(Zope) application correctly, but if you have products in a zope instance, it 
seems you need to initialise them and their paths as indicated by Pascal 
Peregina in this thread.

Thanks for your help, Dieter.
Richard

Many thanks,
Richard
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


Re: [ZODB-Dev] Zeo: connection problem

2006-06-08 Thread Richard Jennings

> You are reinventing the wheel. You should investigate if you could
> run your script using the ZEO client's "zopectl" script with "zopectl
> run ". There's also Chris Withers' Stepper product, but I don't
> know if it is compatible with Zope versions earlier than 2.8:

thanks for your advice, unfortunately zopectl doesn't meet my needs.  I have a 
need for integrating a Cron service and the Stepper product is certainly a 
strong candidate for that.

Thanks for your help,
Richard
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


Re: [ZODB-Dev] Zeo: connection problem

2006-06-07 Thread Dieter Maurer
Richard Jennings wrote at 2006-6-7 11:53 +0200:
>I have a Zope2.7.2/Zeo2.2.2 instance running, using the standard zope.conf &
>zeo.conf settings (exception: port=8081) and it works fine.  I want read-only
>access to the instance zodb to read site object properties.  In a test
>script, I have used the apparently classic pattern, shown below:
>
>   addr = ('localhost', 8081)
>storage = ClientStorage.ClientStorage(addr)
>db = DB(storage)
>conn = db.open()
>root = conn.root()
>app = root['Application']
>
>This results in the exception shown below.
>The pattern is so basic and simple, it seems difficult to make a mistake, but
>I am! Can someone tell me what?
> ...
>  File "/opt/zope/lib/python/ZODB/Connection.py", line 160, in __getitem__
>klass=self._db._classFactory(self, module, name)
>  File "/opt/zope/lib/python/ZODB/DB.py", line 128, in _classFactory
>name)
>AttributeError: 'module' object has no attribute 'Application'

Almost surely, the module is "OFS.Application".
This module defines the class "Application". If it is not there,
then some cyclic import prevented it from being already defined.

It may help to import it before you access the storage root.



-- 
Dieter
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


RE: [ZODB-Dev] Zeo: connection problem

2006-06-07 Thread Pascal Peregrina
You are missing Zope init/configuration (which initialize all Zope Products and 
python paths to them).

I use this minimal script:

import sys
zope_home='/opt/pperegri/builds/F2.12/opt/Zope-2.8.6-final'
instance_home='/opt/pperegri/builds/F2.12/instances/zope_rw'
sys.path.append('%s/lib/python'%zope_home)
import Zope2
Zope2.configure('%s/etc/zcmd.conf'%instance_home)
app=Zope2.app()

The zcmd.conf file is a copy of my zope.conf where I remove all the zservers 
and also, as you are using zeo, you need to use a different client name in the 
 section to make sure the cache file is different.

This is just for some basic testing, as you will need to kill the script to 
terminate the python interpreter (CTRL-D won't make it) because of some Zope 
backgroup threads.

Pascal

-Message d'origine-
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Richard Jennings
Envoyé : mercredi 7 juin 2006 11:53
À : zodb-dev@zope.org
Objet : [ZODB-Dev] Zeo: connection problem

Hi,
I have a Zope2.7.2/Zeo2.2.2 instance running, using the standard zope.conf &
zeo.conf settings (exception: port=8081) and it works fine.  I want read-only
access to the instance zodb to read site object properties.  In a test
script, I have used the apparently classic pattern, shown below:

addr = ('localhost', 8081)
storage = ClientStorage.ClientStorage(addr)
db = DB(storage)
conn = db.open()
root = conn.root()
app = root['Application']

This results in the exception shown below.
The pattern is so basic and simple, it seems difficult to make a mistake, but
I am! Can someone tell me what?

Thanks,
Richard Jennings
___

Traceback (most recent call last):
  File "./ZeoTest.py", line 162, in ?
response = request.submit()
  File "./ZeoTest.py", line 112, in submit
app = root['Application']
  File "/usr/lib/python2.3/UserDict.py", line 19, in __getitem__
def __getitem__(self, key): return self.data[key]
  File "/opt/zope/lib/python/ZODB/Connection.py", line 562, in setstate
self._set_ghost_state(obj, p)
  File "/opt/zope/lib/python/ZODB/Connection.py", line 601, in
_set_ghost_state
state = unpickler.load()
  File "/opt/zope/lib/python/ZODB/Connection.py", line 198, in
_persistent_load
return self[oid]
  File "/opt/zope/lib/python/ZODB/Connection.py", line 160, in __getitem__
klass=self._db._classFactory(self, module, name)
  File "/opt/zope/lib/python/ZODB/DB.py", line 128, in _classFactory
name)
AttributeError: 'module' object has no attribute 'Application'

zope.conf (extract):

#
## Main FileStorage database
#
#  path $INSTANCE/var/Data.fs
#
#mount-point /
#


# Temporary storage database (for sessions)

  name temporary storage for sessioning

mount-point /temp_folder
container-class Products.TemporaryFolder.TemporaryContainer


# Other storage examples
#
# ZEO client storage:
#

  mount-point /
  
server localhost:8081
storage 1
name zeostorage
var $INSTANCE/var
  


zeo.conf (extract):

%define INSTANCE /var/opt/zope/default


  address 8081
  read-only false
  invalidation-queue-size 100
  # monitor-address PORT
  # transaction-timeout SECONDS



  path $INSTANCE/var/Data.fs

___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


Re: [ZODB-Dev] Zeo: connection problem

2006-06-07 Thread Jens Vagelpohl

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 7 Jun 2006, at 11:53, Richard Jennings wrote:


Hi,
I have a Zope2.7.2/Zeo2.2.2 instance running, using the standard  
zope.conf &
zeo.conf settings (exception: port=8081) and it works fine.  I want  
read-only

access to the instance zodb to read site object properties.  In a test
script, I have used the apparently classic pattern, shown below:

addr = ('localhost', 8081)
storage = ClientStorage.ClientStorage(addr)
db = DB(storage)
conn = db.open()
root = conn.root()
app = root['Application']

This results in the exception shown below.


You are reinventing the wheel. You should investigate if you could  
run your script using the ZEO client's "zopectl" script with "zopectl  
run ". There's also Chris Withers' Stepper product, but I don't  
know if it is compatible with Zope versions earlier than 2.8:


http://www.simplistix.co.uk/software/zope/stepper

jens

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFEhqtMRAx5nvEhZLIRAsuxAJ90Vt7pJ6xEGJsfBETC1EpwBJX3ZACfd2yY
oQmaTobKq9L0TsSC2+knIfE=
=6WRO
-END PGP SIGNATURE-
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


[ZODB-Dev] Zeo: connection problem

2006-06-07 Thread Richard Jennings
Hi,
I have a Zope2.7.2/Zeo2.2.2 instance running, using the standard zope.conf &
zeo.conf settings (exception: port=8081) and it works fine.  I want read-only
access to the instance zodb to read site object properties.  In a test
script, I have used the apparently classic pattern, shown below:

addr = ('localhost', 8081)
storage = ClientStorage.ClientStorage(addr)
db = DB(storage)
conn = db.open()
root = conn.root()
app = root['Application']

This results in the exception shown below.
The pattern is so basic and simple, it seems difficult to make a mistake, but
I am! Can someone tell me what?

Thanks,
Richard Jennings
___

Traceback (most recent call last):
  File "./ZeoTest.py", line 162, in ?
response = request.submit()
  File "./ZeoTest.py", line 112, in submit
app = root['Application']
  File "/usr/lib/python2.3/UserDict.py", line 19, in __getitem__
def __getitem__(self, key): return self.data[key]
  File "/opt/zope/lib/python/ZODB/Connection.py", line 562, in setstate
self._set_ghost_state(obj, p)
  File "/opt/zope/lib/python/ZODB/Connection.py", line 601, in
_set_ghost_state
state = unpickler.load()
  File "/opt/zope/lib/python/ZODB/Connection.py", line 198, in
_persistent_load
return self[oid]
  File "/opt/zope/lib/python/ZODB/Connection.py", line 160, in __getitem__
klass=self._db._classFactory(self, module, name)
  File "/opt/zope/lib/python/ZODB/DB.py", line 128, in _classFactory
name)
AttributeError: 'module' object has no attribute 'Application'

zope.conf (extract):

#
## Main FileStorage database
#
#  path $INSTANCE/var/Data.fs
#
#mount-point /
#


# Temporary storage database (for sessions)

  name temporary storage for sessioning

mount-point /temp_folder
container-class Products.TemporaryFolder.TemporaryContainer


# Other storage examples
#
# ZEO client storage:
#

  mount-point /
  
server localhost:8081
storage 1
name zeostorage
var $INSTANCE/var
  


zeo.conf (extract):

%define INSTANCE /var/opt/zope/default


  address 8081
  read-only false
  invalidation-queue-size 100
  # monitor-address PORT
  # transaction-timeout SECONDS



  path $INSTANCE/var/Data.fs

___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev