Comments (4)
@simaosr How did you resolve it?
I have the same (latter) issue in python 3.11 with code working fine in 3.12.
from pint.
Hi @OJFord
I solved it using the solution given in the comments of #1814
import pint
ureg = pint.UnitRegistry(preprocessors = [lambda s: s.replace("€", "EUR")])
ureg.define("euro = [currency] = € = EUR")
print(ureg.Quantity("1 €"))
# I get "1 euro", it works!
from pint.
Ah, thanks! I eventually figured out the replacement, but I didn't know about preprocessors - that's tidier.
from pint.
We should add a page to the docs for this - I'll leave this issue open until there's one
from pint.
Related Issues (20)
- pint-convert fails with uncertainties related error if numpy is not installed as well - document numpy dependence or give a better error message HOT 13
- Custom formatters not working with modifiers (Undocumented breaking change in 0.24) HOT 4
- Euro symbol cannot be parsed by the UnitRegistry HOT 1
- Custom formatter can't reformat dimensionless unit HOT 8
- regression on python 3.12 UndefinedUnitError for string `−66.11*10**-62` HOT 3
- TypeError: unsupported operand type(s) for -: 'ParserHelper' and 'ParserHelper'
- strange behavior when using @ureg.wraps HOT 1
- Operations with pandas 3
- Verification on unit conversion: `1 * ureg.electron_volt / ureg.angstrom**3 == 1 / (1e3 * ureg.joule) * 1.0e24 * 1e9 * ureg.pascal`. HOT 1
- Default Unit registry initialization is not thread safe
- TypeError: cannot inherit frozen dataclass from a non-frozen one HOT 1
- `to_preferred` brakes REPL HOT 2
- >=0.24.2 has 4 failures in test_testing.py HOT 1
- Process for adding new units? HOT 1
- `to_compact` is broken for `Measurement`s and for `Quantity`s with uncertainties
- pint.Quantity.units / pint.Unit fails HOT 1
- Bug in Angle Dimensionality
- UnitRegistry(system="imperial") fetches the wrong volume measures
- Quantity class violates collections.abc protocol
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pint.