Reputation: 67
I'm trying to read Mac OS ASL log file with Python by using this asl package. I think the package is successfully installed but I can't import it. Below are the error messages:
Traceback (most recent call last): File "", line 1, in File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 20, in do_import module = self._system_import(name, *args, **kwargs) File "/Users/serenasmac1/PycharmProjects/Test2/venv/lib/python3.5/site-packages/asl/__init__.py", line 8, in from ._asl import * File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 20, in do_import module = self._system_import(name, *args, **kwargs) ImportError: No module named 'asl._asl'
As far as I understood, init.py is calling a ._asl module but it doesn't exist. Is my understanding correct? How can I fix it?
Also, I've found this script which seems can read asl file. I'm trying it in parallel. I've searched a lot but only found this script and the ASL package. I'd really appreciate if anybody can share the knowledge of how to read asl file with Python. Thanks a lot!
Here is the how the package was installed:
Upvotes: 3
Views: 1550
Reputation: 27594
It looks like the asl package is actually broken. I'd use the syslog
executable that ships with OSX:
from subprocess import check_output
cmd = 'syslog -f /private/var/log/asl/2018.04.03.U501.asl'
log = check_output(cmd.split())
print(log)
Upvotes: 4