René's URL Explorer Experiment


Title: Version 0.16.2: error when parsing unit strings with spaces · Issue #259 · python-quantities/python-quantities · GitHub

Open Graph Title: Version 0.16.2: error when parsing unit strings with spaces · Issue #259 · python-quantities/python-quantities

X Title: Version 0.16.2: error when parsing unit strings with spaces · Issue #259 · python-quantities/python-quantities

Description: Thank you for all your work creating this library! In previous versions, you could parse a units string in the format " m" (with a leading space). Python 3.12.8 (main, Dec 6 2024, 00:00:00) [GCC 14.2.1 20240912 (Red Hat 14.2.1-3)] on lin...

Open Graph Description: Thank you for all your work creating this library! In previous versions, you could parse a units string in the format " m" (with a leading space). Python 3.12.8 (main, Dec 6 2024, 00:00:00) [GCC 14...

X Description: Thank you for all your work creating this library! In previous versions, you could parse a units string in the format " m" (with a leading space). Python 3.12.8 (main, Dec 6 2024, 00:00:0...

Opengraph URL: https://github.com/python-quantities/python-quantities/issues/259

X: @github

direct link

Domain: www.github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Version 0.16.2: error when parsing unit strings with spaces","articleBody":"Thank you for all your work creating this library!\n\nIn previous versions, you could parse a units string in the format `\" m\"` (with a leading space). \n```\nPython 3.12.8 (main, Dec  6 2024, 00:00:00) [GCC 14.2.1 20240912 (Red Hat 14.2.1-3)] on linux\n\u003e\u003e\u003e import quantities\n\u003e\u003e\u003e quantities.__version__\n'0.16.1'\n\u003e\u003e\u003e quantities.quantity.validate_dimensionality(\" m\")\nDimensionality({meter: 1})\n```\n\nhowever, the newer version's switch to using `ast.parse` instead of `eval` causes errors in this case:\n```\nPython 3.12.8 (main, Dec  6 2024, 00:00:00) [GCC 14.2.1 20240912 (Red Hat 14.2.1-3)] on linux\n\u003e\u003e\u003e import quantities\n\u003e\u003e\u003e quantities.__version__\n'0.16.2'\n\u003e\u003e\u003e quantities.quantity.validate_dimensionality(\" m\")\nTraceback (most recent call last):\n  File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\n  File \"/home/jbonilla/.local/lib/python3.12/site-packages/quantities/quantity.py\", line 34, in validate_dimensionality\n    return unit_registry[value].dimensionality\n           ~~~~~~~~~~~~~^^^^^^^\n  File \"/home/jbonilla/.local/lib/python3.12/site-packages/quantities/registry.py\", line 82, in __getitem__\n    return self.__registry[label]\n           ~~~~~~~~~~~~~~~^^^^^^^\n  File \"/home/jbonilla/.local/lib/python3.12/site-packages/quantities/registry.py\", line 32, in __getitem__\n    tree = ast.parse(string, mode=\"eval\")\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib64/python3.12/ast.py\", line 52, in parse\n    return compile(source, filename, mode, flags,\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"\u003cunknown\u003e\", line 1\n    m\nIndentationError: unexpected indent\n```\n\nNot sure if supporting whitespace around the units was ever intended, but this change caused some issues on our codebase that depended on this behavior. This is also probably related to #256 .","author":{"url":"https://github.com/juan-g-bonilla","@type":"Person","name":"juan-g-bonilla"},"datePublished":"2025-07-02T16:48:51.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/259/python-quantities/issues/259"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:143c9d59-1e91-dede-41c3-6118f7d613b0
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idED1A:39E51F:FDC3B8:14A44D5:696B0C49
html-safe-nonce765af2d5a3b395ce5f8e6cc86c4dfd9af78ee17fac103e01642d767cbca3c755
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRDFBOjM5RTUxRjpGREMzQjg6MTRBNDRENTo2OTZCMEM0OSIsInZpc2l0b3JfaWQiOiI1MTk0NzkyNzg3NzEzMzk1Nzg2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac8266f222ee70e6820d4cb762b937fa3a4ecb5c8c42b8121f504a55e01646176d
hovercard-subject-tagissue:3196545741
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-quantities/python-quantities/259/issue_layout
twitter:imagehttps://opengraph.githubassets.com/b0a0dc50a967ddb8e54ef97763f4be8daf1236cc4a9fe2115926a1a73e8d0146/python-quantities/python-quantities/issues/259
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/b0a0dc50a967ddb8e54ef97763f4be8daf1236cc4a9fe2115926a1a73e8d0146/python-quantities/python-quantities/issues/259
og:image:altThank you for all your work creating this library! In previous versions, you could parse a units string in the format " m" (with a leading space). Python 3.12.8 (main, Dec 6 2024, 00:00:00) [GCC 14...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejuan-g-bonilla
hostnamegithub.com
expected-hostnamegithub.com
None5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d
turbo-cache-controlno-preview
go-importgithub.com/python-quantities/python-quantities git https://github.com/python-quantities/python-quantities.git
octolytics-dimension-user_id222003
octolytics-dimension-user_loginpython-quantities
octolytics-dimension-repository_id560911
octolytics-dimension-repository_nwopython-quantities/python-quantities
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id560911
octolytics-dimension-repository_network_root_nwopython-quantities/python-quantities
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release82560a55c6b2054555076f46e683151ee28a19bc
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://www.github.com/python-quantities/python-quantities/issues/259#start-of-content
https://www.github.com/
Sign in https://www.github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-quantities%2Fpython-quantities%2Fissues%2F259
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://www.github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-quantities%2Fpython-quantities%2Fissues%2F259
Sign up https://www.github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python-quantities%2Fpython-quantities
Reloadhttps://www.github.com/python-quantities/python-quantities/issues/259
Reloadhttps://www.github.com/python-quantities/python-quantities/issues/259
Reloadhttps://www.github.com/python-quantities/python-quantities/issues/259
python-quantities https://www.github.com/python-quantities
python-quantitieshttps://www.github.com/python-quantities/python-quantities
Notifications https://www.github.com/login?return_to=%2Fpython-quantities%2Fpython-quantities
Fork 77 https://www.github.com/login?return_to=%2Fpython-quantities%2Fpython-quantities
Star 216 https://www.github.com/login?return_to=%2Fpython-quantities%2Fpython-quantities
Code https://www.github.com/python-quantities/python-quantities
Issues 73 https://www.github.com/python-quantities/python-quantities/issues
Pull requests 4 https://www.github.com/python-quantities/python-quantities/pulls
Actions https://www.github.com/python-quantities/python-quantities/actions
Projects 0 https://www.github.com/python-quantities/python-quantities/projects
Wiki https://www.github.com/python-quantities/python-quantities/wiki
Security Uh oh! There was an error while loading. Please reload this page. https://www.github.com/python-quantities/python-quantities/security
Please reload this pagehttps://www.github.com/python-quantities/python-quantities/issues/259
Insights https://www.github.com/python-quantities/python-quantities/pulse
Code https://www.github.com/python-quantities/python-quantities
Issues https://www.github.com/python-quantities/python-quantities/issues
Pull requests https://www.github.com/python-quantities/python-quantities/pulls
Actions https://www.github.com/python-quantities/python-quantities/actions
Projects https://www.github.com/python-quantities/python-quantities/projects
Wiki https://www.github.com/python-quantities/python-quantities/wiki
Security https://www.github.com/python-quantities/python-quantities/security
Insights https://www.github.com/python-quantities/python-quantities/pulse
New issuehttps://www.github.com/login?return_to=https://github.com/python-quantities/python-quantities/issues/259
New issuehttps://www.github.com/login?return_to=https://github.com/python-quantities/python-quantities/issues/259
#270https://github.com/python-quantities/python-quantities/pull/270
Version 0.16.2: error when parsing unit strings with spaceshttps://www.github.com/python-quantities/python-quantities/issues/259#top
#270https://github.com/python-quantities/python-quantities/pull/270
https://github.com/juan-g-bonilla
https://github.com/juan-g-bonilla
juan-g-bonillahttps://github.com/juan-g-bonilla
on Jul 2, 2025https://github.com/python-quantities/python-quantities/issues/259#issue-3196545741
#256https://github.com/python-quantities/python-quantities/issues/256
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.