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

🐛 Bug Report: AttributeError on import of newer version of traceloop.sdk #2596

Open
1 task done
baldeoa opened this issue Feb 3, 2025 · 0 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@baldeoa
Copy link

baldeoa commented Feb 3, 2025

Which component is this bug for?

Traceloop SDK

📜 Description

The installed_packages in packages/traceloop-sdk/traceloop/sdk/utils/package_check.py assuming that every distribution's metadata contains a "Name" entry. If a distribution's metadata is missing this entry (or if it is None), attempting to call .lower() on None will result in an AttributeError. This error was not present in older versions of traceloop-sdk and started happening when upgrading to version 34 and above

👟 Reproduction steps

from traceloop.sdk import Instruments

👍 Expected behavior

installed_packages = {
    dist.metadata.get("Name", "").lower()
    for dist in distributions()
    if dist.metadata.get("Name") is not None
} 

👎 Actual Behavior with Screenshots

  File "/app/venv/lib/python3.11/site-packages/traceloop/sdk/utils/package_check.py", line 3, in <setcomp>
    installed_packages = {dist.metadata["Name"].lower() for dist in distributions()}
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'lower'

🤖 Python Version

3.11

📃 Provide any additional context for the Bug.

No response

👀 Have you spent some time to check if this bug has been raised before?

  • I checked and didn't find similar issue

Are you willing to submit PR?

None

@dosubot dosubot bot added the bug Something isn't working label Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant