aboutcode-org / aboutcode-org/scancode-toolkit

Strange error statement: Some characters could not be decoded, and were replaced with REPLACEMENT CHARACTER.\n

Open
#1,873 12 comments 0 reactions 0 assignees View on GitHub
bug license scan
Dominant language
Python
Stars
2.6k
Forks
791
Avg merge
1d 12h
Merged PRs (30d)
5

Description

### Description
I ran a scan on what looks like a minimized Debian filesystem (I got it from a Docker container):
`scancode -lpcu --quiet --json - /path/to/filesystem`
Before it spits out the giant json object it gives this message:
`Some characters could not be decoded, and were replaced with REPLACEMENT CHARACTER.\n`

When running without `--quiet` I get this message:
```
Scanning done.
Some files failed to scan properly:
Path: contents/usr/share/doc/gpgv/copyright
Path: contents/usr/share/doc/libgcrypt20/copyright
```
I don't see any issue with these two files.

When running the scan on just these two files I don't get the above "some characters could not be decoded" but it does give a scan error:
```
"ERROR: for scanner: licenses:\nERROR: Unknown error:\nTraceback (most recent call last):\n File \"/home/nisha/scancodeenv/lib/python3.6/site-packages/scancode/interrupt.py\", line 92, in interruptible\n return NO_ERROR, func(*(args or ()), **(kwargs or {}))\n File \"/home/nisha/scancodeenv/lib/python3.6/site-packages/scancode/api.py\", line 211, in get_licenses\n _licenses_data_from_match(match, matched_text, license_url_template)\n File \"/home/nisha/scancodeenv/lib/python3.6/site-packages/scancode/api.py\", line 234, in _licenses_data_from_match\n result['key'] = lic.key\nAttributeError: 'NoneType' object has no attribute 'key'\n"]}
```

### System configuration

System: Ubuntu 18.04
Scancode version: 3.1.1
Downloaded using pip install [scancode-toolkit](url)
Python version: 3.7

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.