python27中mimetypes.py的UnicodeDecodeError ctype = ctype.encode(default_encoding) # omit in 3.x!

2014-4-15 foooy Nginx

python27中 Lib\mimetypes.py的一个bug,属于 "def enum_types(mimedb)"函数:

安装扩展会报以下错误:

ctype = ctype.encode(default_encoding) # omit in 3.x!

UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 1: ordinal not in range(128)

 

解决办法打开 Python27\lib\mimetypes.py删除或者注释下面代码

try:
    ctype = ctype.encode(default_encoding) # omit in 3.x!
except UnicodeEncodeError:
    pass


标签: python

评论(0) 浏览(5522)

OpenERP7.0用户手册,OSCG淘宝OpenERP用户手册,OpenERP7.0开发教程

2014-2-28 foooy python

 

OpenERP7.0用户手册,OSCG淘宝OpenERP用户手册,OpenERP7.0开发教程

 

转载:http://www.oscg.cn/

标签: python OpenERP

评论(0) 浏览(3985)

centos6 64位安装 安装RabbitMQ消息服务器

2014-2-24 foooy linux

 Rabbitmq 是用 erlang 语言写的,所以使用还要安装 Erlang。

安装 erlang 还要安装 python 与 simplejson,我环境中已经安装了 python 2.6.4,simplejson 只要 easy_install 就可以了

1、安装easy_install (已经安装了的忽略该步骤)

yum install -y python-setuptools python-setuptools-devel
 2、安装simplejson
easy_install simplejson
3、安装erlang
wget http://www.erlang.org/download/otp_src_R13B04.tar.gz
tar -zxf otp_src_R13B04.tar.gz
cd otp_src_R13B04
./configure
make && make install

如果提示:

configure: error: No curses library functions found

configure: error: /bin/sh '/root/otp_src_R15B01/erts/configure' failed for erts

执行:

yum -y install ncurses-devel

 

4、安装rabbitmq

yum install xmlto
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.2.3/rabbitmq-server-3.2.3.tar.gz
tar zxvf rabbitmq-server-3.2.3.tar.gz
cd rabbitmq-server-3.2.3
make TARGET_DIR=/usr/local/rabbitmq SBIN_DIR=/usr/local/rabbitmq/sbin MAN_DIR=/usr/local/rabbitmq/man DOC_INSTALL_DIR=/usr/local/rabbitmq/doc
make TARGET_DIR=/usr/local/rabbitmq SBIN_DIR=/usr/local/rabbitmq/sbin MAN_DIR=/usr/local/rabbitmq/man DOC_INSTALL_DIR=/usr/local/rabbitmq/doc install
5、启动 由于CentOS 6.2默认启动了qpidd这个消息中间件,所以占掉了5672端口(会与rabbitmq冲突),所以要先暂时停掉
service qpidd stop
/usr/local/rabbitmq/sbin/rabbitmq-server -detached #启动
/usr/local/rabbitmq/sbin/rabbitmqctl status #查看运行状态
/usr/local/rabbitmq/sbin/rabbitmqctl stop #停止
/usr/local/rabbitmq/sbin/rabbitmqctl rotate_logs #循环日志文件

启动时如果提示:ERROR: epmd error for host "****": timeout (timed out establishing tcp connection)

是因为主机名和ip不匹配了,需要更改/etc/hosts

127.0.0.1 yournewhostname (一般默认会有增加一个就可以了)

6、启用插件可在线管理队列
mkdir -p /etc/rabbitmq
/usr/local/rabbitmq/sbin/rabbitmq-plugins enable rabbitmq_management 
/usr/local/rabbitmq/sbin/rabbitmq-plugins list #查看已安装插件

然后可以通过http://127.0.0.1:55672/在线管理队列 用户名密码都为guest


点击查看原图

 

点击查看原图

 

 

标签: centos 消息队列 python rabbitmq

评论(0) 浏览(3789)

python 模块 卸载

2012-7-19 foooy python

第一中方式:
如果模块安装包里没有setup.py uninstall这个选项的话,可以到site-packages包里删除相应的.egg文件

第二中方式:
从新运行安装程序,增加--record参数然后删除
python ./setup.py install --record install.txt
cat install.txt | xargs rm -rf

标签: linux centos python

评论(0) 浏览(1089)

python import psycopg2报ImportError: libpq.so.5: cannot open shared object file: No such file or directory

2012-7-19 foooy postgresql

import psycopg2 报错
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/psycopg2-2.4.1-py2.4-linux-x86_64.egg/psycopg2/__init__.py", line 71, in ?
    from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: libpq.so.5: cannot open shared object file: No such file or directory

解决办法:
cd /etc/ld.so.conf.d
echo "/usr/local/pgsql/lib" >>pgsql.conf
ldconfig

标签: 服务器 linux python OpenERP postgresql

评论(0) 浏览(2531)

Powered by emlog 鄂ICP备14000186号-1 sitemap