Comments (18)
I tried with Python 3.10 on my personal machine and I couldn't repro this problem. I also added Python 3.10 to continuous integration on Windows, Mac and Linux and it all works well (see 0d7b01a). I think the issue you are seeing might be due to some specific problem with your Python installation.
from rp2.
Fantastic! Thanks for the good detective work :-)
from rp2.
Good idea. If you also want to submit a PR to add the dependency for RP2 I'll approve it.
from rp2.
Which version of RP2 are you using? If not the latest, could you upgrade and try again? Also make sure the example ODS and config are the latest version.
from rp2.
I set everything up yesterday and was using 0.9.29 installed with pip
.
from rp2.
It looks like you are overriding Decimal.__add__() but do not provide the context
param which is in the Decimal
class in Python3.9/3.10:
and then being called virtually
https://github.com/python/cpython/blob/f33e2c87a83917b5139d97fd8ef7cba7223ebef5/Lib/_pydecimal.py#L1257 (this goes back until at least 3.7)
not sure why it would work for others--if that's the case--though.
from rp2.
Interesting: haven't seen that before. The crypto_example.ods test is ran as part of continuous integration at every checkin on Python 3.7, 3.8, 3.9 and on Linux, Windows and Mac. A few more questions:
- what OS and OS version are you using?
- did you install Python as described in the docs or did you use a Python that came with the OS?
from rp2.
Can confirm elevating that signature of RP2Decimal.py fixes it, (PR at #28)
ArchLinux, Linux hostname 5.17.1-arch1-1 #1 SMP PREEMPT Mon, 28 Mar 2022 20:55:33 +0000 x86_64 GNU/Linux
I used a clean virtualenv with Python3.10 that came with the OS.
from rp2.
The unit tests are failing in the PR:
Traceback (most recent call last):
File "/home/runner/work/rp2/rp2/src/rp2/rp2_main.py", line 93, in _rp2_main_internal
input_data: InputData = parse_ods(configuration=configuration, asset=asset, input_file_handle=input_file_handle)
File "/home/runner/work/rp2/rp2/src/rp2/ods_parser.py", line 128, in parse_ods
_create_and_process_transaction(
File "/home/runner/work/rp2/rp2/src/rp2/ods_parser.py", line 168, in _create_and_process_transaction
transaction: AbstractTransaction = _create_transaction(configuration, current_table_type, internal_id, row_values)
File "/home/runner/work/rp2/rp2/src/rp2/ods_parser.py", line 277, in _create_transaction
transaction = InTransaction(**argument_pack)
File "/home/runner/work/rp2/rp2/src/rp2/in_transaction.py", line 81, in __init__
self.__fiat_in_with_fee = self.__fiat_in_no_fee + self.__fiat_fee
File "/home/runner/work/rp2/rp2/src/rp2/rp2_decimal.py", line 64, in __add__
return RP2Decimal(Decimal.__add__(self, other, context))
TypeError: expected 1 argument, got 2
The context is probably something that got added in Python 3.10 (unit tests are running on 3.7, 3.8 and 3.9).
from rp2.
Odd, I see it in 3.7 as well https://github.com/python/cpython/blob/3.7/Lib/_pydecimal.py#L1157
from rp2.
Is there some sort of non-strict mode in Python that would allow extra arguments in this particular instance even though it's not part of the signature?
from rp2.
Not sure... but it looks like RP2 is not working yet on Python 3.10. If you find a way to make the PR work in a backward compatible way, I'll accept it. For now the (not ideal) workaround is to use Python 3.9.
from rp2.
Here is continuous integration running on Python 3.10:
- Windows: https://github.com/eprbell/rp2/runs/5993615909?check_suite_focus=true
- Mac: https://github.com/eprbell/rp2/runs/5993616027?check_suite_focus=true
- Linux: https://github.com/eprbell/rp2/runs/5993615670?check_suite_focus=true
You may want to try uninstalling python and reinstalling it.
from rp2.
I don't think there is anything else actionable on this issue. OK to close?
from rp2.
FWIW, I think it has to due with the fact that there are two possible backends for the decimal module, see cpython/Lib/decimal.py.
I confirmed that on Arch Linux it's loading from _pydecimal
. I assume that elsewhere it's loading from _decimal
instead.
from rp2.
Found it!
> python
Python 3.11.8 (main, Feb 12 2024, 14:50:05) [GCC 13.2.1 20230801] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from _decimal import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: libmpdec.so.4: cannot open shared object file: No such file or directory
> pacman -Ss mpdec
extra/mpdecimal 4.0.0-2
Package for correctly-rounded arbitrary precision decimal floating point
arithmetic
> sudo pacman -Syu mpdecimal
...
> python
Python 3.11.8 (main, Feb 12 2024, 14:50:05) [GCC 13.2.1 20230801] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from _decimal import *
>>>
...and rp2
appears to be working after this process as well.
TLDR: mpdecimal
is a required dependency of rp2
. I guess on Ubuntu it's either installed by default with the OS or with the distribution of Python. On Arch it must be installed separately.
from rp2.
I filed a bug against Python; maybe this could be fixed upstream.
from rp2.
This should now be resolved (see #108).
from rp2.
Related Issues (20)
- Short term vs. long term gains HOT 5
- Parameter 'crypto_fee' has zero value HOT 3
- Open Positions affected by "from date" HOT 1
- Spending from Exchange with zero balance HOT 14
- option to specify columns in config.ini by letter HOT 1
- Non-zero balances when zero is expected HOT 2
- Few minor suggestions HOT 1
- Uncertain, but considering making a python wallet reader HOT 1
- Per wallet/exchange Specific Identification (FIFO, LIFO, etc...) Resolution HOT 27
- Exception when executing HOT 3
- Question about "Open Positions by Asset" report HOT 2
- Crypto fee in OUT table HOT 24
- FIFO and exchange/wallet cost-basis calculation HOT 5
- RP2 process runs after "DONE" HOT 5
- Investment Expenses can no longer be used for Deductions HOT 10
- Call for GUI coders: create an intuitive GUI to drive RP2 and DaLI HOT 3
- I can def help HOT 2
- Using Pionex data to Rp2 using dali isn't working. __crypto_sent = unknown HOT 4
- Error total in-transaction crypto value < total taxable crypto value HOT 1
- [Request] Expose settings for what constitutes a taxable event HOT 11
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 rp2.