Error while Happybase connection with hbase - python

>>>import happybase
>>>cnx=happybase.Connection('localhost')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/seyf/envname/local/lib/python2.7/site-packages/happybase/api.py", line 121, in __init__
self.open()
File "/home/seyf/envname/local/lib/python2.7/site-packages/happybase/api.py", line 138, in open
self.transport.open()
File "/home/seyf/envname/local/lib/python2.7/site-packages/thrift/transport/TTransport.py", line 149, in open
return self.__trans.open()
File "/home/seyf/envname/local/lib/python2.7/site-packages/thrift/transport/TSocket.py", line 99, in open
message=message)
thrift.transport.TTransport.TTransportException: Could not connect to localhost:9090

First, make sure the thrift server is running:
hbase thrift start
Then make sure you get the right port number (default 9090)\
cnx=happybase.Connection('localhost', port=xxxx)

This looks like a network problem. Did you actually start the Thrift server? (It's not the same process as the HBase daemon itself.)

Related

How to solve the problem with streams in python?

I have a problem with streams in python. when I run a script with more than 350 threads, it gives me an error.
Traceback (most recent call last):
File "start.py", line 1487, in <module>
uagents, referers, proxies).start()
File "/usr/local/lib/python3.7/threading.py", line 852, in start
_start_new_thread(self._bootstrap, ())
RuntimeError: can't start new thread
saw a solution for ubuntu, it consists in changing the configs of the systemd package. But I never figured out how to do it.

Cannot get python module ezsheets to work

I followed the steps from the official documentation for ezsheets. Both apis were activated (sheets and drive) and I turned on a python shell and imported the ezsheets module. But, it did not open the new browser window like the documentation said it's supposed to. I then tried and successfully got google sheets working with googles' quickstart script. I have the credentials-sheets.json and token.pickle in the same folder as my python scripts. Sheets api seems to work just fine on it's own but when I try it with ezsheets module I get a following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/method/.local/share/virtualenvs/python_projects-sgt8dc05/lib/python3.6/site-packages/ezsheets/__init__.py", line 1559, in listSpreadsheets
if not IS_INITIALIZED: init()
File "/home/method/.local/share/virtualenvs/python_projects-sgt8dc05/lib/python3.6/site-packages/ezsheets/__init__.py", line 1520, in init
creds = flow.run_local_server()
File "/home/method/.local/share/virtualenvs/python_projects-sgt8dc05/lib/python3.6/site-packages/google_auth_oauthlib/flow.py", line 443, in run_local_server
host, port, wsgi_app, handler_class=_WSGIRequestHandler)
File "/usr/lib/python3.6/wsgiref/simple_server.py", line 153, in make_server
server = server_class((host, port), handler_class)
File "/usr/lib/python3.6/socketserver.py", line 456, in __init__
self.server_bind()
File "/usr/lib/python3.6/wsgiref/simple_server.py", line 50, in server_bind
HTTPServer.server_bind(self)
File "/usr/lib/python3.6/http/server.py", line 136, in server_bind
socketserver.TCPServer.server_bind(self)
File "/usr/lib/python3.6/socketserver.py", line 470, in server_bind
self.socket.bind(self.server_address)
OSError: [Errno 98] Address already in use
ezsheets is trying to open webserver on port 8000 to obtain access token. But it is already occupied by another app.
Chech what app listens on port 8000 and close it.
On Linux you can check it with
netstat -tulpn | grep 8000
On Windows:
netstat -ab

Unable to start pritunl after installation

