aboutcode-org / scancode-toolkit

:mag: ScanCode detects licenses, copyrights, dependencies by "scanning code" ... to discover and inventory open source and third-party packages used in your code. Sponsored by NLnet project https://nlnet.nl/project/vulnerabilitydatabase, the Google Summer of Code, Azure credits, nexB and others generous sponsors!
https://github.com/aboutcode-org/scancode-toolkit/releases/
2.07k stars 537 forks source link

json2csv doesn't work with deltacode output #1074

Closed chinyeungli closed 6 years ago

chinyeungli commented 6 years ago

I get the following error when trying to use json2csv with the deltacode scan output

Traceback (most recent call last):
  File "etc\scripts\json2csv.py", line 265, in <module>
    cli()
  File "C:\Users\CYL\git\scancode-toolkit\lib\site-packages\click\core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\CYL\git\scancode-toolkit\lib\site-packages\click\core.py", line 697, in main
    rv = self.invoke(ctx)
  File "C:\Users\CYL\git\scancode-toolkit\lib\site-packages\click\core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\CYL\git\scancode-toolkit\lib\site-packages\click\core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "etc\scripts\json2csv.py", line 261, in cli
    json_scan_to_csv(json_input, csv_output, prefix_path, include_text)
  File "etc\scripts\json2csv.py", line 73, in json_scan_to_csv
    scan_results = load_scan(json_input)
  File "etc\scripts\json2csv.py", line 63, in load_scan
    scan_results = scan_results['files']
KeyError: u'files'
steven-esser commented 6 years ago

@chinyeungli Try using the json2csv.py script found in DeltaCode instead. That one should work.

https://github.com/nexB/deltacode/blob/develop/etc/scripts/json2csv.py

steven-esser commented 6 years ago

Closing this for now. @chinyeungli you can re-open this ticket in DelaCode if its own json2csv script fails.

chinyeungli commented 6 years ago

@majurg I didn't know DeltaCode has its own json2csv. I tried it and it works. Thanks.