Opened 5 years ago

Last modified 5 years ago

#58835 new defect

gajim 0.16.8_0 OpenSSL.rand.load_file(str(RNG_SEED)) AttributeError: 'module' object has no attribute 'load_file'

Reported by: vm4866571246066832v Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.5.4
Keywords: Cc:
Port: gajim

Description (last modified by vm4866571246066832v)

starting gajim, I get:

Traceback (most recent call last):
  File "gajim.py", line 307, in <module>
    OpenSSL.rand.load_file(str(RNG_SEED))
AttributeError: 'module' object has no attribute 'load_file'

installed ports:

  gajim @0.16.8_0 (active)
  openssl @1.0.2s_0 (active)
  py27-openssl @19.0.0_0 (active)
  libgcrypt @1.8.4_0 (active)
  py27-asn1crypto @0.24.0_0 (active)
  py27-crypto @2.6.1_1 (active)
  py27-cryptography @2.7_0 (active)

A net search has several hits about this topic, some say it's an issue in an OpenSSL Python module, then there is a Gajim fix mentioned.

Because the code block regarding the rand seed is optional anyway, I added a catch of the exception to work around the problem.

/opt/local/share/gajim/src/gajim.py
try:
    import OpenSSL.rand
    from common import crypto
    # Seed from file
    OpenSSL.rand.load_file(str(RNG_SEED))
    crypto.add_entropy_sources_OpenSSL()
    OpenSSL.rand.write_file(str(RNG_SEED))
    PYOPENSSL_PRNG_PRESENT = True
310 except ImportError:
311     log.info("PyOpenSSL PRNG not available")
312 except AttributeError:
313     log.info("PyOpenSSL PRNG not available")

Change History (4)

comment:1 Changed 5 years ago by vm4866571246066832v

Summary: gajim OpenSSL.rand.load_file(str(RNG_SEED)) AttributeError: 'module' object has no attribute 'load_file'gajim 0.16.8_0 OpenSSL.rand.load_file(str(RNG_SEED)) AttributeError: 'module' object has no attribute 'load_file'

You have to move the line PYOPENSSL_PRNG_PRESENT = True down as well:

try:
    import OpenSSL.rand
    from common import crypto
    # Seed from file
    OpenSSL.rand.load_file(str(RNG_SEED))
    crypto.add_entropy_sources_OpenSSL()
    OpenSSL.rand.write_file(str(RNG_SEED))
    PYOPENSSL_PRNG_PRESENT = True
except ImportError:
    log.info("PyOpenSSL PRNG not available")
except AttributeError:
    log.info("PyOpenSSL PRNG not available")
Last edited 5 years ago by vm4866571246066832v (previous) (diff)

comment:2 Changed 5 years ago by vm4866571246066832v

Description: modified (diff)

comment:3 Changed 5 years ago by mf2k (Frank Schima)

So this is an upstream problem? Can you submit a GitHub pull request to fix it?

comment:4 Changed 5 years ago by vm4866571246066832v

Looks like there is a fix on gajim.org: https://dev.gajim.org/gajim/gajim/issues/8788 post "Yann Leboulanger @asterix mentioned in commit 3dd35f5e 2 years ago"

Note: See TracTickets for help on using tickets.