가딤을 열 수 없습니다

가딤을 열 수 없습니다

gnome의 터미널을 사용하여 Gajim을 열려고 하면 다음과 같은 메시지가 나타납니다.

Traceback (most recent call last):
  File "gajim.py", line 106, in <module>
    import common.configpaths
  File "/usr/share/gajim/src/common/configpaths.py", line 27, in <module>
    import tempfile
  File "/usr/lib64/python2.6/tempfile.py", line 34, in <module>
    from random import Random as _Random
  File "/usr/lib64/python2.6/random.py", line 47, in <module>
    from os import urandom as _urandom
ImportError: cannot import name urandom

이 문제를 해결하는 방법을 아시나요?

내 운영 체제는 Mandriva 2010.1이고 Python은 v2.4에서 v2.6으로 업그레이드되었습니다.

답변1

잘못된 os.py 모듈을 가져왔을 수 있습니다. python2.6을 시작해 보세요.

>>> import os
>>> print os.__file__

/usr/lib64/python2.6/os.py그것은 또는 이어야 합니다 /usr/lib64/python2.6/os.pyc. 그렇지 않은 경우 찾은 파일을 삭제하거나 이름을 바꾸십시오. 그렇다면 다음을 시도해 보세요.

>>> os.urandom(3)

그러면 3자리 문자열이 제공됩니다. 그렇다면 gajim잘못된 os.py모듈을 찾은 것입니다. 실행 시 동일한 오류가 발생 하면 끝 부분을 gajim살펴보고 존재하지 않으면 정의해야 합니다(해당 줄 사용 )./usr/lib64/python2.6/os.pyurandomif not _exists("urandom":

python-2.6.5-2.5mdv2010.2.x86_64and , 및 존재 의 경우와 같이 정의되지 않은 경우 /dev/urandom코드를 다시 추가해 볼 수 있습니다.

if not _exists("urandom"):
    def urandom(n):
        """urandom(n) -> str

        Return a string of n random bytes suitable for cryptographic use.

        """
        try:
            _urandomfd = open("/dev/urandom", O_RDONLY)
        except (OSError, IOError):
            raise NotImplementedError("/dev/urandom (or equivalent) not found")
        try:
            bs = b""
            while n - len(bs) >= 1:
                bs += read(_urandomfd, n - len(bs))
        finally:
            close(_urandomfd)
        return bs

또한보십시오:이것오류 보고서

관련 정보