ws4py appears a error in Linux system - python

I use ws4py as a websocket server. it can run normally in Windows and Mac, but it runs in linux system raising a TB when websocket clients connect to server. Anybody can tell me how to fix this bug?
[2016-01-06 20:51:43,094] ERROR Failed to receive data
Traceback (most recent call last):
File "/home/yzliu/airtest/env/local/lib/python2.7/site-packages/ws4py/websocket.py", line 300, in once
b = self.sock.recv(self.reading_buffer_size)
File "/home/yzliu/airtest/env/local/lib/python2.7/site-packages/gevent/_socket2.py", line 264, in recv
return sock.recv(*args)
File "/home/yzliu/airtest/env/local/lib/python2.7/site-packages/gevent/_socket2.py", line 73, in _dummy
raise error(EBADF, 'Bad file descriptor')

This is a bug in ws4py, when used with gevent 1.1, as the underlying
socket is closed when WSGI handler returns.
See: https://github.com/Lawouach/WebSocket-for-Python/pull/180/files

Related

Android Test Station give error and does not run

After running "mtt start" i get this error message, what could be the cause of this and how can it be resolved?
/home/me/.local/lib/python3.6/site-packages/google/auth/crypt/_cryptography_rsa.py:22: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.
import cryptography.exceptions
INFO|No lab config path set; using standalone mode config
INFO|Using image gcr.io/android-mtt/mtt:prod.
WARNING|No gcloud or service account json key file, can not login to https://gcr.io.
Traceback (most recent call last):
File "/home/me/.local/bin/mtt", line 11, in <module>
load_entry_point('Android-Test-Station-CLI===R30.202206.000', 'console_scripts', 'mtt')()
File "/home/me/.local/lib/python3.6/site-packages/multitest_transport/cli/cli.py", line 1204, in Main
args.func(args)
File "/home/me/.local/lib/python3.6/site-packages/multitest_transport/cli/cli.py", line 367, in Start
_StartMttNode(args, host)
File "/home/me/.local/lib/python3.6/site-packages/multitest_transport/cli/cli.py", line 399, in _StartMttNode
if docker_helper.IsContainerRunning(args.name):
File "/home/me/.local/lib/python3.6/site-packages/multitest_transport/cli/command_util.py", line 974, in IsContainerRunning
container_name, res.stderr, res.stdout))
multitest_transport.cli.command_util.DockerError: Failed to inpect mtt:
stderr:Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/mtt/json": dial unix /var/run/docker.sock: connect: permission denied
stdout:
.

SSH via python (paramiko) error: "'_EllipticCurvePublicKey' object has no attribute 'verify'"

