Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

python sys.path on freebsd

Name: Anonymous 2009-03-27 12:34

first time python user, long time fgt.

installed python 2.5 on freebsd, pyOpenSSL ends up in /usr/local/lib/python2.5/site-packages/ and sys.path is ['', '/usr/local/lib/python25.zip', '/usr/local/lib/python2.5', '/usr/local/lib/python2.5/plat-freebsd7', '/usr/local/lib/python2.5/lib-tk', '/usr/local/lib/python2.5/lib-dynload', '/usr/local/lib/python2.5/site-packages', '/usr/local/lib/python2.5/site-packages']

i'm trying to execute a prewritten script out of a project i downloaded and it has this code

try:
    openssl_installed = False
    from OpenSSL import SSL
    openssl_installed = True
except ImportError:
    pass


it still doesn't find OpenSSL

Name: Anonymous 2009-03-27 12:35

oh and when i do import OpenSSL in python CLI i get

>>> import OpenSSL
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.5/site-packages/OpenSSL/__init__.py", line 11, in <module>
ImportError: No module named rand

missing a module?

Name: Anonymous 2009-03-27 12:43

Your OpenSSL bindings were written for Python 1.5.
Edit /usr/local/lib/python2.5/site-packages/OpenSSL/__init__.py and replace import rand (or equivalent) with import random. Then go yell at the pyOpenSSL maintainer.

Name: Anonymous 2009-03-27 12:53

>>1
Are you using ports/security/py-openssl?

Name: >>4 2009-03-27 12:58

Yeah, looks like you are. Apply the following patch to the port's Makefile, then make deinstall clean && make install clean. That should fix your problem.

I should send a PR or something but I am too lazy.

--- Makefile.orig       2009-03-27 12:55:40.000000000 -0400
+++ Makefile    2009-03-27 12:56:15.000000000 -0400
@@ -29,4 +29,7 @@
        @${ECHO_CMD} "include-dirs = ${OPENSSLINC}" >> ${WRKSRC}/setup.cfg
        @${ECHO_CMD} "library-dirs = ${OPENSSLLIB}" >> ${WRKSRC}/setup.cfg
 
+post-patch:
+       @${REINPLACE_CMD} -e 's|rand|random|' ${WRKSRC}/__init__.py
+
 .include <bsd.port.mk>

Name: Anonymous 2009-03-27 13:01

the files in /usr/local/lib/python2.5/site-packages/OpenSSL had wrong permissions, solved it, thanks for all ur help

Name: Anonymous 2010-12-06 9:58

Back to /b/, ``GNAA Faggot''

Name: Anonymous 2013-01-18 23:51

/prog/ will be spammed continuously until further notice. we apologize for any inconvenience this may cause.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List