Find product error REST ADMIN API

Pravin_Tandale
New Member
1 0 0

When I am trying to find product by id using find() 

shopify.Product().find('XXXXXXXX')

 

getting error 

Traceback (most recent call last):
File "/home/***/venv/lib/python3.7/site-packages/celery/app/trace.py", line 385, in trace_task
R = retval = fun(*args, **kwargs)
File "/home/***/venv/lib/python3.7/site-packages/celery/app/trace.py", line 650, in __protected_call__
return self.run(*args, **kwargs)
File "/home/***/src/api/v1_0_0/tasks/shopify.py", line 159, in publish_product_on_shopify
new_product = shopify.Product().find(XXXXX)
File "/home/***/venv/lib/python3.7/site-packages/shopify/base.py", line 211, in find
collection = super(ShopifyResource, cls).find(id_=id_, from_=from_, **kwargs)
File "/home/****/venv/lib/python3.7/site-packages/pyactiveresource/activeresource.py", line 384, in find
return cls._find_single(id_, **kwargs)
File "/home/***/venv/lib/python3.7/site-packages/pyactiveresource/activeresource.py", line 488, in _find_single
prefix_options)
File "/home/****/venv/lib/python3.7/site-packages/pyactiveresource/activeresource.py", line 540, in _build_object
return cls(attributes, prefix_options)
File "/home/****/venv/lib/python3.7/site-packages/shopify/base.py", line 181, in __init__
return super(ShopifyResource, self).__init__(attributes, prefix_options)
File "/home/****/venv/lib/python3.7/site-packages/pyactiveresource/activeresource.py", line 363, in __init__
self._update(attributes)
File "/home/****/venv/lib/python3.7/site-packages/pyactiveresource/activeresource.py", line 977, in _update
attr.append(klass(child))
TypeError: 'module' object is not callable

 

It was working fine 3...4 days back. but not now

I did not change any code.

 

Any help??

Replies 2 (2)
SBD_
Shopify Staff
1097 147 209

Are you able to capture a request ID from the response headers, or provide the product ID?

Scott | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

drakebohan
New Member
1 0 0

In Python , a script is a module, whose name is determined by the filename, you need to distinguish between module names and class names. So when you start out your file MyClass.py with import MyClass you are creating a loop in the module structure. This error 'module' object is not callable is raised as you are being confused about the Class name and Module name. The problem is in the import line . You are importing a module, not a class. This happend because the module name and class name have the same name .

If you have a class MyClass in a file called MyClass.py , then you should write:

from MyClass import MyClass