mardi 21 juin 2016

GAE import errors; what worked before doesn't now

I'm developing a web app for Google App Engine in Python on Windows 10. Everything was working fine when my main.py was just serving templates.

import os
import urllib
from google.appengine.api import users
import jinja2
import webapp2

JINJA_ENVIRONMENT = jinja2.Environment(
    loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
    extensions=['jinja2.ext.autoescape'],
    autoescape=True)

But then I tried to add cloud storage, and got import errors no matter what library I tried. So I removed those references from main.py, and now I get an error with jinja2, which had been working fine!

ImportError: No module named jinja2

I don't remember everything I tried, but here's what I do know:

  • jinja2 is installed; attempts to pip install/upgrade says it's already installed and up-to-date, and I see it in c:python27libsite-packages.
  • PYTHONPATH=C:python27;c:python27lib;C:Python27DLLS for system and user.
  • At one point I had installed GoogleAppEngineCloudStorageClient with PIP into my app's lib directory per this. It didn't work (the module failed to import), so I also tried adding sys.path.append(os.path.join(os.path.dirname(__file__), "lib")) but it didn't help. I think this is when I started getting the jinja2 import error. So I removed the statement from main.py. Still getting the jinja2 import error. I tried pip uninstall GoogleAppEngineCloudStorageClient but it said it wasn't installed, so I tried just deleting the lib directory. Still getting the jinja2 import error.
  • Have tried restarting the service and rebooting my machine.

Aucun commentaire:

Enregistrer un commentaire