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. ^^

A few years ago, I felt that it is need to take a knowledge base system to support my tired brain. It is very stressful to work as a security consultant and a penetration tester because many techniques are being out of the world. Moreover a security professional must know more information and techniques better than its local professionals such as programmers, network engineers, system engineers. So it is important to keep the past information as much as to study new information. 

I decided to build my own using the Trac. Past I tried to build my department KB using the MoniWiki. I thought the Trac is more powerful. Currently I think it was right. 
It is easy to install the Trac on Mac OS X using the MacPorts. Please refer its installation guide how to install the MacPorts on your Mac OS X. You can install the Trac using 'port' command. It is more detail to view the Trac's installation guide.  
sudo port install apache2
sudo port install subversion + mod_dav_svn
sudo port install trac

After installation it is need to create your project. My project base directory is under my home directory. 
trac-admin /Users/bar4mi/Trac/mykb initenv

To use authentication it is need to make passwd using htpasswd which is inclued in apache package.
sudo htpasswd -c /Users/bar4mi/Trac/.htpasswd bar4mi

One thing you have to know is a problem using the Trac with mod_python25. I tried to install it with the mod_python25 but to fail it. it is the problem of the MacPorts package. I think so. So I run it with standalone mode. (Additionally to know is that the Mac OS X includes it's bundle apache. It's location is /usr/sbin/apachectl, the apache on the Macports is /opt/local/apacche2/bin/apachectl. Don't forget it! )
tracd -p 8000 --basic-auth=mykb,/Users/bar4mi/Trac/.htpasswd,"" /Users/bar4mi/Trac/mykb

So I have my private knowledge base system. What to remain is to fill it up. 

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 다음

티스토리 툴바