UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 0: ordinal not in range(128)
我的主题有.js文件,它曾经起作用。但是今天当我注释掉一些代码行,或者只是打开并保存它并更新我的应用程序时,我得到了这个错误
1 | UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 0: ordinal not in range(128) |
完全错误是
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 2014-06-22 14:52:01,388 ERROR appcfg.py:2487 An unexpected error occurred. Aborting. Traceback (most recent call last): File"C:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.py", line 2328, in DoUpload self._UploadMissingFiles(missing_files, openfunc) File"C:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.py", line 2466, in _UploadMissingFiles self.blob_batcher.Flush() File"C:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.py", line 1401, in Flush self.SendBatch() File"C:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.py", line 1360, in SendBatch payload, UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 0: ordinal not in range(128) 02:52 PM Rolling back the update. Traceback (most recent call last): File"C:\Program Files\Google\google_appengine\appcfg.py", line 126, in <module> run_file(__file__, globals()) File"C:\Program Files\Google\google_appengine\appcfg.py", line 122, in run_file execfile(_PATHS.script_file(script_name), globals_) File"C:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.py", line 5214, in <module> main(sys.argv) File"C:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.py", line 5205, in main result = AppCfgApp(argv).Run() File"C:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.py", line 2885, in Run self.action(self) File"C:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.py", line 4884, in __call__ return method() File"C:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.py", line 3681, in Update self._UpdateWithParsedAppYaml(appyaml, self.basepath) File"C:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.py", line 3734, in _UpdateWithParsedAppYaml self.UpdateVersion(rpcserver, basepath, appyaml, APP_YAML_FILENAME) File"C:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.py", line 3617, in UpdateVersion return appversion.DoUpload(paths, openfunc) File"C:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.py", line 2328, in DoUpload self._UploadMissingFiles(missing_files, openfunc) File"C:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.py", line 2466, in _UploadMissingFiles self.blob_batcher.Flush() File"C:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.py", line 1401, in Flush self.SendBatch() File"C:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.py", line 1360, in SendBatch payload, UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 0: ordinal not in range(128) 2014-06-22 14:52:03 (Process exited with code 1) You can close this window now. |
我的文件是https://dl.dropbox usercontent.com/u/27576887/stackoverflow/charisma.js我在vs 2012中打开并编辑文件请告诉我这里怎么了?谢谢!
显然,这是一个编码问题:您的代码中有一个或多个字符在上传时无法解码。检查1282的sendbatch方法
如果你可以不使用有问题的角色,那么你就可以走了。否则,通过终端中的appcfg.py直接更新您的服务器就可以了。
1 | python appcfg.py update |
不管怎样,追踪这个问题的进展都会很有趣。
文件保存为Unicode UTF-8,不带签名。我把它改成日班制,它又工作了。