Cortex4py icon indicating copy to clipboard operation
Cortex4py copied to clipboard

cortex4py libmagic error on Windows systems

Open cyberenergy opened this issue 1 year ago • 0 comments

Dear devs, cortex4py 2.1.0 fails on Windows clients with this error when installed out of the box

tests\conftest.py:9:` in <module>
[REDACTED].tox\testing\Lib\site-packages\cortex4py\api.py:9: in <module>
    from .controllers.organizations import OrganizationsController
.tox\testing\Lib\site-packages\cortex4py\controllers\__init__.py:6: in <module>
    from .analyzers import AnalyzersController
.tox\testing\Lib\site-packages\cortex4py\controllers\analyzers.py:3: in <module>
    import magic
.tox\testing\Lib\site-packages\magic\__init__.py:209: in <module>
    libmagic = loader.load_lib()
.tox\testing\Lib\site-packages\magic\loader.py:49: in load_lib
    raise ImportError('failed to find libmagic.  Check your installation')
E   ImportError: failed to find libmagic.  Check your installation

Windows requires another package to run and it can be solved by un- then installing a different package:

pip uninstall python-magic
pip install python-magic-bin

Nevertheless, this leads to cortex4py not running out of the box on Windows systems and making it not OS-independent. While there is a solution, it adds additional complexity when using tools such as tox across different OS.

I found the solution here, it has been fixed long ago in thehive4py as it seems: ImportError: failed to find libmagic. Check your installation

Thank you for taking note.

cyberenergy avatar Nov 14 '24 15:11 cyberenergy