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

Wrong type for "--count" arg #3

Open
bioex opened this issue Oct 14, 2019 · 1 comment
Open

Wrong type for "--count" arg #3

bioex opened this issue Oct 14, 2019 · 1 comment

Comments

@bioex
Copy link

bioex commented Oct 14, 2019

The "--count" argument does not really work:

# python /var/tmp/bind-query-log-stats.py --count 10 /var/log/dns/query.log
Processing logfile /var/log/dns/query.log

<skip>

Top  ['10']  DNS names requested:
Traceback (most recent call last):
  File "/var/tmp/bind-query-log-stats.py", line 265, in <module>
    print_top_dns_requests(COUNT)
  File "/var/tmp/bind-query-log-stats.py", line 97, in print_top_dns_requests
    for query, _ in Counter(DNS_QUERIES).most_common(num_print):
  File "/usr/lib64/python2.7/collections.py", line 462, in most_common
    return _heapq.nlargest(n, self.iteritems(), key=_itemgetter(1))
  File "/usr/lib64/python2.7/heapq.py", line 465, in nlargest
    result = _nlargest(n, it)
TypeError: an integer is required
@asiminiceanu
Copy link

asiminiceanu commented Aug 29, 2023

@bioex remove nargs=1, from the line below and add type=int

parser.add_argument('--count', help="Number of entries to display",
                    default=100, type=int, metavar="Count")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants