Troubleshooting Specific Problems

A collection of tips for how to solve problems that arise with your dev environment. Each is annotated with who gave the answer, so you can ask them for more help if needed. New tips should include the date, too, so you can estimate relevance. :)

What do you do if GoogleAppEngineLauncher dies without letting go of the most coveted port of all, 8080?

alpert / pre-7/20/2015:

$ lsof -i :8080
$ kill -9 <whichever PID you see>

What do you do if you get a "'module' object has no attribute 'xsrf'" error?

james / pre-7/20/2015: Stop and restart your app.

What do you do if you get a "[Errno 2] No such file or directory: '/Users/james/Sites/datastore/-Tmp-/dev_appserver.blobstore/dev~khan-academy/D/Dc7adYdDH0e_B3l5YbTuA=='" error?

james / pre-7/20/2015: You probably copied a datastore that referenced blobs that don't exist.  Go to your SDK console from your appengine launcher -> Datastore Viewer and delete all __BlobInfo__ entities.

What do you do when remote shell hangs when trying to fetch all when what you are trying to fetch is over 1k entities:

james / pre-7/20/2015: The remote shell has a 1k limit.  You can get around this by using: 
def incremental_fetch(query):
    i = 0
    batch_size = 500
    start_key = None
    all_entities = []
    while True:
        print i
        q = deepcopy(query)
        if start_key:
            q.filter("__key__ >", start_key)
        if len(entities):
            start_key = entities[-1].key()
            i += batch_size
    return all_entities

videos = incremental_fetch(Video.all())

What do you do if `make serve` tries to start multiple kake servers, fails, and yells at you about logging being a NoneType:

sergei / pre-7/20/2015: Check the kake logs at khan/webapp/genfiles/kake-server.log.  If you see "nohup: Can't detach from console: No such file or directory", you are probably using tmux on OSX.

Install reattach-to-user-namespace (available via `port` and `brew`).

Now you can `reattach-to-user-namespace make serve` and see no errors!

If that worked, you can add the following to your ~/.tmux.conf to be able to `make serve` normally.

set-option -g default-command "reattach-to-user-namespace -l bash"