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

WARNING:root:WARNING: Unable to get integer from "" #657

Open
JamesParrott opened this issue Oct 8, 2024 · 2 comments
Open

WARNING:root:WARNING: Unable to get integer from "" #657

JamesParrott opened this issue Oct 8, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@JamesParrott
Copy link

JamesParrott commented Oct 8, 2024

🔬 How To Reproduce

Steps to reproduce the behavior:

>pipx install github-dependents-info
>github-dependents-info --repo nvuillam/npm-groovy-lint

produces:

WARNING:root:WARNING: Unable to get integer from ""
WARNING:root:WARNING: Unable to get integer from ""
Total: 24
Public: 24 (1625 stars)
Private: -24

Environment

Windows 11, pipx 1.2.0, CPython 3.11.4

📈 Expected behavior

No warnings during normal operation, as described in the readme.

@JamesParrott JamesParrott added the bug Something isn't working label Oct 8, 2024
@JamesParrott
Copy link
Author

JamesParrott commented Oct 8, 2024

It happens without pipx too, in a normal venv.

It is due to an intentional warning, which I personally find to be irritating and pointless. If Github's API returns an empty string instead of "0", then in my opinion empty strings and everything other value the API is likely to return, should be handled gracefully by applications built on that API.

Please change this warning to a debug message:.

logging.warning(f'WARNING: Unable to get integer from "{number_as_string}"')

There is no value in showing it to all users during typical execution, and it detracts from the UX.

@alexvoss
Copy link

alexvoss commented Jan 17, 2025

I have stumbled across this looking for the reason why the total number of dependents extracted is much smaller than the number reported on the GitHub page. The problem is that when accessing the pages unauthenticated, GitHub displays a header that contains the same icon used in identifying the bit of HTML that contains the number we want to get. It is in the "Product" menu, in the "Code Search" entry.

I should also mention that there is a PR #607 that seeks to address the issue but does not seem to do so successfully, though it makes the warning message disappear. It seems to be reading a number but the wrong one. That's at least for the repo I am interested in.

What works for me is to change line

svg_item = soup.find("svg", {"class": "octicon-code-square"})
like so:

svg_items = soup.find_all("svg", {"class": "octicon-code-square"})
svg_item = svg_items[2]

This simply takes the 3rd occurrence of the SVG, which works today but may well break again tomorrow. Perhaps someone has an idea how we can identify the correct section more robustly?

Edit: turns out this does not solve my original problem, which is that the tool scrapes only a fraction of the dependents I expected. Hence, my journey continues...

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

2 participants