New Shopify Certification now available: Liquid Storefronts for Theme Developers

ResourceNotFound by image.save()

Solved
nisycon
Visitor
2 1 0

Currently, we are registering new products and updating existing products via the Shopify API. However, all of a sudden, we can no longer register new products and the following error is occurring.

 

pyactiveresource.connection.ResourceNotFound: Not Found: https://[shop-ulr].myshopify.com/admin/api/2023-01/images.json

In order to identify this problem, we checked the code one by one. It seems that the error occurs when the following code is executed.

 

image.save()

 

 

image = shopify.Image()
image.product_id = product_id
image.src=img['src']
image.alt = img['alt']

...

image.save()   #Error occurred here

 

 

 

What could be the problem here?

Accepted Solution (1)
nisycon
Visitor
2 1 0

This is an accepted solution.

Ohh, the cause was actually quite simple.
Indeed, the error occurred with image.save(), but
when I checked the image, it didn't contain any elements.

Furthermore, tracing back the cause, it seems that product.save() was not done correctly,
and it was because there was no product that the image couldn't be set.

View solution in original post

Reply 1 (1)
nisycon
Visitor
2 1 0

This is an accepted solution.

Ohh, the cause was actually quite simple.
Indeed, the error occurred with image.save(), but
when I checked the image, it didn't contain any elements.

Furthermore, tracing back the cause, it seems that product.save() was not done correctly,
and it was because there was no product that the image couldn't be set.