I'm working with a script that retrieves Apache server status using Python on Ubuntu 22.04 with Python 3.12.3. The script runs inside the BTPanel environment and encounters this error:
TypeError: expected string or bytes-like object, got 'bool'
The error is showing as such:
File "/www/server/panel/BTPanel/__init__.py", line 2683, in publicObject
return run_exec().run(toObject, defs, get)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/www/server/panel/BTPanel/__init__.py", line 2629, in run
result = getattr(toObject, get.action)(get)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/www/server/panel/class/ajax.py", line 17, in GetApacheStatus
return a.GetApacheStatus()
^^^^^^^^^^^^^^^^^^^
File "/www/server/panel/class/apache.py", line 55, in GetApacheStatus
Uptime = re.search(r"ServerUptimeSeconds:\s+(.*)",result)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/www/server/panel/pyenv/lib/python3.12/re/__init__.py", line 177, in search
return _compile(pattern, flags).search(string)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'bool'
Why do this show like this and how to solve this?