Question

Here are the other imports already in my app

import os
import sys
from google.appengine.ext.webapp import template

import cgi
import urllib
import wsgiref.handlers

from google.appengine.ext import db
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.api import mail

from django.utils import simplejson as json
from datetime import datetime

import random
import string

from google.appengine.ext import blobstore
from google.appengine.ext.webapp import blobstore_handlers

from google.appengine.api import files

Everything compiles and works fine.

But when I add this import:

from __future__ import with_statement

nothing works. I go to appspot, and the page just says "server error."

How can I successfully import with_satement?

EDIT:

I I know blobstore is deprecated. with is used with blobstore. Could that be what's causing the problem? But with isn't only used with blobstore...

Was it helpful?

Solution

Try adding the import to the very top of your file (after any #!/usr/bin/python2.x statements).

OTHER TIPS

from __future__ imports must occur at the beginning of the file

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top