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

mplotqueries with --group-limit throws error in Python 3.x #688

Closed
chrisbenseler opened this issue May 28, 2019 · 3 comments
Closed

mplotqueries with --group-limit throws error in Python 3.x #688

chrisbenseler opened this issue May 28, 2019 · 3 comments
Assignees
Milestone

Comments

@chrisbenseler
Copy link

When trying to use mplotqueries and group-limit, the output is an error

The command:
mplotqueries /var/log/mongodb/mongod.log --output-file mongodb.png --group-limit 10

The output:
File "/home/azbvlab/mongodbanalyzer/venv/lib/python3.6/site-packages/mtools/util/grouping.py", line 120, in sort_by_size
group_keys = self.groups.keys()[group_limit - 1:]
TypeError: 'odict_keys' object is not subscriptable

I cannot reproduce this error in my local environment, only with the log file created by the mongodb in an Ubuntu instance I run on Azure. MongoDB is on 3,4,16, Python is 3.6
Other mtools commands work fine, the problem is when I try to limit the mplotqueries.

@stennie
Copy link
Collaborator

stennie commented May 28, 2019

@chrisbenseler To help reproduce this issue can you please provide:

  • a snippet of log lines that results in the error
  • the output of mplotqueries --version in the environment that has the error as well as your local environment

I suspect the error is related to the Python version rather than the MongoDB server version, but since you have working and non-working environments it would be useful to confirm any obvious differences.

Thanks,
Stennie

@stennie stennie self-assigned this May 28, 2019
@stennie stennie added this to the 1.5.4 milestone May 28, 2019
stennie added a commit to stennie/mtools that referenced this issue May 28, 2019
@stennie
Copy link
Collaborator

stennie commented May 28, 2019

@chrisbenseler As suspected this looks like a straightforward compatibility issue with Python 3, but any extra info would still be helpful to confirm.

Regards,
Stennie

@stennie stennie changed the title mplotqueries with group-limit throws error mplotqueries with --group-limit throws error in Python 3.x May 28, 2019
@chrisbenseler
Copy link
Author

Hi @stennie

mplotqueries --version outputs:

mtools version 1.5.3 || Python 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0]

The error in the console is this one, it does not show the log lines with the problem. If needed, I can attach the complete log file.

Traceback (most recent call last):
File "/home/azbvlab/mongodbanalyzer/venv/bin/mplotqueries", line 11, in
load_entry_point('mtools==1.5.3', 'console_scripts', 'mplotqueries')()
File "/home/azbvlab/mongodbanalyzer/venv/lib/python3.6/site-packages/mtools/mplotqueries/mplotqueries.py", line 681, in main
tool.run()
File "/home/azbvlab/mongodbanalyzer/venv/lib/python3.6/site-packages/mtools/mplotqueries/mplotqueries.py", line 130, in run
self.group()
File "/home/azbvlab/mongodbanalyzer/venv/lib/python3.6/site-packages/mtools/mplotqueries/mplotqueries.py", line 254, in group
plot_inst.group()
File "/home/azbvlab/mongodbanalyzer/venv/lib/python3.6/site-packages/mtools/mplotqueries/plottypes/base_type.py", line 91, in group
discard_others=self.args['no_others'])
File "/home/azbvlab/mongodbanalyzer/venv/lib/python3.6/site-packages/mtools/util/grouping.py", line 120, in sort_by_size
group_keys = self.groups.keys()[group_limit - 1:]
TypeError: 'odict_keys' object is not subscriptable

savinay-vijay pushed a commit to savinay-vijay/mtools that referenced this issue Jul 16, 2019
savinay-vijay pushed a commit to savinay-vijay/mtools that referenced this issue Jul 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants