scancode-toolkit icon indicating copy to clipboard operation
scancode-toolkit copied to clipboard

Scan Result in error (JSONLINES)

Open oferprtz-atbay opened this issue 2 years ago • 2 comments

Description

Please leave a brief description of the bug or feature request: When scan finished on the entire repo, we have got an error that shows the following:

Filter scans...
 Filter scan: licenses...
 Filter scan: copyrights...
Save scan results...
 Save scan results as: jsonlines...
ERROR: failed to run output plugin: jsonlines:
Traceback (most recent call last):
  File "/home/runner/.local/lib/python3.10/site-packages/click/utils.py", line 152, in open
    rv, self.should_close = open_stream(
  File "/home/runner/.local/lib/python3.10/site-packages/click/_compat.py", line 404, in open_stream
    return _wrap_io_open(filename, mode, encoding, errors), True
  File "/home/runner/.local/lib/python3.10/site-packages/click/_compat.py", line 379, in _wrap_io_open
    return open(file, mode, encoding=encoding, errors=errors)
IsADirectoryError: [Errno 21] Is a directory: 'scan'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/runner/.local/lib/python3.10/site-packages/scancode/cli.py", line 1081, in run_codebase_plugins
    plugin.process_codebase(codebase, **kwargs)
  File "/home/runner/.local/lib/python3.10/site-packages/formattedcode/output_jsonlines.py", line 47, in process_codebase
    output_json_lines.write(
  File "/home/runner/.local/lib/python3.10/site-packages/click/utils.py", line 137, in __getattr__
    return getattr(self.open(), name)
  File "/home/runner/.local/lib/python3.10/site-packages/click/utils.py", line 158, in open
    raise FileError(self.name, hint=e.strerror) from e
click.exceptions.FileError: Is a directory

Scanning done.
Summary:        licenses, copyrights with 1 process(es)
Errors count:   0
Scan Speed:     4.30 files/sec. 
Initial counts: 3048 resource(s): 2068 file(s) and 980 directorie(s) 
Final counts:   3048 resource(s): 2068 file(s) and 980 directorie(s) 
Timings:
  scan_start: 2023-06-01T150512.741215
  scan_end:   2023-06-01T151317.813026
  setup_scan:licenses: 3.35s
  setup: 3.35s
  inventory: 0.59s
  scan:licenses: 0.26s
  scan: 480.58s
  total: 485.18s
Removing temporary files...done.

How To Reproduce

Tell us how to reproduce the issue.

scancode -clv --json-lines scan $GITHUB_WORKSPACE

System configuration

For bug reports, it really helps us to know:

  • What OS are you running on? (Windows/MacOS/Linux)
  • What version of scancode-toolkit was used to generate the scan file?
  • What installation method was used to install/run scancode? (pip/source download/other)

Running via Github actions, running on ubuntu 20.04 runner toolkit version: 32.0.2

oferprtz-atbay avatar Jun 01 '23 15:06 oferprtz-atbay

@oferprtz-atbay Thanks for the report! I wonder if the message - albeit obscure - may not provide a decent hint on the problem: IsADirectoryError: [Errno 21] Is a directory: 'scan'

I assume that you used this option --json-lines scan and the issue is that scan is a directory. You should use a path to a file instead and this may solve your issue.

pombredanne avatar Jun 02 '23 08:06 pombredanne

Related to the bugs referenced in #3609.

armijnhemel avatar Dec 05 '23 17:12 armijnhemel