Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when following tutorial #1407

Open
pombredanne opened this issue Oct 17, 2024 · 5 comments
Open

Error when following tutorial #1407

pombredanne opened this issue Oct 17, 2024 · 5 comments
Labels
bug Something isn't working high priority

Comments

@pombredanne
Copy link
Member

I received a report of someone having issues with the docker image of scancode.io.

Here is the error:

And I had this error:

CommandError: Error during inspect_packages execution:
'str' object has no attribute 'path'
Traceback:
  File "/opt/scancodeio/scanpipe/pipelines/_init_.py", line 220, in execute
    step(self)
  File "/opt/scancodeio/scanpipe/pipelines/inspect_packages.py", line 61, in scan_for_application_packages
    scancode.scan_for_application_packages(
  File "/opt/scancodeio/scanpipe/pipes/scancode.py", line 408, in scan_for_application_packages
    assemble_packages(project=project)
  File "/opt/scancodeio/scanpipe/pipes/scancode.py", line 465, in assemble_packages
    for item in items:
  File "/opt/scancodeio/venv/lib/python3.12/site-packages/packagedcode/npm.py", line 120, in assemble
    workspace_root_path = package_resource.parent(codebase).path
@pombredanne pombredanne added bug Something isn't working high priority labels Oct 17, 2024
@pombredanne
Copy link
Member Author

To reproduce:

  1. git clone https://github.com/aboutcode-org/scancode-workbench
  2. docker run --rm -v "$(pwd)/scancode-workbench":/code ghcr.io/aboutcode-org/scancode.io:latest sh -c "run inspect_packages:StaticResolver /code" > results.json
  3. eventually this fails:
INFO     Processing item: Dependency(purl='pkg:npm/[email protected]', extracted_requirement='5.0.1', scope='dependencies')
INFO   Processing: package.json
INFO   Package data: pkg:npm/[email protected]
INFO   Selected package handler: NpmPackageJsonHandler
INFO Run[370b760e-2b59-4885-9bc3-fce65957388e] Update Run instance with exitcode, output, and end_date
CommandError: Error during inspect_packages execution:
'str' object has no attribute 'path'

Traceback:
  File "/opt/scancodeio/aboutcode/pipeline/__init__.py", line 199, in execute
    step(self)
  File "/opt/scancodeio/scanpipe/pipelines/inspect_packages.py", line 61, in scan_for_application_packages
    scancode.scan_for_application_packages(
  File "/opt/scancodeio/scanpipe/pipes/scancode.py", line 409, in scan_for_application_packages
    assemble_packages(project=project)
  File "/opt/scancodeio/scanpipe/pipes/scancode.py", line 466, in assemble_packages
    for item in items:
                ^^^^^
  File "/opt/scancodeio/.venv/lib/python3.12/site-packages/packagedcode/npm.py", line 120, in assemble
    workspace_root_path = package_resource.parent(codebase).path
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

@pombredanne
Copy link
Member Author

To reproduce:

  1. git clone https://github.com/aboutcode-org/scancode-workbench
  2. docker run --rm -v "$(pwd)/scancode-workbench":/code ghcr.io/aboutcode-org/scancode.io:latest sh -c "run inspect_packages:StaticResolver /code" > results.json
  3. eventually this fails:
INFO     Processing item: Dependency(purl='pkg:npm/[email protected]', extracted_requirement='5.0.1', scope='dependencies')
INFO   Processing: package.json
INFO   Package data: pkg:npm/[email protected]
INFO   Selected package handler: NpmPackageJsonHandler
INFO Run[370b760e-2b59-4885-9bc3-fce65957388e] Update Run instance with exitcode, output, and end_date
CommandError: Error during inspect_packages execution:
'str' object has no attribute 'path'

Traceback:
  File "/opt/scancodeio/aboutcode/pipeline/__init__.py", line 199, in execute
    step(self)
  File "/opt/scancodeio/scanpipe/pipelines/inspect_packages.py", line 61, in scan_for_application_packages
    scancode.scan_for_application_packages(
  File "/opt/scancodeio/scanpipe/pipes/scancode.py", line 409, in scan_for_application_packages
    assemble_packages(project=project)
  File "/opt/scancodeio/scanpipe/pipes/scancode.py", line 466, in assemble_packages
    for item in items:
                ^^^^^
  File "/opt/scancodeio/.venv/lib/python3.12/site-packages/packagedcode/npm.py", line 120, in assemble
    workspace_root_path = package_resource.parent(codebase).path
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Current toolkit is 32.2.1 per

scancode-toolkit[packages]==32.2.1

We likely have a fix with aboutcode-org/scancode-toolkit#3857 and we likely just need to update SCTK and release SCIO

@AyanSinhaMahapatra
Copy link
Member

AyanSinhaMahapatra commented Oct 21, 2024

We likely have a fix with aboutcode-org/scancode-toolkit#3857 and we likely just need to update SCTK and release SCIO

This seems to be fixed by the above mentioned PR adding a bunch of npm improvements. Will push a release of SCTK and update sctk version in SCIO soon

@tdruez
Copy link
Contributor

tdruez commented Oct 30, 2024

@AyanSinhaMahapatra Is the problem still exist after the merge of #1418 ?

@AyanSinhaMahapatra
Copy link
Member

@tdruez this is fixed with the latest ghcr.io/aboutcode-org/scancode.io:v34.8.3 image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high priority
Projects
None yet
Development

No branches or pull requests

3 participants