Kenichi Maehashi's Blog

脳内コアダンプ

RSS
Category:
yum update したら怒られました。環境はタイトルの通り。
# yum update
Loaded plugins: fastestmirror, priorities, rhnplugin
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in
yummain.user_main(sys.argv[1:], exit_code=True)
File "/usr/share/yum-cli/yummain.py", line 274, in user_main
errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 129, in main
result, resultmsgs = base.doCommands()
File "/usr/share/yum-cli/cli.py", line 432, in doCommands
self._getTs(needTsRemove)
File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 99, in _getTs
self._getTsInfo(remove_only)
File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 110, in _getTsInfo
pkgSack = self.pkgSack
File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 882, in
pkgSack = property(fget=lambda self: self._getSacks(),
File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 668, in _getSacks
self.repos.populateSack(whicepos)
File "/usr/lib/python2.6/site-packages/yum/repos.py", line 265, in populateSack
self.doSetup()
File "/usr/lib/python2.6/site-packages/yum/repos.py", line 72, in doSetup
self.ayum.plugins.run('prereposetup')
File "/usr/lib/python2.6/site-packages/yum/plugins.py", line 184, in run
func(conduitcls(self, self.base, conf, **kwargs))
File "/usr/share/yum-plugins/rhnplugin.py", line 121, in prereposetup_hook
str(e))
File "/usr/share/rhn/up2date_client/up2dateErrors.py", line 177, in __repr__
"The message was:\n") + self.errmsg
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 0: ordinal not in range(128)
rhnplugin が日本語のエラーメッセージ (UTF-8) を出そうとして、Python に怒られている模様。回避するには、英語ロカールにすればよろしい。
# LANG=en_US.UTF-8 yum update
Loaded plugins: fastestmirror, priorities, rhnplugin
There was an error communicating with RHN.
RHN Satellite or RHN Classic support will be disabled.
Error communicating with server. The message was:
No route to host
Loading mirror speeds from cached hostfile
* sl: ftp.ne.jp
* sl-fastbugs: ftp.ne.jp
* sl-security: ftp.ne.jp
file://var/cache/yum/x86_64/6.1/my-soft-channel/repodata/repomd.xml: [Errno 14] Could not open/read file://var/cache/yum/x86_64/6.1/my-soft-channel/repodata/repomd.xml
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: my-soft-channel. Please verify its path and try again
って、何だか deja-vu ...

Pythonista でないのでよく判らないのですが、Python デフォルトのエンコードは ascii なのかな? こんなことをすると UTF-8 になるみたいだけれど、本質的に間違っている気がする。
cat << '_EOF_' > /usr/lib/python2.6/site-packages/utf8.py
import sys
sys.setdefaultencoding("UTF-8")
_EOF_
追記: ネット上を探した感じだと、sitecustomize.py という名前で上記対応をしている人が多いみたい。

Comments

Leave Yours...
Name:
E-mail / URL (optional):
Comment:
Are You Robot?: