Reputation: 78
Basically I can use ZODB fine. However the ZEO tutorials are all very confusing.
From my understanding you start a server by going into my directory and punchign into the command prompt
python runzeo.py -C zeo.config
Where my zeo.config file is as follows
<zeo>
address localhost:8090
</zeo>
<filestorage>
path C:\\Anaconda\\Lib\\site-packages\\ZEO\\var\\tmp\\Data.fs
</filestorage>
<eventlog>
<logfile>
path C:\\Anaconda\\Lib\\site-packages\\ZEO\\var\\tmp\\zeo.log
format %(asctime)s %(message)s
</logfile>
</eventlog>
When I run it the log file is filled with
2014-07-02T14:49:15 (1948) opening storage '1' using FileStorage
2014-07-02T14:49:15 StorageServer created RW with storages: 1:RW:C:\\Anaconda\\Lib\\site-packages\\ZEO\\var\\tmp\\Data.fs
2014-07-02T14:49:15 (1948) listening on ('localhost', 8090)
Now when I try to get a client to add some random stuff to the database with prints after every line to see how its going:
from ZEO.ClientStorage import ClientStorage
from ZODB import DB
import transaction
print "starting"
storage=ClientStorage(('localhost',8090))
print "storage opened"
db=DB(storage)
conn=db.open()
print "connection opened"
root=conn.root()
print "established connection"
root['letters']=['a','b','c']
print "added values"
transaction.commit()
print "transaction done"
root.close()
print "closed"
My code only prints "starting", no error messages are thrown, so Im assuming that its getting stuck on the storage = ClientStorange(('localhost',8090)) line, my Data.fs file remains unchanged. I have no idea what is wrong and I have consulted all the tutorials.
I'm on Windows using Python 2.7 and installed ZEO / ZODB from pip so I assume they are all up to date versions is that helps.
Any help or pointers to different object orientated databases (with multiple proccess access) would be appreciated.
Thanks everyone
Upvotes: 3
Views: 930
Reputation: 78
Found the answer to my own question. Seems there is a bug with the implementation of using the localhost in windows. (Running server and client on same machine)
The source code needs an edit:
I have the same problem (can't connect to ZEO Server) using ZODB/ZEO 4.0 with Python 2.7.6 on Windows.
The proposed solution (changing line 446 of ZEO/zrpc/client.py) works for me, so why not incorporate the patch into the 4.0 release too?
- socket.getaddrinfo(host or 'localhost', port) + socket.getaddrinfo(host or 'localhost', port, 0, socket.SOCK_STREAM)"
From https://bugs.launchpad.net/zodb/+bug/1004513
Upvotes: 2