Code Monkey home page Code Monkey logo

Comments (11)

rndstr avatar rndstr commented on May 31, 2024 1

I ended up running it with Docker where it works, posting as it may help others running into the same issue:

Create Dockerfile

FROM python:3.9
WORKDIR /usr/src/app
RUN pip3 install rp2

In same dir run

docker build --tag rp2 

Go to your directory with input.ods and input.config files, run

docker run -it --rm --name rp2-script -v "$PWD":/usr/src/app -w /usr/src/app rp2 rp2_us input.config input.ods

from rp2.

eprbell avatar eprbell commented on May 31, 2024

This looks like another Python 3.10 decimal issue, similar to issue #25. I haven't tested RP2 on Python 3.10: it does look like it's not working yet on that version of the language. The (non ideal) workaround is to use Python 3.9. If you find a way to modify PR #28 so that RP2 works on all versions of Python, I'll accept it.

from rp2.

eprbell avatar eprbell commented on May 31, 2024

Since issue #25 seems due to some problem with your specific Python installation (see my latest comments there), this behavior might have the same origin. You may want to try uninstalling Python and reinstalling it.

from rp2.

rndstr avatar rndstr commented on May 31, 2024

Well it's an endless loop which you can confirm following the link in my original post. Does not look like Python version related at all. The crypto_example.ods sample works fine, it's just my own sample has some input that rp2 cannot handle and instead of throwing an exception (see the link in my original post), it goes to your overwritten method where you call quantize() again.

Now, I don't know which cell has an invalid value so I recommend adding verbosity to be able to better debug invalid values.

from rp2.

rndstr avatar rndstr commented on May 31, 2024

Running the tests locally I also get the recursion error so it looks like it might be setup related. I don't know much about Python development and I have no clue how there can possibly be different behaviors in that regard, it's a clean Python install (through the package manager) and I reinstalled multiple times with different versions.

from rp2.

rndstr avatar rndstr commented on May 31, 2024

If anyone cares, here is a CSV that fails:

IN,1,2,3,4,5,6,7,8,9,10,11,12
timestamp,exchange,holder,type,asset,crypto_in,spot_price,[crypto_fee],[fiat_fee],[fiat_in_fee],[fiat_in_nofee],[id],[notes]
2020-02-01T11:18Z,Kraken,self,BUY,ETH,107,1,0,,,,,x
TABLE END,,,,,,,,,,,,
,,,,,,,,,,,,
OUT,1,2,3,4,5,6,7,8,9,10,11,12
timestamp,exchange,holder,type,asset,crypto_out_nofee,spot_price,[crypto_fee],[fiat_fee],[crypto_out_fee],[fiat_out_nofee],[id],[notes]
2020-02-02T11:18Z,Kraken,self,SELL,ETH,50,1,0.00,0,,,,
TABLE END,,,,,,,,,,,,

and here one that succeeds

IN,1,2,3,4,5,6,7,8,9,10,11,12
timestamp,exchange,holder,type,asset,crypto_in,spot_price,[crypto_fee],[fiat_fee],[fiat_in_fee],[fiat_in_nofee],[id],[notes]
2020-02-01T11:18Z,Kraken,self,BUY,ETH,100,1,0,,,,,x
TABLE END,,,,,,,,,,,,
,,,,,,,,,,,,
OUT,1,2,3,4,5,6,7,8,9,10,11,12
timestamp,exchange,holder,type,asset,crypto_out_nofee,spot_price,[crypto_fee],[fiat_fee],[crypto_out_fee],[fiat_out_nofee],[id],[notes]
2020-02-02T11:18Z,Kraken,self,SELL,ETH,50,1,0.00,0,,,,
TABLE END,,,,,,,,,,,,

the only difference is for crypto_in to be 100 instead of 107 [rounding exception]

from rp2.

eprbell avatar eprbell commented on May 31, 2024

Can you add a print statement at /home/rndstr/venv3/lib/python3.10/site-packages/rp2/rp2_decimal.py", line 64, in add? Something like:

print(self, other)

The last printed values before the exception should be the ones causing the problem in the add.

from rp2.

rndstr avatar rndstr commented on May 31, 2024

it prints this
-3.17757009345794393E-14 0E-13

from rp2.

eprbell avatar eprbell commented on May 31, 2024

You have a small repro: that's good. Can you upload the ODS file instead of CSV and its related config? That way I can feed it directly to RP2 on my machine.

from rp2.

rndstr avatar rndstr commented on May 31, 2024

uploaded it at rndstr@3a973c8

i wonder whether the Python decimal library is using something in my system that messes the rounding or accuracy up

from rp2.

eprbell avatar eprbell commented on May 31, 2024

I tried your files and they worked on my machine:

> rp2_us loop.config loop.ods
 
INFO: Country: us
INFO: Accounting Method: fifo
INFO: Configuration file: loop.config
INFO: Input file: loop.ods
INFO: Processing ETH
INFO: Generating output for plugin 'rp2.plugin.report.rp2_full_report'
INFO: Plugin 'rp2.plugin.report.rp2_full_report' output: /private/tmp/output/fifo_rp2_full_report.ods
INFO: Generating output for plugin 'rp2.plugin.report.us.tax_report_us'
INFO: Plugin 'rp2.plugin.report.us.tax_report_us' output: /private/tmp/output/fifo_tax_report_us.ods
INFO: Log file: ./log/rp2_2022_04_12_21_22_19_512993.log
INFO: Generated output directory: output/
INFO: Done

I wonder if other Python packages using Decimal and high-precision math work on your machine: it might be an experiment worth trying.

from rp2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.