I suffered a pain with Python on the MacPorts. I'd like to connect Trac with Subversion to use it efficiently. But there were always a problem when its plugins were active. Finally I fixed it and knew what was a problem. 

The Trac's guide  suggests below procedures. 
sudo port install apache2
sudo port install subversion +mod_dav_svn
sudo port install trac

After these the problem is occurred when it is linked with Subversion. Python is crashed with below error message.   
Fatal Python error: Interpreter not initialized (version mismatch?)

You have to follow below procedures after setting the MacPorts python as default to solve this problem. 
sudo port -f uninstall subversion-python25bindings
sudo port clean --all subversion-python25bindings
sudo port install subversion-python25bindings

After all, I could have my own knowledgebase system. ^^

After the MacPorts python is installed, I'd like to recommend to install 'python_select' package. 

The python is installed as default on Leopard and other versions. There are on /System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5.(it is linked to /usr/bin/python.) And The Macports python's default path is /opt/local/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5.(It is also linked to /opt/local/bin/phython.) Using the python_select package we can set the MacPorts python as default. First, install python_select package.
bash-3.2# port install python_select
---> Fetching python_select
---> Attempting to fetch select-0.2.1.tar.gz from http://distfiles.macports.org/python_select
---> Verifying checksum(s) for python_select
---> Extracting python_select
---> Configuring python_select
---> Building python_select
---> Staging python_select into destroot
---> Installing python_select @0.2.1_0+darwin_9
---> Activating python_select @0.2.1_0+darwin_9
---> Cleaning python_select

After installation we can show available python lists using '-l' option. 
bash-3.2# python_select -l
Available versions:
current none python25 python25-apple

And then, we can set the MacPorts python as default. We can show what python is default currently using '-s' option.
bash-3.2# python_select python25
Selecting version "python25" for python
bash-3.2# python_select -s

Despite of this setting, I couldn't solve my python problem using the Trac with the SVN repository. I think this problem come from python library dependency. 
Fatal Python error: Interpreter not initialized (version mismatch?)

encoding(X-MAC-KOREAN) problem on Python 2.5

2008.12.23 12:13 | Posted by bar4mi
It occurred when I installed Trac on my macbook. 

bash-3.2# trac-admin ./Trac/mkb initenv
Traceback (most recent call last):
  File "/opt/local/bin/trac-admin", line 8, in <module>
    load_entry_point('Trac==', 'console_scripts', 'trac-admin')()
  File "/opt/local/lib/python2.5/site-packages/trac/admin/console.py", line 1294, in run
    return admin.onecmd(command)
  File "/opt/local/lib/python2.5/site-packages/trac/admin/console.py", line 120, in onecmd
    line = to_unicode(line, encoding)
  File "/opt/local/lib/python2.5/site-packages/trac/util/text.py", line 59, in to_unicode
    return unicode(text, charset, 'replace')
LookupError: unknown encoding: X-MAC-KOREAN

According to python's issue(1276), it was fixed but my Python version(2.5) including MacPorts is not fixed. 

Python team offer the temporary patch which works great on my macbook.

It can just be inserted to 508th lines of aliases.py(/opt/local/lib/python2.5/encodings/aliases.py).

# temporary mac CJK aliases for 3.0, will be replaced in 3.1
    'x_mac_japanese'      : 'shift_jis',
    'x_mac_korean'        : 'euc_kr',
    'x_mac_simp_chinese'  : 'gb2312',
    'x_mac_trad_chinese'  : 'big5',

이전 1 다음

티스토리 툴바