I have installed EventBrite API for my django application. The main purpose here is to add event
details from the site into my database.
Since this script will run periodically I have added this into management/commands folder. See the below pic, file name is eventbrite
Problem is when I execute my script using python manage.py eventbrite
, it is showing ImportError: cannot import name Eventbrite
but I have already installed this package inside my virtual environment
.
pip freeze
Django==1.9.2
eventbrite==3.3.3
requests==2.9.1
wheel==0.24.0
When I execute the same package in Django Shell
, it is not showing any error
python manage.py shell
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from eventbrite import Eventbrite
>>>
Could anyone tell me why it is showing an import error
when I run the script using python manage.py eventbrite
?
It looks like you might have a naming conflict between the eventbrite
package loaded from pip, and the eventbrite
module in your management command. How are you importing EventBrite
from within your script? If you're doing from eventbrite import Eventbrite
, then it will try to load it from your own module when using the project interpreter and not find the class. Easy solution would be to name your command something other than eventbrite
.