0

I'm using a library called newspaper and deploying my app to elastic beanstalk. It runs fine locally, but on the server it doesn't work and throws this error:

File "/opt/python/current/app/application.py", line 7, in <module>
  from api.v01.api import apiv01
File "/opt/python/current/app/api/v01/api.py", line 19, in <module>
  from newspaper import Article
File "/opt/python/run/venv/lib/python2.7/site-packages/newspaper/__init__.py", line 10, in <module>
  from .article import Article, ArticleException
File "/opt/python/run/venv/lib/python2.7/site-packages/newspaper/article.py", line 12, in <module>
  from . import images
ImportError: cannot import name images

Both machines are running python 2.7.9.
What could the problem be?

Just to confirm, I'm using requirements.txt to load the dependencies, and they are loaded fine on both machines.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
krishan711
  • 873
  • 1
  • 12
  • 27
  • 1
    did you install `newspaper` package on your server? – Nhor Nov 19 '15 at 16:36
  • @Nhor yes. You can tell because if I had't it wouldn't show me lines 5-8 above! – krishan711 Nov 19 '15 at 16:42
  • have you tried this? http://stackoverflow.com/questions/28036292/importerror-when-installing-newspaper – Nhor Nov 19 '15 at 16:45
  • That's not a good answer for a number of reasons - it doesn't explain why it works locally but not on eb; it doesn't allow me to solve the problem with scale (when nw machines are fired up i don't want to have to do this each time); and finally I don't want to be editing dependencies manually. – krishan711 Nov 19 '15 at 16:50
  • Have you checked file permissions on the server? – jcfollower Nov 19 '15 at 18:28
  • @jcfollower Nope, which files should i check the permissions for and is there anything in particular I should be looking for? – krishan711 Nov 20 '15 at 09:29
  • I don't know newspaper, but I would say that you should make sure that whatever user django is running as has permissions to read whatever file the images class is in. – jcfollower Nov 20 '15 at 13:19

0 Answers0