ImportError: cannot import name RAND_egd - python

Here is the error I am receiving when I try to run my Google App Engine site locally. It actually works on my old computer (windows 10 and python 2.7.6 was installed) but not on a new one I just got with windows 10 and Python 2.7.11 installed. Any ideas on how to fix?
from _ssl import RAND_add, RAND_egd, RAND_status, SSL_ERROR_ZERO_RETURN, SSL_ERROR_WANT_READ, SSL_ERROR_WANT_WRITE, SSL_ERROR_WANT_X509_LOOKUP, SSL_ERROR_SYSCALL, SSL_ERROR_SSL, SSL_ERROR_WANT_CONNECT, SSL_ERROR_EOF, SSL_ERROR_INVALID_ERROR_CODE
ImportError: cannot import name RAND_egd

You likely need to also install some OS-specific library, probably the local equivalent of ssl, see Using Runtime-Provided Libraries with the Local Development Server

Related

No module named 'postal' python error on Apache2

I followed the instructions and successfully installed pypostal python package (package to help parse addresses) https://github.com/openvenues/pypostal.
I'm trying to set this up so the python script can be callable through an apache server on an ubuntu box. It works fine when executing the script from Terminal. However, it doesn't work when I make a call to apache to execute the script and I get the following error in the apache logs. I believe it might be some pathing issue but I haven't had much luck to resolve it. Any ideas will be appreciated.
Error:
File "/var/www/html/cgi-bin/get_parsedAddress.py", line 5, in
from postal.parser import parse_address
ModuleNotFoundError: No module named 'postal'
python script contents:
import sys
from postal.parser import parse_address
addressList = parse_address(sys.argv[1])
print(addressList)

Two users, same machine, same python installs, one can't import paramiko without UserWarning, module already imported

When running following code, user without error reports normal termination.
python -c "import paramiko"
User with error reports termination (note, no exception) with the following:
/usr/local/lib/python2.7/site-packages/cryptography/hazmat/backends/__init__.py:7: UserWarning: Module _hashlib was already imported from /usr/local/lib/python2.7/lib-dynload/_hashlib.so, but /usr/local/lib/python2.7/site-packages/hashlib-20081119-py2.7-linux-i686.egg is being added to sys.path
import pkg_resources
/usr/local/lib/python2.7/site-packages/cryptography/hazmat/backends/__init__.py:7: UserWarning: Module hashlib was already imported from /usr/local/lib/python2.7/hashlib.py, but /usr/local/lib/python2.7/site-packages/hashlib-20081119-py2.7-linux-i686.egg is being added to sys.path
import pkg_resources
Both users have the same PYTHONPATH, PATH and LD_LIBRARY_PATH. There are no virtual environments on this machine. All .pyc files have been removed on computer and error persists.
Python Version: 2.7.11
OS: CentOS 32 bit el6
pip freeze reports hashlib==20081119 and cryptography==1.7.2 and paramiko==2.1.1
Does anyone have any insight into this problem? I do not understand why one user can perform this task without error, while the other cannot.
Solved it by reinstalling paramiko with pip, ignoring caches and site-packages

Cannot import Scapy ssl_tls library

I am using newest Kali and importing scapy ssl_tls package like this:
from scapy.layers.ssl_tls import *
But I get an error: WARNING: can't import layer ssl_tls: No module named ssl_tls
or
ImportError: No module named ssl_tls.
Also, to verify installation, I go into Scapy prompt and type TLS or SSL I get:
>>> TLS
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'TLS' is not defined
So it makes me believe that I didn't install it correctly. However I tried all 3 installation methods from official page and all worked without any errors.
I also have SSL installed: apt-get install libssl-dev
My system:
Linux kali 3.18.0-kali3-amd64 #1 SMP Debian 3.18.6-1~kali2 (2015-03-02) x86_64 GNU/Linux
Python2.7
Scapy version 2.2.1. Also tried 2.3.1.
scapy-ssl_tls version - current from https://github.com/tintinweb/scapy-ssl_tls
root#kali:~/Downloads# pip freeze | grep scapy
Warning: cannot find svn location for distribute==0.6.24dev-r0
scapy==2.2.0-dev
scapy-ssl-tls==1.2.1
NOTE: I have same exact python code running good on different Kali machine, on the same Python, Scapy and scapy-ssl_tls versions.
I just installed ssl_tls using pip. Using this installation method in my case config.py was not updated with added layer, which means that running scapy does not import ssl_tls automatically thus it is not possible to do from scapy.layers.ssl_tls import *. Your case sounds similar.
There are 2 options:
Update scapy's config.py (location depends on the way you installed scapy) by adding ssl_tls module. See https://github.com/tintinweb/scapy-ssl_tls#option-3-manual-installation for example
Import module using from scapy_ssl_tls.ssl_tls import * after importing scapy (or running scapy directly)
github/scapy-ssl_tls PR #55 fixes an issue where setup.py would not find all scapy installation dirs in case you have multiple locations for site-packages. Also see the updated installation instructions and troubleshooting. The fix is in master and will be in scapy-ssl_tls > 1.2.2. Please give it a try and raise a bug on github if this does not fix the issue for you. thanks
Please make sure your python version is > 2.7.6 and then run 'pip install scapy-ssl_tls'

Cannot import python-social-auth into Google App Engine's django project

I have python-social-auth installed via pip
>>> import social
>>> print social
<module 'social' from '/usr/local/lib/python2.7/dist-packages/social/__init__.pyc'>
When I tried to run my django project, it complains that there is no module named social
File "/media/PROJECT/project/BINGO/bingo/django/utils/importlib.py", line 35, in import_module __import__(name)
ImportError: No module named social.apps.django_app.default
Dropping the module inside my project folder to be used locally, it works:
>>> import os
>>> print os.getcwd()
/media/PROJECT/project/BINGO/bingo
>>> import social
>>> print social
<module 'social' from 'social/__init__.pyc'>
However, now its dependencies can't be found
File "/media/PROJECT/project/BINGO/bingo/social/apps/django_app/default/models.py", line 2, in <module>
import six
ImportError: No module named six
I do have six installed globally. If I use six locally, another dependency, openid, then can't be found. I guess I can still keep going and adding all dependencies locally but why aren't my global modules imported?
Thanks!
You really need to read the doc's on appengine and it's sandbox. Everything (modules/libs) not directly provided by the sdk must be included in your project. All of these must be deployed with your code.
So you can't use the globally installed modules and their dependencies. It all needs to be present (installed or linked) in your project.
I use virtualenv --no-site-packages to install all modules and their dependencies, then symlink these bits from the local site-packages into a lib dir in my project.
I only found the openid and six dependencies. Actually, couldn't get the six.py to install globally for some reason, so just dumped a copy into each required directory.
Also, ran into an issue with basestring conversion if PY2 which then lead to the default import json silently failing, so had to swap to 'simplejson'. But in the end, got it working.

Python2.3.4 for Damnsmall Linux OS version2.4.26 on i686

I downloaded the python2.3.tar.gz
I installed it and started the interpreter
I import Tkinter but get and error message
File "/opt/python/lib/python2.3/lib-tk/Tkinter.py", line 38, in ?
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
How do I fix this?
The Tkinter Python module has a number of dependencies (including Tk and X11) which must have not been installed, or not installed correctly, when you configured and built Python.
Also, Python 2.3 is positively ancient. You may want to try again with a more recent version.

Categories

Resources