Python 3.1에서의 Pydocs(Module Docs) 질문

96 views
Skip to first unread message

Pyrot

unread,
Oct 16, 2009, 3:15:12 AM10/16/09
to Python 3 질문 게시판
2.6에서 잘 실행되던 Module Docs가 3.1에서는 안되네요...

명령어 프롬프트에서 직접 pydocs를 실행하면


TraceBack (~~~~)
~~~~
~~~~
name = gethostname()
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 0-1:
invalid data

라고 뜨면서 안됩니다.

아무래도 2.6과 3.1에서 유니코드를 다루는 방법이 달라져서 그런것 같습니다만.. 이제 막 설치하고 책을 집어든 저로서는 해결
할 방법을 모르겠네요...

혹시 비슷한 문제를 겪으셨거나 해결하신분 있으면 조언 부탁드립니다^^

Dsp

unread,
Oct 19, 2009, 10:04:19 AM10/19/09
to Python 3 질문 게시판
안녕하세요~
질문 주셔서 감사합니다.

제가 2.5와 3.0에 대해서 둘다 로컬에 설치해 놓고 다음과 같이 테스트해 보았습니다.


C:\>c:\Python30\python.exe c:\Python30\Lib\pydoc.py sqlite3
Help on package sqlite3:

NAME
sqlite3

FILE
c:\python30\lib\sqlite3\__init__.py

PACKAGE CONTENTS
dbapi2
dump
test (package)

CLASSES
builtins.Exception(builtins.BaseException)
Error
DatabaseError
DataError
IntegrityError
InternalError
NotSupportedError
OperationalError
ProgrammingError
InterfaceError
Warning
builtins.object
Cache
Connection
Cursor
PrepareProtocol
Row
Statement

class Cache(builtins.object)
| Methods defined here:
|
| __init__(...)
| x.__init__(...) initializes x; see x.__class__.__doc__ for
signature
|
| display(...)
| For debugging only.
|
| get(...)
| Gets an entry from the cache or calls the factory function
to produc
e one.
|


C:\>c:\Python25\python.exe c:\Python25\Lib\pydoc.py sqlite3
Help on package sqlite3:

NAME
sqlite3

FILE
c:\python25\lib\sqlite3\__init__.py

DESCRIPTION
#-*- coding: ISO-8859-1 -*-
# pysqlite2/__init__.py: the pysqlite2 package.
#
# Copyright (C) 2005 Gerhard H?ing <g...@ghaering.de>
#
# This file is part of pysqlite.
#
# This software is provided 'as-is', without any express or
implied
# warranty. In no event will the authors be held liable for any
damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any
purpose,
# including commercial applications, and to alter it and
redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you
must not
# claim that you wrote the original software. If you use this
software
# in a product, an acknowledgment in the product documentation
would be
# appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, and
must not be
# misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source
distribution.

PACKAGE CONTENTS
dbapi2
test (package)

CLASSES
__builtin__.object
Cache
Connection
Cursor
PrepareProtocol
Row
Statement
exceptions.StandardError(exceptions.Exception)
Error



보시다시피 둘다 잘 동작합니다.
그러나 3.1에 대해서 테스트해 보니 말씀하신 바와 같이 에러가 나네요.


C:>c:\Python31\python.exe c:\Python31\Lib\pydoc.py sqlite3
Traceback (most recent call last):
File "c:\Python31\Lib\pydoc.py", line 2328, in <module>
if __name__ == '__main__': cli()
File "c:\Python31\Lib\pydoc.py", line 2297, in cli
help.help(arg)
File "c:\Python31\Lib\pydoc.py", line 1755, in help
elif request: doc(request, 'Help on %s:')
File "c:\Python31\Lib\pydoc.py", line 1506, in doc
pager(render_doc(thing, title, forceload))
File "c:\Python31\Lib\pydoc.py", line 1321, in pager
pager(text)
File "c:\Python31\Lib\pydoc.py", line 1339, in <lambda>
return lambda text: tempfilepager(plain(text), 'more <')
File "c:\Python31\Lib\pydoc.py", line 1372, in tempfilepager
file.write(text)
UnicodeEncodeError: 'cp949' codec can't encode character '\xe4' in
position 238:
illegal multibyte sequence


말씀하신 것과는 약간 다르지만, 인코딩 에러가 납니다.
아마도 3.1에서의 오류로 생각됩니다. 조만간 fix 되겠죠?
그때까지는 아래와 같이 파일로 써서 사용해야 할듯 합니다... ㅠㅜ;

C:\>c:\Python31\python.exe c:\Python31\Lib\pydoc.py -w sqlite3
wrote sqlite3.html

감사합니다.

Pyrot

unread,
Nov 15, 2009, 7:27:35 AM11/15/09
to Python 3 질문 게시판
감사합니다 ㅠㅠ

일단은 다른 패키지들 때문에 다시 2.6으로 돌아가버렸습니다 ㅠ 흑
Reply all
Reply to author
Forward
0 new messages