socketIO-client-nexus 0.7.6 - StopIteration error - python-socketio

from socketIO_client_nexus import SocketIO, LoggingNamespace
from requests.exceptions import ConnectionError
try:
socket = SocketIO('https://myURL/myendpoint', verify=False, wait_for_connection=False)
socket.wait()
except ConnectionError:
print('The server is down. Try again later.')
When I run the above code, I get the below stack trace.
This is a quite known issue. People who faced this issue said that it happened because the socket server that they were trying to connect to was built on socketio 2.x.
However, socketIO-client-nexus 0.7.6 seems to have reportedly solved their problems.
However, I'm still facing the same issue. Don't know what's wrong.
The server that I'm trying to connect to is built on socketio 2.0.1

Finally got it working. Reference https://pypi.org/project/socketIO-client-nexus/
Here's the working code.
from socketIO_client_nexus import SocketIO, BaseNamespace
class ChatNamespace(BaseNamespace):
def custom_response(self, *args):
print('on_custom_response', args)
socketIO = SocketIO('https://myIP', verify=False)
chat_namespace = socketIO.define(ChatNamespace, '/mynamespace')
socketIO.wait()

Related

OracleConnectionCacheImpl not working with ojdbc7

The following code was working with ojdbc14 but started to give error with ojdbc7 which i had to use for connection with oracle 12c.
OracleConnectionCacheImpl occ = new OracleConnectionCacheImpl();
occ.setURL(dbprp.getProperty("DB_URL"));
occ.setUser(dbprp.getProperty("DB_USER"))
occ.setPassword(dbprp.getProperty("DB_PASS"));
occ.setMinLimit(Integer.parseInt(dbprp.getProperty("CON_CACHE_MIN")));
occ.setMaxLimit(Integer.parseInt(dbprp.getProperty("CON_CACHE_MAX")));
occ.setCacheInactivityTimeout(Integer.parseInt(dbprp.getPropert("CON_CACHE_ABANDON_TIMEOUT")));
occ.setCacheScheme(dbprp.getProperty("CON_CACHE_SCHEME"));
I know that OracleConnectionCacheImpl deprecated from 11g onwards so how i work around this error. please help.

From axis2 function call, which is in another jar is not called and no error also shown

I have recently migrated my environment from Java 6 to Java 7. Installed Netbeans 8.0.2. A Grails(Version 2.1.1) project is running in it.
From Grails project using withREST a web service is called in another Tomcat (Version 8). This tomcat(version 8) is using axis2 to expose the methods. A java class "OneWebservice.java". Built as aar file and deployed.
Code is like this.
import com.project.Two.TwoFunction;
import com.project.Three.ThreeFunction;
public class OneWebservice{
function getOneandTwo()
{
com.project.Two.TwoFunction();
.....
com.project.Three.ThreeFunction();
}
}
When function getOneandTwo() is called, in the above code Two.TwoFunction is called, while Three.ThreeFunction is not called. No error is also printed.
Ok, Got this fixed.
We have Solr implemented for text based search.
Import related to Solr was there in com.project.Three.ThreeFunction this class file
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
was giving problem, if this is commented its working fine...
I think Solr is not working in Java 8 and Tomcat 8

JSF migration on WAS 8.5 causes "The import com.ibm.faces cannot be resolved"

I am migrating an old JSF application from WAS 6.x to WAS 8.x and I am getting the following compilation error:
The import com.ibm.faces cannot be resolved
This comes from the following code:
import com.ibm.faces.component.html.HtmlScriptCollector;
...
protected HtmlScriptCollector onLoadCollector;
How do I port this for use on WAS 8.x?
Looks so far like these methods can just be removed. A better explanation will get the check.

java import for HttpConnection

My code has an error that says HttpConnection cannot be resolved. The documentation says it is in the javax.microedition.io package, so I tried:
import javax.microedition.io;
That results in an error stating only a type can be resolved. Using quick fix results in:
import javax.microedition.io.*;
I’m assuming something is wrong with the imports?
The second import should solve your problem with resolving HttpConnection. However, HttpConnection is an interface. Are you using it as a class?

passenger_wsgi.py on dreamhost to get pylons working

This is what I found that in theory should work from git hub.com passenger-pylons-wsgi-example
import os, sys
sys.path.append('/home/user/test.sample.com/Helloworld')
os.environ['PYTHON_EGG_CACHE'] = '/home/user/tmp'
from paste.deploy import loadapp
def application(environ, start_response):
environ['SCRIPT_NAME'] = environ['PATH_INFO']
application = loadapp('config:/home/user/test.sample.com/production.ini')
return application(environ, start_response)
Tried it on dreamhost and I get:
An error occurred importing your
passenger_wsgi.py
I also tried the virtual environment but it didn't seem to work either.
mind you after following the instructions I have python 2.6 but no activate in the virtual directory.
Any ideas?
I also tried adding:
from fcgi import WSGIServer
and after the def application:
server = WSGIServer(application)
server.run()
But still get the same error. I wish it was a bit more descriptive so I could debug the passenger_wsgi
Finally found my answer:
import os, sys
INTERP = "/home/user/local/bin/python"
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)
sys.path.append('/home/user/test.sample.com/Helloworld')
os.environ['PYTHON_EGG_CACHE'] = '/home/user/tmp'
from paste.deploy import loadapp
def application(environ, start_response):
environ['SCRIPT_NAME'] = environ['PATH_INFO']
application = loadapp('config:/home/denat/test.sample.com/production.ini')
return application(environ, start_response)
The difference here is that the virtual environment was setup with pylons but wasn't using it. From the wiki on dreamhost I needed to add the following lines:
INTERP = "/home/user/local/bin/python"
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)
I now have a working pylons app! Yay!
I know others have been looking for this so I hope this helps them.

Resources