wireservice/leather

TypeError: argument must be a context when importing

Closed this issue · 2 comments

After I pip install agate, when I import it, I get errors

username@computer(master):~$ python3
Python 3.6.9 (default, Apr 18 2020, 01:56:04) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import agate
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/username/.local/lib/python3.6/site-packages/agate/__init__.py", line 14, in <module>
    from agate.table import Table  # noqa
  File "/home/username/.local/lib/python3.6/site-packages/agate/table/__init__.py", line 298, in <module>
    from agate.table.bar_chart import bar_chart
  File "/home/username/.local/lib/python3.6/site-packages/agate/table/bar_chart.py", line 4, in <module>
    import leather
  File "/home/username/.local/lib/python3.6/site-packages/leather/__init__.py", line 5, in <module>
    from leather.chart import Chart
  File "/home/username/.local/lib/python3.6/site-packages/leather/chart.py", line 11, in <module>
    from leather.scales import Scale, Linear, Temporal
  File "/home/username/.local/lib/python3.6/site-packages/leather/scales/__init__.py", line 3, in <module>
    from leather.scales.base import Scale
  File "/home/username/.local/lib/python3.6/site-packages/leather/scales/base.py", line 8, in <module>
    from leather.shapes import Bars, Columns
  File "/home/username/.local/lib/python3.6/site-packages/leather/shapes/__init__.py", line 4, in <module>
    from leather.shapes.bars import Bars
  File "/home/username/.local/lib/python3.6/site-packages/leather/shapes/bars.py", line 8, in <module>
    from leather.series import CategorySeries
  File "/home/username/.local/lib/python3.6/site-packages/leather/series/__init__.py", line 3, in <module>
    from leather.series.base import Series, key_function
  File "/home/username/.local/lib/python3.6/site-packages/leather/series/base.py", line 9, in <module>
    from leather.utils import DIMENSION_NAMES, X, Y, Datum
  File "/home/username/.local/lib/python3.6/site-packages/leather/utils.py", line 20, in <module>
    ZERO = Decimal('0')
TypeError: argument must be a context
>>> 

I'm apparently using agate 1.6.1 but there's no way to verify without importing the package.

What is the problem and how can I fix it?

Hello, I think this is a problem linked with python and not agate. It is linked with the Decimal class and changes made to it. maybe this could be updated in the code base of agate. PS: I did not find a solution, else would have linked it here, obviously ):

This is a very unusual error. Can you run python, and in the interpreter, run:

from decimal import Decimal
ZERO = Decimal('0')

I don't see why this would cause an error.