I've installed pritunl on my VPS. Now I can't access to the web interface. It's not possible to start the service (Please have a look on the logs below).
There's a mariadb DB besides the mongodb which is included in pritunl, is it a problem? (I need the mariadb for other applications, thats why)
I followed the official guide for CentOS. It seems like there are some missing prerequisites, but actually I don't know.
Can someone help me out? :-)
Thanks!
Moejoe
pritunl logs
[undefined][2017-01-30 21:45:51,211][ERROR] Pritunl setup failed
Traceback (most recent call last):
File "/usr/lib/pritunl/lib/python2.7/site-packages/pritunl/setup/__init__.py", line 68, in setup_db
setup_mongo()
File "/usr/lib/pritunl/lib/python2.7/site-packages/pritunl/setup/mongo.py", line 65, in setup_mongo
serverSelectionTimeoutMS=MONGO_SOCKET_TIMEOUT,
File "/usr/lib/pritunl/lib/python2.7/site-packages/pymongo/mongo_client.py", line 345, in __init__
seeds.update(uri_parser.split_hosts(entity, port))
File "/usr/lib/pritunl/lib/python2.7/site-packages/pymongo/uri_parser.py", line 244, in split_hosts
raise ConfigurationError("Empty host "
ConfigurationError: Empty host (or extra comma in host list).
Traceback (most recent call last):
File "/usr/bin/pritunl", line 9, in <module>
load_entry_point('pritunl==1.26.1231.99', 'console_scripts', 'pritunl')()
File "/usr/lib/pritunl/lib/python2.7/site-packages/pritunl/__main__.py", line 264, in main
setup.setup_db()
File "/usr/lib/pritunl/lib/python2.7/site-packages/pritunl/setup/__init__.py", line 68, in setup_db
setup_mongo()
File "/usr/lib/pritunl/lib/python2.7/site-packages/pritunl/setup/mongo.py", line 65, in setup_mongo
serverSelectionTimeoutMS=MONGO_SOCKET_TIMEOUT,
File "/usr/lib/pritunl/lib/python2.7/site-packages/pymongo/mongo_client.py", line 345, in __init__
seeds.update(uri_parser.split_hosts(entity, port))
File "/usr/lib/pritunl/lib/python2.7/site-packages/pymongo/uri_parser.py", line 244, in split_hosts
raise ConfigurationError("Empty host "
pymongo.errors.ConfigurationError: Empty host (or extra comma in host list).
I had exactly the same problem.
The only solution is to (temporaly) shut down apache:
Obviously sudo service httpd stop or on debian sudo service apache stop
After that, you should be able to finish the installation and start pritunl, and change the ports to not use 80 and 443, and finally restarting everything like a boss
For me that was like, in this order only
sudo pritunl set app.redirect_server false
sudo service pritunl stop
sudo service apache start
sudo service pritunl start

error on connection to redis-server in chat messenger

I have developed a chat system by Python. libraries been used :easygui,pycrypto,netifaces,stepic,redis,rabbitmq,pika,PIL and setuptools.
all libraries seems installed well refer to : python> import library
by using redis-server on localhost, users can connect to redis and signup,login,chat,.. but when setting redis on different device and change localhost to redis server ip in codes, i receive following errors. (am using lubuntu last version in oracle virtual machine)
enter code here
Traceback (most recent call last):
File "kiducb.py", line 392, in <module>
g = Gui()
File "kiducb.py", line 19, in __init__
self.welcome()
File "kiducb.py", line 33, in welcome
rl = self.login()
File "kiducb.py", line 126, in login
resp = self.check_up(fvals[0], fvals[1], mac)
File "kiducb.py", line 76, in check_up
val = self.re.get(username)
File "/usr/lib/python2.7/dist-packages/redis/client.py", line 423, in get
return self.execute_command('GET', name)
File "/usr/lib/python2.7/dist-packages/redis/client.py", line 283, in execute_command
connection.send_command(*args)
File "/usr/lib/python2.7/dist-packages/redis/connection.py", line 260, in send_command
self.send_packed_command(self.pack_command(*args))
File "/usr/lib/python2.7/dist-packages/redis/connection.py", line 243, in
send_packed_command
self.connect()
File "/usr/lib/python2.7/dist-packages/redis/connection.py", line 191, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting 10.1.1.12:6379. Connection refused.
to solve this problem, i removed the redis-server which earlier i installed by useing apt-get from system, and i folowed this link instruction: https://www.digitalocean.com/community/articles/how-to-install-and-use-redis

GAE " no attribute 'HTTPSHandler' " dev_appserver.py

I am trying to use the google appengine python SKD from my ubuntu lucid. I have already compiled python2.5. But when I execute any "dev_appserver.py" command with it I get the following error:
Traceback (most recent call last):
File "dev_appserver.py", line 69, in <module>
run_file(__file__, globals())
File "dev_appserver.py", line 65, in run_file
execfile(script_path, globals_)
File "/home/rohan/workspace/app_en/google_appengine/google/appengine/tools/dev_appserver_main.py", line 90, in <module>
from google.appengine.tools import appcfg
File "/media/Ultimate/WebD/django/app_engine/google_appengine/google/appengine/tools/appcfg.py", line 59, in <module>
from google.appengine.tools import appengine_rpc
File "/media/Ultimate/WebD/django/app_engine/google_appengine/google/appengine/tools/appengine_rpc.py", line 24, in <module>
import fancy_urllib
File "/media/Ultimate/WebD/django/app_engine/google_appengine/lib/fancy_urllib/fancy_urllib/__init__.py", line 328, in <module>
class FancyHTTPSHandler(urllib2.HTTPSHandler):
AttributeError: 'module' object has no attribute 'HTTPSHandler'
I have checked the urllib2 moduls of python2.6 and python2.5 but there was no difference in the models defination and HTTPSHandelr is there in python2.5 too. So I guess it is some other sort of error.
I tried to run with the default python2.6 too but then I get the following error:
WARNING 2010-09-11 12:08:40,848 datastore_file_stub.py:657] Could not read datastore data from /tmp/dev_appserver.datastore
Traceback (most recent call last):
File "./dev_appserver.py", line 69, in <module>
run_file(__file__, globals())
File "./dev_appserver.py", line 65, in run_file
execfile(script_path, globals_)
File "/home/rohan/workspace/app_en/google_appengine/google/appengine/tools/dev_appserver_main.py", line 449, in <module>
sys.exit(main(sys.argv))
File "/home/rohan/workspace/app_en/google_appengine/google/appengine/tools/dev_appserver_main.py", line 426, in main
static_caching=static_caching)
File "/home/rohan/workspace/app_en/google_appengine/google/appengine/tools/dev_appserver.py", line 3820, in CreateServer
server = HTTPServerWithScheduler((serve_address, port), handler_class)
File "/home/rohan/workspace/app_en/google_appengine/google/appengine/tools/dev_appserver.py", line 3840, in __init__
request_handler_class)
File "/usr/lib/python2.6/SocketServer.py", line 400, in __init__
self.server_bind()
File "/usr/lib/python2.6/BaseHTTPServer.py", line 108, in server_bind
SocketServer.TCPServer.server_bind(self)
File "/usr/lib/python2.6/SocketServer.py", line 411, in server_bind
self.socket.bind(self.server_address)
File "<string>", line 1, in bind
socket.error: [Errno 98] Address already in use
It works well in windows and even under wine.
Update
Problem with python2.6 solved.
I had configured my apache server for a django deployment on the 8080 and 80 port some time earlier.
But there is still same error with python2.5 isntallation.
Solved the issue...just needed to build all dependencies of python using:
apt-get build-dep python
python compiles with no error even when all the dependencies are not installed. It just skips the modules which require them and builds python.
Solution for missing HTTPSHandler:
Before you build python 2.5 from source you need to enable ssl-socket by editing Modules/Setup.dist (more info here http://paltman.com/2007/nov/15/getting-ssl-support-in-python-251/)
The method described in this post worked perfectly for me (Ubuntu 11.10).
http://dewbot.posterous.com/installation-of-python-25-and-google-app-engi

Categories

Resources