Reputation: 273
I guess this is a python path problem (on FreeBSD 8.1).
Im trying to convert a Data.fs to Postgresql using zodbconvert. Ive downloaded RelStorage-1.5.0b2 and is running:
/usr/local/Plone/Python-2.6/bin/python zodbconvert.py fstodb.conf
, to use the version that Plone is running with.
The error I get:
Traceback (most recent call last):
File "zodbconvert.py", line 22, in <module>
from persistent.TimeStamp import TimeStamp
ImportError: No module named persistent.TimeStamp
Versions:
PS by default "python --version" is 2.7.1
Thanks. Nikolaj G.
Upvotes: 1
Views: 1250
Reputation: 1121266
If you are using buildout
(I do hope you are) the easiest way to get all the zodbconvert
dependencies properly included in the python path is to have buildout
create the script for you:
[buildout]
...
parts =
...
zodbconvert
[zodbconvert]
recipe = zc.recipe.egg
eggs = ${buildout:eggs}
scripts = zodbconvert
Buildout then will create a new bin/zodbconvert
script for you that includes all the buildout eggs in sys.path
.
Alternatively, you can create a generic python script runner that includes all eggs in your buildout and can run arbitrary scripts; you can use this instead of the bare-bones python interpreter to run arbitrary python scripts with all the buildout eggs in sys.path
:
[buildout]
...
parts =
...
zopepy
[zopepy]
recipe = zc.recipe.egg
eggs = ${buildout:eggs}
interpreter = zopepy
scripts = zopepy
The bin/zopepy
script can then be use to run arbitrary python scripts with all your buildout eggs already in sys.path
, so bin/zopepy zodbconvert.py fstodb.conf
should work.
Note that the Plone unified installer already comes with the zopepy
part included, and my choice of partname for this script was deliberately using the same name.
If you are not using buildout
(and with Plone 4, that's not a good idea on the whole), you can also list the required packages (ZODB3, zope.interface, RelStorage, psycopg2) in your PYTHONPATH
environment variable.
Upvotes: 5
Reputation:
You have not included the ZODB package with your Python installation. Either adjust the PYTHONPATH to include the ZODB package or just easy_install ZODB
- depending on what you are trying to do.
Upvotes: 0
Reputation: 1978
quick fix..
locate persistent
export PYTHONPATH=$PYTHONPATH:/path/to/your/python_persistent_dir
Upvotes: 0