gpt4 book ai didi

PHP App Engine 部署问题

转载 作者:可可西里 更新时间:2023-10-31 23:30:54 27 4
gpt4 key购买 nike

我遇到了一个非常奇怪的问题,但无法解决。甚至 Google 团队也在努力解决这个问题,但到目前为止无法解决。

我有一个 CSS 文件,它很长一段时间以来都是一样的,并且在过去 1-2 年里从未改变过。现在我想改变一个地方。我将 max-width 更改为 max-height 并保存。现在我正在部署代码,但它抛出了一个异常:

11:12 AM Scanned 1500 files.
11:12 AM Scanned 2000 files.
11:12 AM Scanned 2500 files.
11:12 AM Scanned 3000 files.
11:12 AM Scanned 3500 files.
11:12 AM Scanned 4000 files.
11:12 AM Scanned 4500 files.
11:12 AM Scanned 5000 files.
11:12 AM Scanned 5500 files.
11:12 AM Cloning 2639 static files.
11:12 AM Cloned 2000 files.
11:12 AM Cloning 2916 application files.
11:12 AM Cloned 2000 files.
11:12 AM Uploading 1 files and blobs.
2014-07-29 11:12:36,450 ERROR appcfg.py:2559 An unexpected error occurred. Abort
ing.
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 2400, in DoUpload
self._UploadMissingFiles(missing_files, openfunc)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 2538, in _UploadMissingFiles
self.blob_batcher.Flush()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 1442, in Flush
self.SendBatch()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 1401, in SendBatch
payload,
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 1934: ordin
al not in range(128)
11:12 AM Rolling back the update.
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 126, in
<module>
run_file(__file__, globals())
File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 122, in
run_file
execfile(_PATHS.script_file(script_name), globals_)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 5334, in <module>
main(sys.argv)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 5325, in main
result = AppCfgApp(argv).Run()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 2963, in Run
self.action(self)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 4991, in __call__
return method()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 3762, in Update
self._UpdateWithParsedAppYaml(appyaml, self.basepath)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 3815, in _UpdateWithParsedAppYaml
self.UpdateVersion(rpcserver, basepath, appyaml, APP_YAML_FILENAME)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 3698, in UpdateVersion
return appversion.DoUpload(paths, openfunc)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 2400, in DoUpload
self._UploadMissingFiles(missing_files, openfunc)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 2538, in _UploadMissingFiles
self.blob_batcher.Flush()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 1442, in Flush
self.SendBatch()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 1401, in SendBatch
payload,
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 1934: ordin
al not in range(128)

我再次将高度更改为宽度,它可以正确部署。在这两种情况下,文件编码类型都是 UTF-8。对此有任何猜测或解决方案吗?如果您需要任何进一步的信息,我很乐意与您分享。

解决方案

大多数时候,即使您将文件编码类型更改为 UTF-8,它也无法识别。最好的方法是强制要求 appcfg.py 以 UTF-8 编码格式处理您的文件。您可以通过更改 app.yaml 中文件格式的 mime_type 来实现,如下所示:

- url: /(.*\.(css$))
static_files: \1
upload: (.*\.(css$))
mime_type: text/css; charset=UTF-8

通过这种方式,您的文件将被视为 UTF-8,并且您的部署不会失败。

最佳答案

打开yourfile.css,并确保它以utf-8 编码保存。根据您的文本编辑器,您可以转到另存为,然后选择编码。错误告诉你这是 ascii 编码的,它在位置 1934 处发现了一个非 ascii 字符。使用你的文本编辑器找到第 1934 个字符,你就会看到这个问题。您是否从网上复制/粘贴了该行?如果是这样,您很可能有一个非 ASCII 连字符、冒号、分号或引号。

关于PHP App Engine 部署问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25125829/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com