사용가능한 Python 모듈들을 알아보기 위해 python 인터프리터에서 전체 모듈보기 명령어를 입력했는데, 다음과 같은 오류 메시지를 확인했다.

pchero@MyDebian:/usr/lib/pymodules/python2.7$ python
Python 2.7.3 (default, Mar 13 2014, 11:03:55) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> help('modules')

Please wait a moment while I gather a list of all available modules...

/usr/lib/python2.7/dist-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed
  import gobject._gobject
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display
  warnings.warn(str(e), _gtk.Warning)
/usr/lib/python2.7/dist-packages/gi/module.py:142: Warning: cannot register existing type `GtkWidget'
  g_type = info.get_g_type()
/usr/lib/python2.7/dist-packages/gi/module.py:142: Warning: cannot add class private field to invalid type '<invalid>'
  g_type = info.get_g_type()
/usr/lib/python2.7/dist-packages/gi/module.py:142: Warning: g_type_add_interface_static: assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
  g_type = info.get_g_type()
/usr/lib/python2.7/dist-packages/gi/module.py:142: Warning: cannot register existing type `GtkBuildable'
  g_type = info.get_g_type()
/usr/lib/python2.7/dist-packages/gi/module.py:142: Warning: g_type_interface_add_prerequisite: assertion `G_TYPE_IS_INTERFACE (interface_type)' failed
  g_type = info.get_g_type()
/usr/lib/python2.7/dist-packages/gi/module.py:142: Warning: g_once_init_leave: assertion `result != 0' failed
  g_type = info.get_g_type()
/usr/lib/python2.7/dist-packages/gi/module.py:146: Warning: g_type_get_qdata: assertion `node != NULL' failed
  type_ = g_type.pytype

그리고 Hang 이 걸린듯 더이상 진행되지 않았다.

해결법을 찾던 도중, http://blog.rabbitvcs.org/archives/312 에서 비슷한 현상에 대한 해결법을 찾았는데 뭔가 완벽하진 않았다.
http://stackoverflow.com/questions/13301100/python-fail-to-display-list-of-modules 여기도 역시…
내용인 즉, help(‘modules’) 를 입력하기 전에 gtk 모듈을 먼저 load 하라는 것인데.. 깔끔하지 않았다.

pchero@MyDebian:/etc$ python
Python 2.7.3 (default, Mar 13 2014, 11:03:55) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gtk
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display
  warnings.warn(str(e), _gtk.Warning)
>>> 
>>> 
>>> help('modules')

Please wait a moment while I gather a list of all available modules...

/usr/lib/python2.7/dist-packages/keybinder/__init__.py:26: GtkWarning: IA__gdk_keymap_get_for_display: assertion `GDK_IS_DISPLAY (display)' failed
  from _keybinder import *
