Posts tagged ‘python’

Build NINJA-IDE on Mac OS X Lion from source

Though I’m mainly using VIM as my full-functionality editor for daily works. Sometime I just want to try something else. Somewhat like ar… A Integrated Development Environment?

I have to admit Eclipse is a great IDE for developing Java / PHP (you use cracked Zend Studio?) and with a plugin called Aptana we can also write Ruby / Python stuff with it. But I don’t like java much.

So that’s why a IDE for Python called NINJA-IDE caught my eyes, especially itself written in Python. We can find it here and here.
NINJA-IDE is built from python and Qt for GUI. so make sure you have PyQt (at least version 4) runtime on your system.

If you are using the python within homebrew, you can just open terminal.app and key the following command and waiting for things’ done :)


brew install -v sip
brew install -v pyqt

For me, I’m using Mac OS X Lion so I choose not to screw the native python environment up. You can use pythonbrew.

And one thing must be pay attention. Sip and PyQt4 don’t use the standard setuptools to install. We have to download the latest source code and build ourself. They also require python to be built in framework mode. If you are running on Linux or not the same as me, I suggest you refer to your system’s manual or google for about how to build these things.
So let’s get started :)

all the stuff we will need can be found as:

First, make sure the python has been built for framework mode.


# is supposed to be something like:
/Users/aleiphoenix/.pythonbrew/pythons/Python-2.7.2/Frameworks/Python.framework/Versions/2.7/bin/python

about how to build python for Macosx/Darwin framework


# use pythonbrew
# add `--framework`
# `--universal` for build 32bit / 64 bit for intel CPUs
# `-n` for
pythonbrew install --framework --universal -n 2.7.2

building Sip and PyQt4 is similar


# cd into source folder
# `-n` for universal binary
python configure.py --arch=x86_64 -n

# then `make` and `make install`
make && make install

# building PyQt4 is identical

Check whether the installation is successful. If don’t get any error, congratulations!


python -c 'import sip'
python -c 'import PyQt4'

Now we can start NINJA-IDE by hitting for following command in source code folder.


python ninja-ide.py

OK… the interface is not so awesome as their website.. but guess I will have a try with it :D

trac升级后注册时遇到的报错解决

前阵子公司里的一台办公室server升级,迁移重启后trac启不来了,不停报错。当时电话通知我解决,想也没想直接pip uninstall && pip install trac了一下。没注意老的版本升级成0.12.2了。
在数据库以外的问题,就是注册时总是提示。

AttributeError: 'AccountChangeNotification' object has no attribute 'smtp_server'

在mod_python的httpd下error_log竟然看不到错误。动手把trac.ini配置里错误输出到指定文件后发现traceback大意是acct_mgr下notification.py的146行有报错。没有smtp_server属性。由于该行代码是trac自身记录日志用的,不影响使用。可以直接注释掉。
另外由于安装TracAccountManager时用的是蛇蛋,所以需要把notification.pyc文件删除后重启httpd才能生效哦。

这个故事告诉我们。。在没法debug的情况下(大部分情况),traceback是很重要的。嗯嗯。