question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

problems with money_maker.py

See original GitHub issue

doing tests in python 3.6 everything works correctly.

The problem happens when using python version 3.8.3 it throws the following error:

ValueError at /es/admin/medexample/product/
Can not add/substract money in different currencies.
Request Method:	GET
Request URL:	http://localhost:8000/es/admin/medexample/product/
Django Version:	3.0.7
Exception Type:	ValueError
Exception Value:	
Can not add/substract money in different currencies.
Exception Location:	/home/kira/.virtualenvs/vmedexample/lib/python3.8/site-packages/shop/money/money_maker.py in _assert_addable, line 220
Python Executable:	/home/kira/.virtualenvs/vmedexample/bin/python
Python Version:	3.8.3
Python Path:	
['/home/kira/Desarrollo/implementacion/medexample',
 '/usr/lib/python38.zip',
 '/usr/lib/python3.8',
 '/usr/lib/python3.8/lib-dynload',
 '/home/kira/.virtualenvs/vmedexample/lib/python3.8/site-packages']
Server time:	Mié, 17 Jun 2020 17:46:00 +0000


/home/kira/.virtualenvs/vmedexample/lib/python3.8/site-packages/shop/money/money_maker.py in _assert_addable
        return 10**CURRENCIES[cls._currency_code][1]
    def _assert_addable(self, other):
        if not other:
            # so that we can add/substract zero or None to any currency
            return self.__class__('0')
        if self._currency_code != getattr(other, '_currency_code', None):
            raise ValueError("Can not add/substract money in different currencies.") …
        return other
    def _assert_multipliable(self, other):
        if hasattr(other, '_currency_code'):
            raise ValueError("Can not multiply currencies.")
        if isinstance(other, float):
▼ Local vars
Variable	Value
other	
Decimal('399.00')
self	
MoneyInEUR('399.000')

It is a project started with “cookiecutter-django-shop”, with all the data loaded with proof.

The error comes out when trying to access:

http://localhost:8000/es/admin/medexample/product/

clarify that it ran with python version 3.8.3

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
darekmecocommented, Oct 29, 2020

I can confirm, Python 3.8.6, default settings

 File "/home/darek/.local/share/virtualenvs/my-shop-OpEeVNpI/lib/python3.8/site-packages/shop/money/money_maker.py", line 220, in _assert_addable
    raise ValueError("Can not add/substract money in different currencies.")
ValueError: Can not add/substract money in different currencies.

0reactions
jriefcommented, Oct 30, 2020

@darekmeco would you mind adding a unit test which reproduces this error on Python-3.8 but works on Python<=3.7?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problems with "Money Maker" Project in the C# Course
Hello everyone, I am having difficulty in getting the code to produce the desired outcome in the test cases eg. 16 should produce...
Read more >
Money Maker Camera Harness by HoldFast Gear - SLR Lounge
So, it's safe to say that anything you can strap to it is going to stay attached! The leather is going to be...
Read more >
Market Timing Fails as a Money Maker - Investopedia
Market timing is not easily achievable. Over a sustained period of time, almost all investors profit more simply by investing immediately. Timing the...
Read more >
Practice_Problems_1.pdf - IMSE3105/3115 Practice Problems ...
IMSE3105/3115 Practice Problems I October 8, 2018 Questions: 1. ... Stan Moneymaker presently owns a 10-year-old automobile with low mileage (78,000 miles).
Read more >
Moneymaker Tomatoes Plant Care & Growing Tips | Horticulture
Common Problems. There are a few pests who are keen to get at tomatoes. Aphids. The little sap-suckers love to feed on plants ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found