Quantika14 / osint-suite-tools

Repositorio del conjunto de herramientas para hacer OSINT y SOCMINT con Dante's Gates Minimal Version.
GNU General Public License v3.0
135 stars 33 forks source link

File path error with reports.py #13

Open AiAiWilly opened 3 months ago

AiAiWilly commented 3 months ago

In the html_ reports module the reports.py has the following code:

`

If no custom path, use one of the predefined templates

    if template_path is None:
        relative_uri = f"html_reports/templates/{template_name}.html"

        template_uri = os.sep.join(
            [easydev.get_package_location("html_reports")] + relative_uri.split("/")
        )

` Which results in following error on execution of the script:

NotADirectoryError: [Errno 20] Not a directory: '/home/%user%/.local/lib/python3.10/site-packages/html_reports/ __init__.py /html_reports/templates/simple.html'

In my case anyway :-)

AiAiWilly commented 3 months ago

This is what solved the problem for me in the end...

Problem 1: My system: linux/ubuntu on wsl Problem 2: Easydev get package location is used/designed for installations, going to the __init__ file, in my case anyway Problem 3: Double "html_reports" directory, coming from easydev and repeated in the original relative_uri

` if template_path is None: relative_uri = f"templates/{template_name}.html"

        uribase_1 = os.sep.join([easydev.get_package_location("html_reports")])

        uribase_2 = os.path.dirname (uribase_1)

        template_uri = os.path.join(uribase_2, relative_uri)

`

uribase_1 unpack file path of desired installation package uribase_2 strip __init__ file from path os.path.join is a smarter way to join paths, according to documentation