Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotImplementedError("Use of template is not supported in XSLX-output.") even though --template is not provided #2

Closed
moxli opened this issue Jul 5, 2019 · 10 comments

Comments

@moxli
Copy link

commented Jul 5, 2019

Hello,

I am encountering the following problem.

Command: python3 -m openvasreporting --input *.xml --format xlsx --output report.xlsx

Error: Traceback (most recent call last): File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/mdorner/.local/lib/python3.7/site-packages/openvasreporting/__main__.py", line 17, in <module> main() File "/home/mdorner/.local/lib/python3.7/site-packages/openvasreporting/openvasreporting.py", line 32, in main convert(config) File "/home/mdorner/.local/lib/python3.7/site-packages/openvasreporting/openvasreporting.py", line 88, in convert exporters()[config.filetype](openvas_info, config.template, config.output_file) File "/home/mdorner/.local/lib/python3.7/site-packages/openvasreporting/libs/export.py", line 60, in export_to_excel raise NotImplementedError("Use of template is not supported in XSLX-output.") NotImplementedError: Use of template is not supported in XSLX-output.

Replacing the following line with print("1") or sleep 1 is my current workaround ^^

raise NotImplementedError("Use of template is not supported in XSLX-output.")

This check should clearly not result in 'True' because neither '-t' or '--template' are passed to openvasreporting.

if template is not None:

I have installed openvasreporting via pip:
pip3 install OpenVAS-Reporting

My current version is 1.4.3:
pip3 freeze | grep OpenVAS OpenVAS-Reporting==1.4.3

Am I doing something wrong, because looking at the code 'template' is set to 'None' per default everywhere?

@TheGroundZero

This comment has been minimized.

Copy link
Owner

commented Jul 5, 2019

Very weird indeed. If you don't pass a template param you shouldn't be receiving this error.

I'll try to free up some time to look into this

@TheGroundZero TheGroundZero self-assigned this Jul 5, 2019

@TheGroundZero TheGroundZero added the bug label Jul 5, 2019

@moxli

This comment has been minimized.

Copy link
Author

commented Jul 5, 2019

Thanks!

FYI my Python version is: Python 3.7.3

@TheGroundZero

This comment has been minimized.

Copy link
Owner

commented Jul 10, 2019

What's weird is that I'm not getting this error.
I'm on Linux, running Python 3.7.3 as well.

Are you running on Windows or on Linux?
Not sure there is/would be logical difference causing this issue between OSes.

I could follow the suggestion in #3 and remove the check resulting in this error. However, I'd like to keep it for the sake of informing a user that might incorrectly assume that a template features is available in each of the export formats.

@moxli

This comment has been minimized.

Copy link
Author

commented Jul 10, 2019

I am running on Linux.
I will try to reproduce it on a different machine.

@moxli

This comment has been minimized.

Copy link
Author

commented Jul 22, 2019

So I was able to reproduce this behavior in a Debian 10 Buster container.

@moxli

This comment has been minimized.

Copy link
Author

commented Jul 25, 2019

A colleague of mine was able to reproduce it with the pip package & python 3.7.3 on MacOS.

@TheGroundZero

This comment has been minimized.

Copy link
Owner

commented Jul 25, 2019

Thanks you for verifying this odd behaviour.

Sadly enough, I haven't had the time to dig deeper into this.

The code sets default to Null and check for the param not being Null, so it doesn't make sense that this is triggering.
The current workaround would be to remove the check completely, which I may do until I find a working solution.

TheGroundZero pushed a commit that referenced this issue Jul 25, 2019

See issue #2
Set default value for Template parameter to None

@TheGroundZero TheGroundZero reopened this Jul 25, 2019

@TheGroundZero

This comment has been minimized.

Copy link
Owner

commented Jul 25, 2019

Can you test with the last commit?

Testing on a recent Ubuntu install:

$ python3 --version
Python 3.7.3

$ pip3 freeze | grep -i openvas
OpenVAS-Reporting==1.4.4

$ python3 -m openvasreporting -i test/report.xml -o test/report -f xlsx

$ ls test
report.xml
report.xlsx
@moxli

This comment has been minimized.

Copy link
Author

commented Jul 26, 2019

Ok for testing purposes I am using a Docker container with the official Python image (latest).

I am getting the following error on all systems (local, kubernetes docker with debian 10, python official image):

root@880549ee3d81:/# python3 -m openvasreporting -i *.xml -o report.xlsx -f xlsx Traceback (most recent call last): File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/local/lib/python3.7/site-packages/openvasreporting/__main__.py", line 6, in <module> from openvasreporting.openvasreporting import main File "/usr/local/lib/python3.7/site-packages/openvasreporting/openvasreporting.py", line 9, in <module> from .libs.config import Config ModuleNotFoundError: No module named 'openvasreporting.libs'

root@880549ee3d81:/# pip freeze | grep OpenVAS OpenVAS-Reporting==1.4.4

@TheGroundZero

This comment has been minimized.

Copy link
Owner

commented Jul 26, 2019

That's weird.
I had similar errors when running from the pip install (running openvasreporting instead of python3 -m openvasreporting). See #4 for a similar issue.

On the template error:
I don't appear to get that error when running from the openvasreporting folder.
If I run python3 -m openvasreporting -i *.xml -o report from the repo base folder, it works fine. Running it from any other folder (e.g. home) results in the error NotImplementedError: Use of template is not supported in XSLX-output.
Which makes this all even more confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.