I am trying to connect to a SSH server using the python library paramiko.
The same code worked on the same computer before, but it started to show a warning when trying to connect. I can connect to the SSH server using the same computer and same users via terminal. The python code also works on other computers connected to the same LAN network.
I also tried to restart both pcs and reinstall paramiko with no success.
Following is the code and the warning message presented.
class SSH:
def __init__(self, ip):
self.ssh = SSHClient()
self.ssh.load_system_host_keys()
self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.ssh.connect(hostname=ip ,username='urs',password='pass')
Warning message:
Unknown exception: '_EllipticCurvePublicKey' object has no attribute 'verify'
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/paramiko/transport.py", line 1886, in run
self.kex_engine.parse_next(ptype, m)
File "/usr/local/lib/python3.5/dist-packages/paramiko/kex_ecdh_nist.py", line 47, in parse_next
return self._parse_kexecdh_reply(m)
File "/usr/local/lib/python3.5/dist-packages/paramiko/kex_ecdh_nist.py", line 105, in _parse_kexecdh_reply
self.transport._verify_key(K_S, sig)
File "/usr/local/lib/python3.5/dist-packages/paramiko/transport.py", line 1748, in _verify_key
if not key.verify_ssh_sig(self.H, Message(sig)):
File "/usr/local/lib/python3.5/dist-packages/paramiko/ecdsakey.py", line 216, in verify_ssh_sig
self.verifying_key.verify(
AttributeError: '_EllipticCurvePublicKey' object has no attribute 'verify'
Do anybody have a suggestion about where the problem might be?
I tried to google and looked for the error here,but couldn't find it anywhere.
Thanks in advance!
I had the exact same error as now. I encountered this error with paramiko version 2.3.0. I downgraded to 2.1.2 and the operation i was doing proceeded normally.

wfastcgi fails import cx_Oracle, but `python -c "import cx_Oracle" succeeds

I have IIS setup with fastCGI, serving a flask app. So far so good. Next I whish to add some database connectivity, so I add the line import cx_Oracle to my app. Now this error is thrown:
Error occurred while reading WSGI handler:
Traceback (most recent call last):
File "D:\Anaconda2\lib\site-packages\wfastcgi.py", line 791, in main
env, handler = read_wsgi_handler(response.physical_path)
File "D:\Anaconda2\lib\site-packages\wfastcgi.py", line 633, in read_wsgi_handler
handler = get_wsgi_handler(os.getenv("WSGI_HANDLER"))
File "D:\Anaconda2\lib\site-packages\wfastcgi.py", line 616, in get_wsgi_handler
raise ValueError('"%s" could not be imported%s' % (handler_name, last_tb))
ValueError: "Bloomberg_server.app" could not be imported:
Traceback (most recent call last):
File "D:\Anaconda2\lib\site-packages\wfastcgi.py", line 600, in get_wsgi_handler
handler = __import__(module_name, fromlist=[name_list[0][0]])
File "D:\website\init__.py", line 6, in import cx_Oracle
ImportError: DLL load failed: The specified module could not be found. StdOut: StdErr:
As the title suggests I fail to reproduce the issue in a controlled environment. The very same import statement works fine in the conda environment and moreover, I can run the Flask debug server just fine with pages that rely on a database connection.
I am at loss. Who has a clue what's going on here? The path/oracle_home variables are pointing to the instant client and I have only one python environment installed.
I am too embarrased to admit how long this has taken me, but I've found the answer.
FastCGI's core business is keeping subprocesses alive so that subsequent calls to the server do not require booting a Python environment. In other words, after installing a python package it is advised to reboot. I solved my first question on SO by rebooting..
The answer to this question got me thinking in the right direction.

SSL Handshake Error while connecting to Server via web client

I am using SSL Connection from Web Client (firefox) to connect to the local Server created via the code available in this link MDM server code I have all the required signed Certificates issued by Apple available for running the server, as well as all the depended python modules installed.
I ran my code using the following command on my Windows Machine.
python server.py .
This successfully start running the server at the port 8080.
C:\Users\Administrator\Desktop\MDMServer>python server.py <ip address>
Can't find MyApp.mobileprovision in current directory.
Need both MyApp.ipa and Manifest.plist to enable InstallCustomApp.
Starting Server
https://<ipaddress>:8080/
But whenever a Web Client tries to connect to this Server.
Upon launching the link https://<ip address>:8080 in the firefox. The Server reports the following error.
Traceback (most recent call last):
File "server.py", line 498, in <module>
app.run()
File "C:\Python27\lib\site-packages\web\application.py", line 313, in run
return wsgi.runwsgi(self.wsgifunc(*middleware))
File "C:\Python27\lib\site-packages\web\wsgi.py", line 54, in runwsgi
return httpserver.runsimple(func, validip(listget(sys.argv, 1, '')))
File "C:\Python27\lib\site-packages\web\httpserver.py", line 157, in runsimple
server.start()
File "C:\Python27\lib\site-packages\web\wsgiserver\__init__.py", line 1765, in
start
self.tick()
File "C:\Python27\lib\site-packages\web\wsgiserver\__init__.py", line 1815, in
tick
s, ssl_env = self.ssl_adapter.wrap(s)
File "C:\Python27\lib\site-packages\web\wsgiserver\ssl_builtin.py", line 42, i
n wrap
keyfile=self.private_key, ssl_version=ssl.PROTOCOL_SSLv23)
File "C:\Python27\lib\ssl.py", line 372, in wrap_socket
ciphers=ciphers)
File "C:\Python27\lib\ssl.py", line 134, in __init__
self.do_handshake()
File "C:\Python27\lib\ssl.py", line 296, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [Errno 1] _ssl.c:503: error:1408A0C1:SSL routines:SSL3_GET_CLIENT_
HELLO:no shared cipher
Can anyone help me understand:
1) What these errors mean
2) Why I'm getting them, It was not coming with the older version of server.py code applicable to iphone 4s?
3) How I can go about fixing these
Thanks,
Vivek
This is because APNSWrapper hasn't been updated to TLSv1 yet.
Apple no longer supports sslv3 for MDM due to the POODLE vulnerability.
You can update APNSWrapper source yourself though pretty easily.
download the source and update connection.py
ssl_version = self.ssl_module.PROTOCOL_TLSv1,
the run
python setup.py install

web.py on apache gives a Socket operation on non-socket

What can cause this error?
I get these errors every time a client accesses my server.
it hapens only once in each request.
the script runs with seemingly no problems, but i don't know if there are hidden implications or complication that result from this error that i'm not aware of.
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/flup/server/fcgi_base.py", line 982, in _setupSocket
sock.getpeername()
fcgi_base
error: [Errno 88] Socket operation on non-socket
i'm running python as cgi ,web.py, linux (ubuntu12)
what can be the cause of this error?
How can I investigate it?

Categories