After upgrading my server to Mavericks and Server.app version 3, those tools stopped to work properly :
calendarserver_export
calendarserver_manage_principals
...
When I enter this command, for example :
sudo calendarserver_export -u <account_name>
then this error is displayed :
Traceback (most recent call last):
File "/Applications/Server.app/Contents/ServerRoot/usr/sbin/calendarserver_export", line 32, in <module>
from calendarserver.tools.export import main
File "/Applications/Server.app/Contents/ServerRoot/usr/share/caldavd/lib/python/calendarserver/tools/export.py", line 50, in <module>
from calendarserver.tools.cmdline import utilityMain, WorkerService
File "/Applications/Server.app/Contents/ServerRoot/usr/share/caldavd/lib/python/calendarserver/tools/cmdline.py", line 21, in <module>
from calendarserver.tap.caldav import CalDAVServiceMaker, CalDAVOptions
File "/Applications/Server.app/Contents/ServerRoot/usr/share/caldavd/lib/python/calendarserver/tap/caldav.py", line 87, in <module>
from twistedcaldav.upgrade import UpgradeFileSystemFormatStep, PostDBImportStep
File "/Applications/Server.app/Contents/ServerRoot/usr/share/caldavd/lib/python/twistedcaldav/upgrade.py", line 63, in <module>
from calendarserver.tap.util import getRootResource, FakeRequest, directoryFromConfig
File "/Applications/Server.app/Contents/ServerRoot/usr/share/caldavd/lib/python/calendarserver/tap/util.py", line 87, in <module>
from txdav.base.datastore.subpostgres import PostgresService
File "/Applications/Server.app/Contents/ServerRoot/usr/share/caldavd/lib/python/txdav/base/datastore/subpostgres.py", line 35, in <module>
import pgdb
File "/Applications/Server.app/Contents/ServerRoot/usr/share/caldavd/lib/python/pgdb.py", line 66, in <module>
from _pg import *
ImportError: dlopen(/Applications/Server.app/Contents/ServerRoot/usr/share/caldavd/lib/python/_pg.so, 2): Symbol not found: _PQclear
Referenced from: /Applications/Server.app/Contents/ServerRoot/usr/share/caldavd/lib/python/_pg.so
Expected in: flat namespace
in /Applications/Server.app/Contents/ServerRoot/usr/share/caldavd/lib/python/_pg.so
All these tools have in common to access the caldav data via python, through PyGreSQL (caldav data is hosted in a postgres database). I managed to reproduce very simply this problem by :
#login with root
bob $ sudo -i
#launch python and import pg (postgres module for python)
root $ python
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pg
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/PyGreSQL-4.1.1-py2.7-macosx-10.9-intel.egg/pg.py", line 31, in <module>
from _pg import *
ImportError: dlopen(/Library/Python/2.7/site-packages/PyGreSQL-4.1.1-py2.7-macosx-10.9-intel.egg/_pg.so, 2): Symbol not found: _PQclear
Referenced from: /Library/Python/2.7/site-packages/PyGreSQL-4.1.1-py2.7-macosx-10.9-intel.egg/_pg.so
Expected in: flat namespace
in /Library/Python/2.7/site-packages/PyGreSQL-4.1.1-py2.7-macosx-10.9-intel.egg/_pg.so
BUT, if I launch python from my user account (not root), I don't get the error.
I assume there is something wrong with the path, or something similar, but I can't find what...
I need to have root credentials to be able to use **calendarserver_export**
Any clues ??
For some reason, in mavericks, you have to launch these commands with the "calendar" user (alias of _calendar).
So the command should be : sudo -u calendar calendarserver_export -u