We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug The parse_dimension function does not handle '%' and converts to int instead of float.
def parse_dimension(value: str) -> int: """Parse dimension value, handling px units""" if value.lower().endswith('px'): value = value[:-2] # Remove 'px' suffix try: return int(value) # Convert to float first to handle decimal values except ValueError as e: print(f"Error parsing dimension value {value}: {e}") return None
It should be like this:
def parse_dimension(value: str) -> float: """Parse dimension value, handling px units, percentages, and decimals.""" value = value.strip().lower() if value.endswith('px'): value = value[:-2] # Remove 'px' suffix elif value.endswith('%'): value = value[:-1] # Remove '%' suffix try: return float(value) # Convert to float to handle decimals except ValueError as e: print(f"Error parsing dimension value '{value}': {e}") return None
To Reproduce Steps to reproduce the behavior:
gpt-researcher/gpt_researcher/scraper/utils.py
Line 50 in 8cbc3d5
Expected behavior Not fail on dimensions that have a '%' or a decimal
Screenshots
Additional context Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Tried your solution and it fixed for me. Thanks!
Sorry, something went wrong.
Welcome @sebastiancyndx and @mendeel & thanks for the fix
Green light for the PR for whoever would like to carve their name into the git tree
No branches or pull requests
Describe the bug
The parse_dimension function does not handle '%' and converts to int instead of float.
It should be like this:
To Reproduce
Steps to reproduce the behavior:
gpt-researcher/gpt_researcher/scraper/utils.py
Line 50 in 8cbc3d5
Expected behavior
Not fail on dimensions that have a '%' or a decimal
Screenshots
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: