Search code examples
pythongoogle-app-enginebytecodepyc

Python not interpreting changed files, using obsolete .pyc


Using the Google App Engine to develop in python yesterday it stopped running the current version of the script. Instead of executing the most recent version it seems to run the previously pre-compiled .pyc even if the .py source was changed.

Error messages actually quotes the correct line from the most current source. Except if the position of the line changed, then it quotes the line which is in the place where the error occurred previously.

Deleting .pyc files causes them to be recreated from the current version. Deleting all .pycs is a poor workaround for now.

How can I get to the root cause of the problem?


Solution

  • The following steps solved the issue temporarily:

    1. Delete GoogleAppEngineLauncher from your Applications folder.
    2. Rename the file ~/Library/Application Support/GoogleAppEngineLauncher/Projects.plist (e.g. Project.plist.backup
    3. Rename the file ~/Library/Preferences/com.google.GoogleAppEngineLauncher.plist (e.g. com.google.GoogleAppEngineLauncher.plist.backup)
    4. Download and install Google App Engine Launcher again.
    5. Use "File", "Add existing application…" to add your projects again, do not forget to set any flags you had set before.

    Alternatively it might even work starting GAEL once, closing it and putting your backed up preference files back into place as to avoid having to reconfigure.

    Edit: Turns out that fixes it… temporarily. Not exactly a very easy issue to debug. Weirdly enough it works when running the appserver from the command line, such as

    dev_appserver.py testproject/ -p 8082 --debug