modsecurity-parser icon indicating copy to clipboard operation
modsecurity-parser copied to clipboard

plt.subplot(ax21) : Function is expecting a three-digit integer instead of an Axes object.

Open jacquesdarga opened this issue 1 year ago • 4 comments

Running from windows 11 : python3 modsecurity_parser.py --version3 -f modsec_audit.log -x output.xlsx

Traceback (most recent call last): File "C:\Users\HP\Documents\Coding\Python\modsecurity-parser\modsecurity_parser.py", line 864, in output_with_graphs = modsec_view_graphs(modsec_entries) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\HP\Documents\Coding\Python\modsecurity-parser\modsecurity_parser.py", line 565, in modsec_view_graphs plt.subplot(ax21) File "C:\Users\HP\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\matplotlib\pyplot.py", line 1529, in subplot key = SubplotSpec._from_subplot_args(fig, args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\HP\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\matplotlib\gridspec.py", line 564, in _from_subplot_args raise ValueError( ValueError: Single argument to subplot must be a three-digit integer, not <Axes: >

jacquesdarga avatar Jul 03 '24 14:07 jacquesdarga

Please use Python 3.10 and install libraries from requirements.txt.

molu8bits avatar Jul 14 '24 19:07 molu8bits

Please use Python 3.10 and install libraries from requirements.txt.

Okay I'll give it a shot, then I'll come back to you.

jacquesdarga avatar Jul 14 '24 22:07 jacquesdarga

Please use Python 3.10 and install libraries from requirements.txt.

I tried this and it still comes back with the same error.

deathsfaction avatar Jul 15 '24 14:07 deathsfaction

Same issue running on Fedora 41 Linux.

input_filename: ./modsec_audit.log ----- modsec_audit events processed: 22 ----- ----- modsec_audit events skipped by INCLUDED/EXCLUDED options or INVALID: 0 ----- Traceback (most recent call last): File "/local/modsecurity-parser/modsecurity-parser-0.5.0/modsecurity_parser.py", line 864, in output_with_graphs = modsec_view_graphs(modsec_entries) File "/local/modsecurity-parser/modsecurity-parser-0.5.0/modsecurity_parser.py", line 565, in modsec_view_graphs plt.subplot(ax21) ~~~~~~~~~~~^^^^^^ File "/usr/lib64/python3.13/site-packages/matplotlib/pyplot.py", line 1534, in subplot key = SubplotSpec._from_subplot_args(fig, args) File "/usr/lib64/python3.13/site-packages/matplotlib/gridspec.py", line 564, in _from_subplot_args raise ValueError( f"Single argument to subplot must be a three-digit " f"integer, not {arg!r}") ValueError: Single argument to subplot must be a three-digit integer, not <Axes: >

I also tried on a system running an older version of Fedora which has python 3.10 installed but got a similar message.

$python3 -V Python 3.10.8 $ python3 modsecurity_parser.py -f ./modsec_audit.log input_filename: ./modsec_audit.log ----- modsec_audit events processed: 22 ----- ----- modsec_audit events skipped by INCLUDED/EXCLUDED options or INVALID: 0 ----- Traceback (most recent call last): File "/local/john.kissane/modsecurity-parser/modsecurity-parser-0.5.0/modsecurity_parser.py", line 864, in output_with_graphs = modsec_view_graphs(modsec_entries) File "/local/john.kissane/modsecurity-parser/modsecurity-parser-0.5.0/modsecurity_parser.py", line 565, in modsec_view_graphs plt.subplot(ax21) File "/usr/lib64/python3.10/site-packages/matplotlib/pyplot.py", line 1287, in subplot key = SubplotSpec._from_subplot_args(fig, args) File "/usr/lib64/python3.10/site-packages/matplotlib/gridspec.py", line 582, in _from_subplot_args raise ValueError( ValueError: Single argument to subplot must be a three-digit integer, not AxesSubplot:

I managed to find an even old system which had python 3.9 installed & it works on the version.

$python3 -V Python 3.9.7

Hope this helps.

kissanej avatar Feb 11 '25 14:02 kissanej