Python不使用过时的.pyc解释已更改的文件 [英] Python not interpreting changed files, using obsolete .pyc

查看:130
本文介绍了Python不使用过时的.pyc解释已更改的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨天使用Google App Engine在python中进行开发时,它停止运行脚本的当前版本。
即使执行.py源已更改,它似乎也不会运行最新版本,而是运行先前预先编译的.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.

删除.pyc文件会使它们从以下位置重新创建当前版本。

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?

推荐答案

以下步骤可暂时解决此问题:

The following steps solved the issue temporarily:


  1. 从应用程序文件夹中删除GoogleAppEngineLauncher。

  2. 重命名文件〜/ Library / Application Support / GoogleAppEngineLauncher / Projects.plist(例如Project.plist.backup

  3. 重命名文件〜/ Library /Preferences/com.google.GoogleAppEngineLauncher.plist(例如com.google.GoogleAppEngineLauncher.plist.backup)

  4. 再次下载并安装Google App Engine启动器。

  5. 使用文件,添加现有应用程序…再次添加项目,不要忘记设置以前设置的任何标志。

  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.

或者它甚至可以启动一次GAEL,将其关闭,然后将备份的首选项文件放回原处,以避免重新配置。

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.

编辑:结果t帽子可以暂时修复。调试起来不是一个非常容易的问题。
从命令行运行应用程序服务器时,它足够奇怪,例如

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

这篇关于Python不使用过时的.pyc解释已更改的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