Problem running Trac 0.12 with TracBzr 0.4 plugin on OS X 10.6
Brendan Simon (eTRIX)
brendan.simon at etrix.com.au
Thu Aug 12 04:02:52 BST 2010
On 11/08/10 11:12 PM, Alexander Belchenko wrote:
> Brendan Simon (eTRIX) пишет:
>> I'm having problems running Trac 0.12 with TracBzr 0.4 plugin on OS
>> X 10.6.
>> The log file shows:
>>
>> 2010-08-11 22:26:05,662 Trac[loader] ERROR: Skipping "bzr =
>> tracbzr.backend": (can't import "ImportError: No module named
>> bzrlib")
>>
>> bzr is installed as /usr/local/bin/bzr
>>
>> It seems that Trac can not find the bzrlib module to import.
>> Where would I find this ??
>
> run `bzr version` and check output, it will point you to the right
> directory with bzrlib. Also check the Python version used by bzr.
OK. The Apple provided python is 2.6.1, installed in /System and can be
invoked with /usr/bin/python. However, I have also installed 2.6.5
which is placed in /Library/Frameworks/Python.framework/ and can be
invoked with /usr/local/bin/python
My PATH is setup to find Python 2.6.5 first, thus running tracd is
invoked with python 2.6.5, but bzrlib is not found in that path.
$ /usr/bin/python2.6 -c "import sys; print sys.version; import
bzrlib; print bzrlib"
2.6.1 (r261:67515, Feb 11 2010, 00:51:29)
[GCC 4.2.1 (Apple Inc. build 5646)]
<module 'bzrlib' from
'/Library/Python/2.6/site-packages/bzrlib/__init__.pyc'>
$ /usr/local/bin/python2.6 -c "import sys; print sys.version; import
bzrlib; print bzrlib"
2.6.5 (r265:79359, Mar 24 2010, 01:32:55)
[GCC 4.0.1 (Apple Inc. build 5493)]
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named bzrlib
On a side note, why Python 2.6.5 is compiled with the older gcc-4.0
instead of the newer gcc-.4.2 is unknown to me. Presumably the Python
OS X packagers use older systems for compatibility with older OS X
systems ??
Anyway, the OS X Bazaar installer always installs in /System to use the
Apple python. This makes some sense, but how to use it with newer
versions of python ??
Is setting PYTHONPATH the way to go ??
I _think_ wxPython had issues with systems installs of python versus
user installs ??
and I _think_ they resolved that using wxredirect.pth file, which has
the following content.
import site;
site.addsitedir('/usr/local/lib/wxPython-unicode-2.8.11.0/lib/python2.6')
Not sure if something like that could be useful for Bazaar installations ??
>> Where does the OS X Bazaar (2.1.2) installer put the bzrlib module
>> (if anywhere) ??
>>
>> I thought it might be in
>> /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.5/site-packages/
>> but that does not appear to be the case.
>>
>> Do I have to specify some path in the trac.ini file so that Trac can
>> find bzrlib ??
>
> You should ensure your Trac installation runs the same Python version
> as bzr, and if needed you can add path to the directory where bzrlib
> located to PYTHONPATH environment variable. Then check with command:
>
> python -c "import bzrlib; print bzrlib"
"bzr --version" shows me that bzrlib is installed in:
/Library/Python/2.6/site-packages/bzrlib
I used a startup script for the tracd server, set/exported PYTHONPATH to
"/Library/Python/2.6/site-packages" and now it works :)
#!/bin/bash
BZRLIB_DIR=$(bzr --version | grep bzrlib | cut -d ' ' -f 4)
VER=$(echo ${BZRLIB_DIR} | grep -o '[0-9]\.[0-9]')
PYTHON="python${VER}"
PYTHONPATH=$(dirname ${BZRLIB_DIR})
export PYTHONPATH
TRACD=/Library/Frameworks/Python.framework/Versions/${VER}/bin/tracd
PORT=8000
AUTH="myproject,/Users/brendan/trac/myproject/conf/users.htdigest,etrix.com.au"
ENV=/Users/brendan/trac/myproject
${PYTHON} ${TRACD} --port ${PORT} --auth=${AUTH} ${ENV}
Cheers, Brendan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/bazaar/attachments/20100812/d7e793dc/attachment-0001.htm
More information about the bazaar
mailing list