xros / jsonpyes

The tool which imports raw JSON to ElasticSearch in one line of commands
Other
67 stars 21 forks source link

Python 3.6 not support #41

Open vvip opened 5 years ago

vvip commented 5 years ago

[root@SZX1000522574 data]# python -V Python 3.6.8 [root@SZX1000522574 data]# jsonpyes --data 2019-04-19.json --check Traceback (most recent call last): File "/usr/local/bin/jsonpyes", line 588, in run() File "/usr/local/bin/jsonpyes", line 411, in run if job.has_key('data'): AttributeError: 'dict' object has no attribute 'has_key'

tdracz commented 5 years ago

Here's a quick fix for jsonpyes file:

Line 409 and next

    for job in process_jobs:
        if type(job) == dict:
            if 'data' in job:
                data = job['data']
            if 'bulk' in job:
                bulk = job['bulk']
            if 'index' in job:
                index = job['index']
            if 'type' in job:
                doc_type = job['type']
            if 'thread' in job:
                thread_amount = int(job['thread_amount'])
xros commented 5 years ago

@vvip @tdracz Fixed. Merged into master. https://github.com/xros/jsonpyes/pull/42 Thanks for the notice! Try jsonpyes 1.4.2+