Home > front end >  How to fix the issue of {sqlite3.OperationalError: unable to open database file} in aws-ec2 instance
How to fix the issue of {sqlite3.OperationalError: unable to open database file} in aws-ec2 instance

Time:11-01

I am trying to deploy this telegram bot(https://github.com/odysseusmax/utube/) on AWS-ec2 instance which is using ubuntu-20. At the start everything is fine until I got this error:

sqlite3.OperationalError: unable to open database file

let me give some solution if you know how to solve this issue:

Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/ubuntu/project/Utube/bot/__main__.py", line 13, in <module>
    UtubeBot().run()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/pyrogram/methods/utilities/run.py", line 61, in run
    self.start()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/pyrogram/sync.py", line 56, in async_to_sync_wrap
    return loop.run_until_complete(coroutine)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/pyrogram/methods/utilities/start.py", line 53, in start
    is_authorized = await self.connect()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/pyrogram/methods/auth/connect.py", line 39, in connect
    await self.load_session()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/pyrogram/client.py", line 669, in load_session
    await self.storage.open()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/pyrogram/storage/file_storage.py", line 107, in open
    self.conn = sqlite3.connect(str(path), timeout=1, check_same_thread=False)
sqlite3.OperationalError: unable to open database file

I am using SESSION_NAME = os.environ.get("lethargic", ":memory:");

I tried all the way to deploy this bot. I have tried it on replit platform where i have to change the utube.py file session_name to name and everything worked fine. as we know replit is not free, using free tier of aws. on the aws machine i got this error.

CodePudding user response:

I think there is a error in repo that why i was getting this error. Sorry for interrupt you all. I have solved it with a fresh installation. Thank You!!

  • Related