aboutcode-org/scancode-toolkit

Api get_licenses method fails

Closed this issue · 6 comments

abd96 commented

Description

Whenever i call get_licenses() on a file that contains a license text for example the Barr License

This is a package of commutative diagram macros built on top of Xy-pic by Michael Barr (email: barr@barrs.org). Its use is unrestricted. It may be freely distributed, unchanged, for non-commercial or commercial use. If changed, it must be renamed. Inclusion in a commercial software package is also permitted, but I would appreciate receiving a free copy for my personal examination and use. There are no guarantees that this package is good for anything. I have tested it with LaTeX 2e, LaTeX 2.09 and Plain TeX. Although I know of no reason it will not work with AMSTeX, I have not tested it.

UnicodeDecodeError occure :

UnicodeDecodeError: 'ascii' codec can't decode byte 0xfa in position 32: ordinal not in range(128)

and then :

During handling of the above exception, another exception occurred:
TypeError: function takes exactly 5 arguments (1 given)

Note that i can call other methods without errors like get_copyrights()

How To Reproduce

code :
from scancode import api
test_dir = os.path.abspath(os.path.join(path ,to ,file ))
api.get_licenses(test_dir)

System configuration

  • What OS are you running on? (Windows/MacOS/Linux)

Linux

  • What version of scancode-toolkit was used to generate the scan file?

3.1.1

  • What installation method was used to install/run scancode? (pip/source download/other)

pip

ii'l open a pull request tomorrow, have an exam right now

@abd96 What Python version are you on? I can't seem to reproduce this on my Linux machine either with Python 3.6 or Python 2.7.

Are you also able to reproduce this error when scancode is installed from GitHub?

@abd96 What Python version are you on? I can't seem to reproduce this on my Linux machine either with Python 3.6 or Python 2.7.

Same, i tried on Windows and can't seem to reproduce this issue on both python 3 as well as 2

I have tried to reproduce it on all systems, Linux, Windows, python3 and 2. I am not able to reproduce this. Can you provide the actual file you were trying to scan, maybe there could be problem with the file encoding ?

I am getting the same error.

  • OS: ubuntu 18.04
  • Python : Python 3.6

After installing with pip (pip install scancode-toolkit) and activating the virtual env environment, I called it as follows.
scancode --license --copyright --json-pp scancode_result.json samples

There is no file in the folder named samples.

I was not able to reproduce these and I am closing this for now.