Forums

ImportError: cannot import name 'API' from 'woocommerce'

Hello, so I am trying to use the WooCommerce REST API in my python script however when I run the code it gives me the error: ImportError: cannot import name 'API' from 'woocommerce'

Here is the line of code:

from woocommerce import API

I have imported Woo Commerce via pip: pip install woocommerce

It still does not recognize the Woo Commerce Import. I have tried to update woo commerce and pip and still nothing has changed.

Are you sure you installed a version of woocommerce that has an API module for you to import? Also, make sure you have no files called "woocomerce.py" on your Python path.

Its always the small things... Thank you I actually have another script called woocommerce.py in my directory. Changed the name and everything works now!

Glad you got that working!