Traceback (most recent call last):
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\engine\base.py", line 2147, in _wrap_pool_connect
return fn()
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\pool.py", line 387, in connect
return _ConnectionFairy._checkout(self)
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\pool.py", line 766, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\pool.py", line 516, in checkout
rec = pool._do_get()
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\pool.py", line 1229, in _do_get
return self._create_connection()
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\pool.py", line 333, in _create_connection
return _ConnectionRecord(self)
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\pool.py", line 461, in __init__
self.__connect(first_connect_check=True)
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\pool.py", line 651, in __connect
connection = pool._invoke_creator(self)
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\engine\strategies.py", line 105, in connect
return dialect.connect(*cargs, **cparams)
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\engine\default.py", line 393, in connect
return self.dbapi.connect(*cargs, **cparams)
sqlite3.OperationalError: unable to open database file
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
chatbot = ChatBot("Ron Obvious")
File "C:\Program Files\Python35\lib\site-packages\chatterbot\chatterbot.py", line 41, in __init__
self.storage = utils.initialize_class(storage_adapter, **kwargs)
File "C:\Program Files\Python35\lib\site-packages\chatterbot\utils.py", line 33, in initialize_class
return Class(**kwargs)
File "C:\Program Files\Python35\lib\site-packages\chatterbot\storage\sql_storage.py", line 125, in __init__
if not self.engine.dialect.has_table(self.engine, 'StatementTable'):
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\dialects\sqlite\base.py", line 1181, in has_table
connection, "table_info", table_name, schema=schema)
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\dialects\sqlite\base.py", line 1567, in _get_table_pragma
cursor = connection.execute(statement)
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\engine\base.py", line 2063, in execute
connection = self.contextual_connect(close_with_result=True)
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\engine\base.py", line 2112, in contextual_connect
self._wrap_pool_connect(self.pool.connect, None),
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\engine\base.py", line 2151, in _wrap_pool_connect
e, dialect, self)
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\engine\base.py", line 1465, in _handle_dbapi_exception_noconnection
exc_info
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\util\compat.py", line 203, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\util\compat.py", line 186, in reraise
raise value.with_traceback(tb)
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\engine\base.py", line 2147, in _wrap_pool_connect
return fn()
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\pool.py", line 387, in connect
return _ConnectionFairy._checkout(self)
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\pool.py", line 766, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\pool.py", line 516, in checkout
rec = pool._do_get()
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\pool.py", line 1229, in _do_get
return self._create_connection()
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\pool.py", line 333, in _create_connection
return _ConnectionRecord(self)
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\pool.py", line 461, in __init__
self.__connect(first_connect_check=True)
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\pool.py", line 651, in __connect
connection = pool._invoke_creator(self)
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\engine\strategies.py", line 105, in connect
return dialect.connect(*cargs, **cparams)
File "C:\Program Files\Python35\lib\site-packages\sqlalchemy\engine\default.py", line 393, in connect
return self.dbapi.connect(*cargs, **cparams)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
chatbot = ChatBot("Ron Obvious")
After this statement
@Monisha9255 Usually sqlite db file will created in current directory. Due to lack of permission sqlite unable to create db.sqlite3 file on your current directory.
And also you are trying through pyshell May be sqlite3 doesn't have permission to create db.sqlite3 Could you please try where you write permission to create files.
@vkosuri @gunthercox I'm also having this problem, but I've used chmod and 000-default.conf to open up all the permissions for the app's directory and nothing has changed.
My error:
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/strategies.py", line 106, in connect
return dialect.connect(*cargs, **cparams)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 410, in connect
return self.dbapi.connect(*cargs, **cparams)
OperationalError: (sqlite3.OperationalError) unable to open database file (Background on this error at: http://sqlalche.me/e/e3q8)
Any suggestions?
I unable to figured to problem could you let me know
@vkosuri Thanks for looking in!
mod_wsgi (pid=21196): Target WSGI script '/home/ahuston/public_html/wsgi/helloworld.wsgi' cannot be loaded as Python module.
mod_wsgi (pid=21196): Exception occurred processing WSGI script '/home/ahuston/public_html/wsgi/helloworld.wsgi'.
Traceback (most recent call last):
File "/home/ahuston/public_html/wsgi/helloworld.wsgi", line 3, in <module>
from helloworld import app as application
File "/home/ahuston/public_html/apps/flasktest/helloworld.py", line 9, in <module>
english_bot = ChatBot("d3")
File "/usr/local/lib/python2.7/dist-packages/chatterbot/chatterbot.py", line 39, in __init__
self.storage = utils.initialize_class(storage_adapter, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/chatterbot/utils.py", line 33, in initialize_class
return Class(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/chatterbot/storage/sql_storage.py", line 77, in __init__
if not self.engine.dialect.has_table(self.engine, 'Statement'):
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/dialects/sqlite/base.py", line 1181, in has_table
connection, "table_info", table_name, schema=schema)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/dialects/sqlite/base.py", line 1572, in _get_table_pragma
cursor = connection.execute(statement)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 2074, in execute
connection = self.contextual_connect(close_with_result=True)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 2123, in contextual_connect
self._wrap_pool_connect(self.pool.connect, None),
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 2162, in _wrap_pool_connect
e, dialect, self)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1476, in _handle_dbapi_exception_noconnection
exc_info
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 2158, in _wrap_pool_connect
return fn()
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 403, in connect
return _ConnectionFairy._checkout(self)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 784, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 532, in checkout
rec = pool._do_get()
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 1280, in _do_get
return self._create_connection()
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 350, in _create_connection
return _ConnectionRecord(self)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 477, in __init__
self.__connect(first_connect_check=True)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 667, in __connect
connection = pool._invoke_creator(self)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/strategies.py", line 106, in connect
return dialect.connect(*cargs, **cparams)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 410, in connect
return self.dbapi.connect(*cargs, **cparams)
OperationalError: (sqlite3.OperationalError) unable to open database file (Background on this error at: http://sqlalche.me/e/e3q8)
The permissions:
ahuston@webserver01:~$ ls -l public_html
total 20
drwxr-xr-x 3 ahuston www-data 4096 Mar 23 12:30 apps
drwxr-xr-x 2 ahuston www-data 4096 Mar 25 00:38 http
drwxr-xr-x 2 ahuston www-data 4096 Mar 17 00:22 https
drwxr-xr-x 2 ahuston www-data 4096 Mar 17 01:14 logs
drwxr-xr-x 2 ahuston www-data 4096 Mar 23 12:01 wsgi
I believe it an operating system error nkt chatterbot issue.
This link will solve your problem https://severfault.com/a/57597
@vkosuri Thanks for the help - those were good links
I think you're totally right, it's the operating system
Changing permissions wasn't the answer, though
@gunthercox Instead of letting chatterbot create a new database, I moved the database it created for itself on my local machine while I was testing it to the app's current directory on the live server
It was able to access that file and has been humming along happily since!
Glad to hear your problem resolved, If possible could you make a PR with your suggestions?
@adamjameshuston Can you please elaborate how did you move the databse
try with sudo , it worked for me.
@Monisha9255 Usually
sqlite dbfile will created incurrent directory. Due to lack of permission sqlite unable to createdb.sqlite3file on your current directory.And also you are trying through
pyshellMay besqlite3doesn't have permission to createdb.sqlite3Could you please try where you write permission to create files.
try to run using sudo, it will work
1) Verify your database path, check in your settings.py
DATABASES = {
'default': {
'CONN_MAX_AGE': 0,
'ENGINE': 'django.db.backends.sqlite3',
'HOST': 'localhost',
'NAME': os.path.join(BASE_DIR, 'project.db'),
'PASSWORD': '',
'PORT': '',
'USER':''
some times there wont be NAME': os.path.join(BASE_DIR, 'project.db'),
2)Be sure for the permission and ownership to destination folder
it worked for me,
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
@Monisha9255 Usually
sqlite dbfile will created incurrent directory. Due to lack of permission sqlite unable to createdb.sqlite3file on your current directory.And also you are trying through
pyshellMay besqlite3doesn't have permission to createdb.sqlite3Could you please try where you write permission to create files.