First off, this is my first post so if my formatting, etiquette, etc. is off please let me know so I can correct it.
Second after an exhaustive google search I have not found a solution.
I am trying to troubleshoot a Python script. It is suppose to run in Python 3.6 and/or newer. I have tried different ways of trying to get it to run i.e. virtual environment, different Python versions (3.6 and 3.8 only), and different users, but it always fails with the same error below. I have checked the installed Python modules that should be the right ones, but am not convinced they may be the right ones needed.
Here is the script (sanitized of course):
import logging
from logstash_async.handler import AsynchronousLogstashHandler
host = 'serverA.xyz.com'
port = 3306
# Get you a test logger
test_logger = logging.getLogger('python-logstash-logger')
# Set it to whatever level you want - default will be info
test_logger.setLevel(logging.DEBUG)
# Create a handler for it
test_logger.addHandler(AsynchronousLogstashHandler(host, port, database_path=None))
# Add the handler to the logger
#test_logger.addHandler(handler)
# sending amessage
test_logger.info("This is a test Message")
This is the error I keep getting:
Traceback (most recent call last):
File "test_elk.py", line 3, in <module>
from logstash_async.handler import AsynchronousLogstashHandler
File "/opt/gpi-datalake/.local/lib/python3.8/site-packages/logstash_async/handler.py", line 11, in <module>
from logstash_async.worker import LogProcessingWorker
File "/opt/gpi-datalake/.local/lib/python3.8/site-packages/logstash_async/worker.py", line 17, in <module>
from logstash_async.database import DatabaseCache, DatabaseLockedError
File "/opt/gpi-datalake/.local/lib/python3.8/site-packages/logstash_async/database.py", line 7, in <module>
import sqlite3
ModuleNotFoundError: No module named 'sqlite3'
Modules required (based on exhaustive search):
Python versions tried (including Python virtual environments):
- Python 3.8.7
- Python 3.6.8
Environment:
- Red Hat Enterprise Linux Server release 7.9 (Maipo)
SQLite3 packages installed:
libsqlite3x.x86_64 20071018-20.el7 @epel
libsqlite3x-devel.x86_64 20071018-20.el7 @epel
python-sqlite3dbm.noarch 0.1.4-6.el7 @epel
sqlite.x86_64 3.7.17-8.el7_7.1 @rhel-x86_64-server-7
sqlite-devel.x86_64 3.7.17-8.el7_7.1 @rhel-7-server-rpms
Thanks in advance.