/usr/lib/python2.7/dist-packages/keybinder/__init__.py:26: GtkWarning: IA__gdk_screen_get_root_window: assertion `GDK_IS_SCREEN (screen)' failed
  from _keybinder import *

** (.:7702): WARNING **: keybinder_init: Unable to open display
ANSI                _codecs_iso2022     fdpexpect           pyatspi
ArgImagePlugin      _codecs_jp          feedparser          pyclbr
BaseHTTPServer      _codecs_kr          filecmp             pycurl
Bastion             _codecs_tw          fileinput           pydoc
BdfFontFile         _collections        fnmatch             pydoc_data
BeautifulSoup       _csv                formatter           pyexpat
BeautifulSoupTests  _ctypes             fpconst             pygtk
BmpImagePlugin      _ctypes_test        fpectl              pynotify
BufrStubImagePlugin _curses             fpformat            quopri
CDROM               _curses_panel       fractions           random
CGIHTTPServer       _dbus_bindings      freeswitch          re
Canvas              _dbus_glib_bindings ftplib              readline
ConfigParser        _elementtree        functools           reportbug
ContainerIO         _functools          future_builtins     reportlab
Cookie              _hashlib            gc                  repr
CurImagePlugin      _heapq              gconf               resource
DLFCN               _hotshot            genericpath         rexec
DcxImagePlugin      _imaging            getopt              rfc822
Dialog              _imagingcms         getpass             rlcompleter
DocXMLRPCServer     _imagingft          gettext             robotparser
EpsImagePlugin      _imagingmath        gi                  runpy
ExifTags            _io                 gio                 scanext
FSM                 _json               glib                sched
FileDialog          _locale             glob                screen
FitsStubImagePlugin _lsprof             gnome               select
FixTk               _multibytecodec     gnome_sudoku        serial
FliImagePlugin      _multiprocessing    gnomecanvas         sets
FontFile            _pyio               gnomevfs            setuptools
FpxImagePlugin      _random             gobject             sgmllib
GbrImagePlugin      _renderPM           grp                 sgmlop
GdImageFile         _rl_accel           gtk                 sha
GifImagePlugin      _socket             gtkunixprint        shelve
GimpGradientFile    _sqlite3            gtweak              shlex
GimpPaletteFile     _sre                gzip                shutil
GnuPGInterface      _ssl                hamster             signal
GribStubImagePlugin _strptime           hashlib             site
HTMLParser          _struct             heapq               sitecustomize
Hdf5StubImagePlugin _symtable           hmac                smtpd
HelloModule         _sysconfigdata      hotshot             smtplib
IN                  _sysconfigdata_nd   hpmudext            sndhdr
IcnsImagePlugin     _testcapi           htmlentitydefs      socket
IcoImagePlugin      _threading_local    htmllib             softwareproperties
ImImagePlugin       _warnings           httplib             speechd
Image               _weakref            httplib2            speechd_config
ImageChops          _weakrefset         ihooks              spwd
ImageCms            abc                 imaplib             sqlite3
ImageColor          aifc                imghdr              sre
ImageDraw           antigravity         imp                 sre_compile
ImageDraw2          anydbm              importlib           sre_constants
ImageEnhance        apt                 imputil             sre_parse
ImageFile           apt_inst            inspect             ssl
ImageFileIO         apt_pkg             invest              starpy
ImageFilter         aptdaemon           io                  stat
ImageFont           aptsources          itertools           statvfs
ImageGL             argparse            json                string
ImageGrab           array               keybinder           stringold
ImageMath           ast                 keyword             stringprep
ImageMode           asynchat            lib2to3             strop
ImageOps            asyncore            libxml2             struct
ImagePalette        atexit              libxml2mod          subprocess
ImagePath           atk                 linecache           sunau
ImageQt             audiodev            linuxaudiodev       sunaudio
ImageSequence       audioop             locale              symbol
ImageShow           axi                 logging             symtable
ImageStat           base64              louis               sys
ImageTransform      bdb                 lsb_release         sysconfig
ImageWin            binascii            macpath             syslog
ImtImagePlugin      binhex              macurl2path         tabnanny
IptcImagePlugin     bisect              mailbox             tarfile
JpegImagePlugin     bonobo              mailcap             telnetlib
McIdasImagePlugin   brlapi              mako                tempfile
MicImagePlugin      bsddb               markupbase          termios
MimeWriter          bz2                 markupsafe          test
MpegImagePlugin     cPickle             marshal             test1
MspImagePlugin      cProfile            math                textwrap
ORBit               cStringIO           md5                 this
OleFileIO           cairo               mhlib               thread
OpenSSL             calendar            mimetools           threading
PAM                 caribou             mimetypes           tidy
PIL                 cgi                 mimify              time
PSDraw              cgitb               mmap                timeit
PaletteFile         chardet             mod_fstest          tkColorChooser
PalmImagePlugin     chunk               mod_test            tkCommonDialog
PcdImagePlugin      cmath               modulefinder        tkFileDialog
PcfFontFile         cmd                 multifile           tkFont
PcxImagePlugin      code                multiprocessing     tkMessageBox
PdfImagePlugin      codecs              mutex               tkSimpleDialog
PixarImagePlugin    codeop              netrc               toaiff
PngImagePlugin      collections         new                 token
PpmImagePlugin      colorsys            nis                 tokenize
PsdImagePlugin      commands            nntplib             trace
Queue               compileall          ntpath              traceback
SOAPpy              compiler            nturl2path          ttk
ScrolledText        contextlib          numbers             tty
SgiImagePlugin      cookielib           numpy               turtle
SimpleDialog        copy                opcode              twisted
SimpleHTTPServer    copy_reg            operator            types
SimpleXMLRPCServer  crypt               optparse            unicodedata
SocketServer        csv                 orca                unittest
SpiderImagePlugin   ctypes              os                  uno
StringIO            cupsext             os2emxpath          unohelper
SunImagePlugin      curl                ossaudiodev         urllib
TYPES               curses              packagekit          urllib2
TarIO               datetime            pango               urlparse
TgaImagePlugin      dbhash              pangocairo          user
TiffImagePlugin     dbm                 parser              uu
TiffTags            dbus                pcardext            uuid
Tix                 deb822              pdb                 vte
Tkconstants         debconf             pexpect             warnings
Tkdnd               debian              pickle              wave
Tkinter             debian_bundle       pickletools         weakref
UserDict            debianbts           pip                 webbrowser
UserList            decimal             pipes               whichdb
UserString          defer               pkg_resources       wnck
WalImageFile        difflib             pkgutil             wsgiref
WmfImagePlugin      dircache            platform            xapian
XVThumbImagePlugin  dis                 plistlib            xdg
XbmImagePlugin      distutils           popen2              xdrlib
XpmImagePlugin      doctest             poplib              xml
_LWPCookieJar       drv_libxml2         posix               xmllib
_MozillaCookieJar   dsextras            posixfile           xmlrpclib
__builtin__         dumbdbm             posixpath           xxsubtype
__future__          dummy_thread        pprint              zeitgeist
_abcoll             dummy_threading     profile             zipfile
_ast                easy_install        pstats              zipimport
_bisect             email               pty                 zlib
_bsddb              encodings           pwd                 zope
_codecs             errno               pxssh               
_codecs_cn          exceptions          pyHnj               
_codecs_hk          fcntl               py_compile          

Enter any module name to get more help.  Or, type "modules spam" to search
for modules whose descriptions contain the word "spam".

Tags: , , ,

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.