Hello I am trying to connect to a neo4j database with py2neo.
This code works so far:
graph = Graph(bolt=True, host='***',
bolt_port=***,
http_port=***,
user='***',
password='***')
But when I protect my IP address with a password over HTTP then I can't connect and I don't know how to authorize py2neo to connect.
Does anyone know how I can solve this? :)
Edit :
When I open the ip in a web browser i need to input a user and a password before i can see the neo4j browser - and I do not now how to input these credentias with py2neo (because it seems that this is my problem)
Stacktrace:
Traceback (most recent call last):
File "WebApp35\lib\site-packages\flask\app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "WebApp35\lib\site-packages\flask\app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "WebApp35\lib\site-packages\flask_restful\__init__.py", line 271, in error_router
return original_handler(e)
File "WebApp35\lib\site-packages\flask\app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "WebApp35\lib\site-packages\flask\_compat.py", line 32, in reraise
raise value.with_traceback(tb)
File "WebApp35\lib\site-packages\flask\app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "WebApp35\lib\site-packages\flask\app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "WebApp35\lib\site-packages\flask_restful\__init__.py", line 271, in error_router
return original_handler(e)
File "WebApp35\lib\site-packages\flask\app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "WebApp35\lib\site-packages\flask\_compat.py", line 32, in reraise
raise value.with_traceback(tb)
File "WebApp35\lib\site-packages\flask\app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "WebApp35\lib\site-packages\flask\app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "WebApp35\lib\site-packages\flask_restful\__init__.py", line 477, in wrapper
resp = resource(*args, **kwargs)
File "WebApp35\lib\site-packages\flask\views.py", line 84, in view
return self.dispatch_request(*args, **kwargs)
File "WebApp35\lib\site-packages\flask_restful\__init__.py", line 587, in dispatch_request
resp = meth(*args, **kwargs)
File "app\handlers\nodeHandlers.py", line 70, in get
return DataManager.get_suggestion(suggestion_string), 201, {
File "app\adapter\dataManager.py", line 44, in get_suggestion
return cls.adapter.get_suggestion(suggestion_string)
File "app\adapter\neoAdapter.py", line 337, in get_suggestion
for node in cls.cypher.run(query):
File "WebApp35\lib\site-packages\py2neo\database\__init__.py", line 676, in run
return self.begin(autocommit=True).run(statement, parameters, **kwparameters)
File "WebApp35\lib\site-packages\py2neo\database\__init__.py", line 351, in begin
return self.transaction_class(self, autocommit)
File "WebApp35\lib\site-packages\py2neo\database\__init__.py", line 1171, in __init__
self.session = driver.session()
File "WebApp35\lib\site-packages\py2neo\packages\neo4j\v1\session.py", line 148, in session
session = Session(self)
File "WebApp35\lib\site-packages\py2neo\packages\neo4j\v1\session.py", line 461, in __init__
self.connection = connect(driver.host, driver.port, driver.ssl_context, **driver.config)
File "WebApp35\lib\site-packages\py2neo\packages\neo4j\v1\connection.py", line 399, in connect
raise error
py2neo.packages.neo4j.v1.exceptions.ProtocolError: Cannot establish secure connection; [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:720)
Related
I am new to python. I am following a tutorial series tk make a website using flask. But when i fill up the contact form and then click on send i get this error
ModuleNotFoundError: No module named 'MySQLdb'
Traceback (most recent call last)
File "C:\Users\acer\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\sqlalchemy\util\_collections.py", line 1020, in __call__
return self.registry[key]
During handling of the above exception, another exception occurred:
File "C:\Users\acer\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\flask\app.py", line 2464, in __call__
return self.wsgi_app(environ, start_response)
File "C:\Users\acer\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\flask\app.py", line 2450, in wsgi_app
response = self.handle_exception(e)
File "C:\Users\acer\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\flask\app.py", line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\acer\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\flask\_compat.py", line 39, in reraise
raise value
File "C:\Users\acer\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\flask\app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\acer\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\acer\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\flask\app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\acer\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\flask\_compat.py", line 39, in reraise
raise value
File "C:\Users\acer\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\acer\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\flask\app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "C:\Users\acer\PycharmProjects\webdev.flask\first.1.py", line 46, in contact
db.session.add(entry)
File "C:\Users\acer\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\sqlalchemy\orm\scoping.py", line 163, in do
return getattr(self.registry(), name)(*args, **kwargs)
File "C:\Users\acer\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\sqlalchemy\util\_collections.py", line 1022, in __call__
return self.registry.setdefault(key, self.createfunc())
File "C:\Users\acer\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\sqlalchemy\orm\session.py", line 3286, in __call__
return self.class_(**local_kw)
File "C:\Users\acer\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\flask_sqlalchemy\__init__.py", line 138, in __init__
bind = options.pop('bind', None) or db.engine
File "C:\Users\acer\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\flask_sqlalchemy\__init__.py", line 943, in engine
return self.get_engine()
File "C:\Users\acer\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\flask_sqlalchemy\__init__.py", line 962, in get_engine
return connector.get_engine()
File "C:\Users\acer\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\flask_sqlalchemy\__init__.py", line 556, in get_engine
self._engine = rv = self._sa.create_engine(sa_url, options)
File "C:\Users\acer\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\flask_sqlalchemy\__init__.py", line 972, in create_engine
return sqlalchemy.create_engine(sa_url, **engine_opts)
File "C:\Users\acer\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\sqlalchemy\engine\__init__.py", line 500, in create_engine
return strategy.create(*args, **kwargs)
File "C:\Users\acer\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\sqlalchemy\engine\strategies.py", line 87, in create
dbapi = dialect_cls.dbapi(**dbapi_args)
File "C:\Users\acer\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\sqlalchemy\dialects\mysql\mysqldb.py", line 118, in dbapi
return __import__("MySQLdb")
ModuleNotFoundError: No module named 'MySQLdb'
I tried to install mysqlient but it also gives ' cant build the wheel ' error.
I am using python 3.8
How to solve this issue?
if you use pycharm then file - > settings -> interpreter - > + (right). there you install wheel and mysql client (not always the latest version works)
if manually I assume that you are using a virtual environment, then you need to activate it and it already has "pip install wheel" also mysqlclient
I am using gridfs to store and get files from my MongoDB database
fs = gridfs.GridFS(MongoClient('mongodb://username:password#XX.XX.XX.XXX:27017/').mydb)
and to get a file I am using
file = fs.get_last_version(file_name).read()
On this line I get Authentication Failed exception.
Traceback (most recent call last):
File "C:\Python36\lib\site-packages\flask\app.py", line 1997, in __call__
return self.wsgi_app(environ, start_response)
File "C:\Python36\lib\site-packages\flask\app.py", line 1985, in wsgi_app
response = self.handle_exception(e)
File "C:\Python36\lib\site-packages\flask\app.py", line 1540, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\Python36\lib\site-packages\flask\_compat.py", line 33, in reraise
raise value
File "C:\Python36\lib\site-packages\flask\app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "C:\Python36\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Python36\lib\site-packages\flask\app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Python36\lib\site-packages\flask\_compat.py", line 33, in reraise
raise value
File "C:\Python36\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Python36\lib\site-packages\flask\app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "D:\git\EEG\ABM\BLabPythonService\app.py", line 1039, in start_processing
sys.stderr.flush()
File "D:\git\EEG\ABM\BLabPythonService\process_studies.py", line 271, in start_processing
overlay_artifacts(study)
File "D:\git\EEG\ABM\BLabPythonService\process_studies.py", line 49, in overlay_artifacts
edf_file = fs.get_last_version(file_name).read()
File "C:\Python36\lib\site-packages\gridfs\__init__.py", line 200, in get_last_version
return self.get_version(filename=filename, **kwargs)
File "C:\Python36\lib\site-packages\gridfs\__init__.py", line 184, in get_version
grid_file = next(cursor)
File "C:\Python36\lib\site-packages\pymongo\cursor.py", line 1132, in next
if len(self.__data) or self._refresh():
File "C:\Python36\lib\site-packages\pymongo\cursor.py", line 1055, in _refresh
self.__collation))
File "C:\Python36\lib\site-packages\pymongo\cursor.py", line 892, in __send_message
**kwargs)
File "C:\Python36\lib\site-packages\pymongo\mongo_client.py", line 950, in _send_message_with_response
exhaust)
File "C:\Python36\lib\site-packages\pymongo\mongo_client.py", line 961, in _reset_on_error
return func(*args, **kwargs)
File "C:\Python36\lib\site-packages\pymongo\server.py", line 99, in send_message_with_response
with self.get_socket(all_credentials, exhaust) as sock_info:
File "C:\Python36\lib\contextlib.py", line 81, in __enter__
return next(self.gen)
File "C:\Python36\lib\site-packages\pymongo\server.py", line 168, in get_socket
with self.pool.get_socket(all_credentials, checkout) as sock_info:
File "C:\Python36\lib\contextlib.py", line 81, in __enter__
return next(self.gen)
File "C:\Python36\lib\site-packages\pymongo\pool.py", line 852, in get_socket
sock_info.check_auth(all_credentials)
File "C:\Python36\lib\site-packages\pymongo\pool.py", line 570, in check_auth
auth.authenticate(credentials, self)
File "C:\Python36\lib\site-packages\pymongo\auth.py", line 486, in authenticate
auth_func(credentials, sock_info)
File "C:\Python36\lib\site-packages\pymongo\auth.py", line 466, in _authenticate_default
return _authenticate_scram_sha1(credentials, sock_info)
File "C:\Python36\lib\site-packages\pymongo\auth.py", line 237, in _authenticate_scram_sha1
res = sock_info.command(source, cmd)
File "C:\Python36\lib\site-packages\pymongo\pool.py", line 477, in command
collation=collation)
File "C:\Python36\lib\site-packages\pymongo\network.py", line 116, in command
parse_write_concern_error=parse_write_concern_error)
File "C:\Python36\lib\site-packages\pymongo\helpers.py", line 210, in _check_command_response
raise OperationFailure(msg % errmsg, code, response)
pymongo.errors.OperationFailure: Authentication failed.
Everything worked fine when my mongo database didnt have authentication.
Other use of database is working fine. I have this python service that is connecting to database using flask_pymogno and a c# application that is also connecting to database using c#, and all connections are with the same credentials.
Solved it. The problem was actually in my password witch contained '+' character. It is a reserved URI character. Fixed it by replacing '+' with '%2B' and it now works.
Reference:
https://en.wikipedia.org/wiki/Percent-encoding
I am fairly new to redis and using configuring redis with flask app.
i have edited redis.conf file and uncommented requirepass
requirepass foobared
and I am able to get into redid-cli using this password.
like this ./redis-cli -h 127.0.0.1 -p 6379 -a foobared
but when I try to initialise an object of Redis class by passing in the password,
>>> import os
>>> import redis
>>> from flask import Flask
>>> from redis import Redis
>>> app = Flask('weatherApp')
>>> app.config["REDIS_HOST"] = os.getenv("REDIS_HOST")
>>> app.config["REDIS_PORT"] = os.getenv("REDIS_PORT")
>>> app.config["REDIS_PWD"] = os.getenv("REDIS_PWD")
>>> app
<Flask 'weatherApp'>
>>> app.config
>>> redis = Redis(app.config["REDIS_HOST"], port=app.config["REDIS_PORT"],
... db=0, password=app.config["REDIS_PWD"])
>>> redis.client_list()
I keep getting the error saying:
Traceback (most recent call last):
File "/Users/ciasto-piekarz/Development/web/python/flask/flsk-dimnd/venv/lib/python2.7/site-packages/flask/app.py", line 2000, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/ciasto-piekarz/Development/web/python/flask/flsk-dimnd/venv/lib/python2.7/site-packages/flask/app.py", line 1991, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/Users/ciasto-piekarz/Development/web/python/flask/flsk-dimnd/venv/lib/python2.7/site-packages/flask/app.py", line 1567, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/ciasto-piekarz/Development/web/python/flask/flsk-dimnd/venv/lib/python2.7/site-packages/flask/app.py", line 1988, in wsgi_app
response = self.full_dispatch_request()
File "/Users/ciasto-piekarz/Development/web/python/flask/flsk-dimnd/venv/lib/python2.7/site-packages/flask/app.py", line 1641, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/ciasto-piekarz/Development/web/python/flask/flsk-dimnd/venv/lib/python2.7/site-packages/flask/app.py", line 1544, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Users/ciasto-piekarz/Development/web/python/flask/flsk-dimnd/venv/lib/python2.7/site-packages/flask/app.py", line 1639, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/ciasto-piekarz/Development/web/python/flask/flsk-dimnd/venv/lib/python2.7/site-packages/flask/app.py", line 1625, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/Users/ciasto-piekarz/Development/web/python/flask/flsk-dimnd/venv/lib/python2.7/site-packages/flask/views.py", line 84, in view
return self.dispatch_request(*args, **kwargs)
File "/Users/ciasto-piekarz/Development/web/python/weatherApp/src/views.py", line 192, in dispatch_request
print redis.client_list()
File "/Users/ciasto-piekarz/Development/web/python/flask/flsk-dimnd/venv/lib/python2.7/site-packages/redis/client.py", line 703, in client_list
return self.execute_command('CLIENT LIST')
File "/Users/ciasto-piekarz/Development/web/python/flask/flsk-dimnd/venv/lib/python2.7/site-packages/redis/client.py", line 667, in execute_command
connection.send_command(*args)
File "/Users/ciasto-piekarz/Development/web/python/flask/flsk-dimnd/venv/lib/python2.7/site-packages/redis/connection.py", line 610, in send_command
self.send_packed_command(self.pack_command(*args))
File "/Users/ciasto-piekarz/Development/web/python/flask/flsk-dimnd/venv/lib/python2.7/site-packages/redis/connection.py", line 585, in send_packed_command
self.connect()
File "/Users/ciasto-piekarz/Development/web/python/flask/flsk-dimnd/venv/lib/python2.7/site-packages/redis/connection.py", line 493, in connect
self.on_connect()
File "/Users/ciasto-piekarz/Development/web/python/flask/flsk-dimnd/venv/lib/python2.7/site-packages/redis/connection.py", line 561, in on_connect
if nativestr(self.read_response()) != 'OK':
File "/Users/ciasto-piekarz/Development/web/python/flask/flsk-dimnd/venv/lib/python2.7/site-packages/redis/connection.py", line 629, in read_response
raise response
ResponseError: Client sent AUTH, but no password is set
Any help will be greatly appreciated!
I I am using flask-restless. I am trying to respond of a get request of a gz file of a json object from s3 and do not understand how to send a gz file.
class report_download(Resource):
def get(self,report_name):
conn = boto.connect_s3(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
bucket = conn.get_bucket(bucketname)
key = Key(bucket, report_name)
key.get_contents_to_filename('/tmp/%s' % report_name)
os.system('gzip /tmp/%s' % report_name)
data = open('/tmp/%s.gz' % report_name).readlines()[0]
return data
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 651, in __init__
self.finish()
File "/usr/lib/python2.7/SocketServer.py", line 710, in finish
self.wfile.close()
File "/usr/lib/python2.7/socket.py", line 279, in close
self.flush()
File "/usr/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
File "/usr/local/lib/python2.7/dist-packages/gevent-1.0b2-py2.7-linux-x86_64.egg/gevent/socket.py", line 468, in sendall
data_sent += self.send(_get_memory(data, data_sent), flags)
File "/usr/local/lib/python2.7/dist-packages/gevent-1.0b2-py2.7-linux-x86_64.egg/gevent/socket.py", line 439, in send
return sock.send(data, flags)
error: [Errno 32] Broken pipe
127.0.0.1 - - [26/May/2016 03:29:03] "GET /api/driver/report/download/7000_upload_.json HTTP/1.1" 500 -
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/usr/local/lib/python2.7/dist-packages/Flask_RESTful-0.3.5-py2.7.egg/flask_restful/__init__.py", line 271, in error_router
return original_handler(e)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/Flask_RESTful-0.3.5-py2.7.egg/flask_restful/__init__.py", line 268, in error_router
return self.handle_error(e)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python2.7/dist-packages/Flask_RESTful-0.3.5-py2.7.egg/flask_restful/__init__.py", line 271, in error_router
return original_handler(e)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/Flask_RESTful-0.3.5-py2.7.egg/flask_restful/__init__.py", line 268, in error_router
return self.handle_error(e)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python2.7/dist-packages/Flask_RESTful-0.3.5-py2.7.egg/flask_restful/__init__.py", line 481, in wrapper
return self.make_response(data, code, headers=headers)
File "/usr/local/lib/python2.7/dist-packages/Flask_RESTful-0.3.5-py2.7.egg/flask_restful/__init__.py", line 510, in make_response
resp = self.representations[mediatype](data, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/Flask_RESTful-0.3.5-py2.7.egg/flask_restful/representations/json.py", line 20, in output_json
dumped = dumps(data, **settings) + "\n"
File "/usr/lib/python2.7/json/__init__.py", line 250, in dumps
sort_keys=sort_keys, **kw).encode(obj)
File "/usr/lib/python2.7/json/encoder.py", line 201, in encode
return encode_basestring_ascii(o)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x8b in position 1: invalid start byte
Zipped data is binary, so, readlines probably only reads corrupted data.
You can use python module gzip, without the need of any external program:
import gzip
class report_download(Resource):
def get(self,report_name):
conn = boto.connect_s3(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
bucket = conn.get_bucket(bucketname)
key = Key(bucket, report_name)
contents = key.get_contents_as_string()
data = StringIO.StringIO()
zip = gzip.GzipFile(fileobj=data, mode='wb')
zip.write(contents)
zip.close()
return Response(data.getvalue(), mimetype='application/x-gzip')
I'm trying to create a small flask application using the Enferno framework, but when I try to register a user I get an error that seems to be generated by the passlib library. I can't understand if it's something I did or if it is an error in the library itself.
Here's the full traceback:
Traceback (most recent call last):
File "/home/el3k0n/.local/lib/python3.4/site-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/home/el3k0n/.local/lib/python3.4/site-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/home/el3k0n/.local/lib/python3.4/site-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/el3k0n/.local/lib/python3.4/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/home/el3k0n/.local/lib/python3.4/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/home/el3k0n/.local/lib/python3.4/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/el3k0n/.local/lib/python3.4/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/el3k0n/.local/lib/python3.4/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/home/el3k0n/.local/lib/python3.4/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/home/el3k0n/.local/lib/python3.4/site-packages/flask_debugtoolbar/__init__.py", line 125, in dispatch_request
return view_func(**req.view_args)
File "/home/el3k0n/.local/lib/python3.4/site-packages/flask_security/decorators.py", line 205, in wrapper
return f(*args, **kwargs)
File "/home/el3k0n/.local/lib/python3.4/site-packages/flask_security/views.py", line 117, in register
user = register_user(**form.to_dict())
File "/home/el3k0n/.local/lib/python3.4/site-packages/flask_security/registerable.py", line 28, in register_user
kwargs['password'] = encrypt_password(kwargs['password'])
File "/home/el3k0n/.local/lib/python3.4/site-packages/flask_security/utils.py", line 151, in encrypt_password
return _pwd_context.encrypt(signed)
File "/home/el3k0n/.local/lib/python3.4/site-packages/passlib/context.py", line 2495, in encrypt
return self._get_record(scheme, category).encrypt(secret, **kwds)
File "/home/el3k0n/.local/lib/python3.4/site-packages/passlib/utils/handlers.py", line 558, in encrypt
self.checksum = self._calc_checksum(secret)
File "/home/el3k0n/.local/lib/python3.4/site-packages/passlib/handlers/bcrypt.py", line 285, in _calc_checksum
return self._calc_checksum_backend(secret)
File "/home/el3k0n/.local/lib/python3.4/site-packages/passlib/utils/handlers.py", line 1458, in _calc_checksum_backend
return self._calc_checksum_backend(secret)
File "/home/el3k0n/.local/lib/python3.4/site-packages/passlib/handlers/bcrypt.py", line 333, in _calc_checksum_pybcrypt
hash = _bcrypt.hashpw(secret, config)
TypeError: hashpw() argument 1 must be str, not bytes
I just ran into this. Turns out, I had installed both bcrypt and python-bcrypt in my virtualenv. passlib.hash.bcrypt has a check to see which version on bcrypt is present. By removing the python-bcrypt, I was able to cease this error from being thrown.