Shopify Python Django "expected string or bytes-like object" error.

tipu002
Shopify Partner
8 0 0

I am using PythonAPI for Django.

my code is:

def shopify_admin_home(request):
    products = shopify.Product.find(limit=3)
    data = {
        'products': products
    }
    return render(request, 'shopify_admin/home.html', data)

When I run the "runserver" this view displays the product data only the first time.
When I reload the URL/page, it throws an error "expected string or bytes-like object". What I should do?

But, If directly run it with python console it works fine every time I call the data. I am really blocked. Give me a solution. Thanks all.

0 Likes