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://aboutcode.org/scancode/
2.15k stars 553 forks source link

Scan Result in error (JSONLINES) #3420

Open oferprtz-atbay opened 1 year ago

oferprtz-atbay commented 1 year ago

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. 

<!-- Exact Commands -->
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

<!-- 
Your help makes ScanCode Toolkit better! We *deeply* appreciate your help in improving ScanCode Toolkit.
-->
pombredanne commented 1 year ago

@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.

armijnhemel commented 12 months ago

Related to the bugs referenced in #3609.