小编dem*_*mos的帖子

尝试将Utf-8数据存储在数据存储区中,获取UnicodeEncodeError

尝试将utf-8存储到数据存储区并获取错误:

Traceback (most recent call last):
  File "/sinfo/google_appengine/google/appengine/ext/webapp/__init__.py", line 511, in __call__
    handler.get(*groups)
  File "/sinfo/siteinfo/siteinfo.py", line 1911, in get
    seoEntity.put()
  File "/sinfo/google_appengine/google/appengine/ext/db/__init__.py", line 833, in put
    return datastore.Put(self._entity, rpc=rpc)
  File "/sinfo/google_appengine/google/appengine/api/datastore.py", line 275, in Put
    req.entity_list().extend([e._ToPb() for e in entities])
  File "/sinfo/google_appengine/google/appengine/api/datastore.py", line 680, in _ToPb
    properties = datastore_types.ToPropertyPb(name, values)
  File "/sinfo/google_appengine/google/appengine/api/datastore_types.py", line 1499, in ToPropertyPb
    pbvalue = pack_prop(name, v, pb.mutable_value())
  File "/sinfo/google_appengine/google/appengine/api/datastore_types.py", line 1322, in PackString
    pbvalue.set_stringvalue(unicode(value).encode('utf-8'))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not …

google-app-engine google-cloud-datastore

3
推荐指数
1
解决办法
1951
查看次数

UnicodeEncodeError Google App Engine

我变得非常熟悉了:

UnicodeEncodeError:'ascii'编解码器无法对位置24中的字符u'\ xe8'进行编码:序数不在范围内(128)

我已经检查了SO上的多个帖子,他们建议 - variable.encode('ascii','ignore')

但是,这不起作用.即使在此之后我也得到同样的错误......

堆栈跟踪:

'ascii' codec can't encode character u'\x92' in position 18: ordinal not in range(128)
Traceback (most recent call last):
  File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 513, in __call__
    handler.post(*groups)
  File "/base/data/home/apps/autominer1/1.343038273644030157/siteinfo.py", line 2160, in post
    imageAltTags.append(str(image["alt"]))
UnicodeEncodeError: 'ascii' codec can't encode character u'\x92' in position 18: ordinal not in range(128)
Run Code Online (Sandbox Code Playgroud)

负责相同的代码:

siteUrl = urlfetch.fetch("http://www."+domainName, headers = { 'User-Agent' : 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5' } )


 webPage = siteUrl.content.decode('utf-8', 'replace').encode('ascii', 'replace') …
Run Code Online (Sandbox Code Playgroud)

unicode google-app-engine

3
推荐指数
1
解决办法
2727
查看次数

在ASP.NET中运行shell命令

我如何在asp.net中运行shell命令?

我基本上想要的东西system("netstat -an");

我不希望输出显示给用户.只想运行一些维护命令.

.net c# asp.net shell

3
推荐指数
1
解决办法
6999
查看次数

Captcha解决方案可以与App Engine一起使用吗?

是否有一个简单的验证码解决方案,可以轻松地与使用Google App Engine部署的表单集成?我正在使用Python.

python api google-app-engine captcha

2
推荐指数
1
解决办法
1059
查看次数

使用Python在运行文本中拆分单词?

我正在写一段代码,它将从正在运行的文本中提取单词.此文本可以包含\ r,\n等分隔符,这些分隔符可能位于文本中.

我想丢弃所有这些分隔符,只提取完整的单词.我怎么能用Python做到这一点?任何可用于在python中处理文本的库?

python parsing text-processing

1
推荐指数
1
解决办法
295
查看次数

在应用程序引擎上使用 urlfetch() 查询除 80 之外的端口上的 URL

是否可以使用 urlfetch() 查询除 80 之外的端口上存在的 URL

我想从非标准端口上的服务器获取数据 -

http://example.com:8000/WebService?input=a

理想的示例是托管在非标准端口上的 Web 服务。

我可以用 appengine 以某种方式做到这一点吗?

port google-app-engine urlfetch

1
推荐指数
1
解决办法
665
查看次数

使用python在GAE中进行子串搜索?

我有一个看起来像这样的模型:

class Search (db.Model) :

 word = db.StringProperty()
Run Code Online (Sandbox Code Playgroud)

一个例子"单词"看起来像word ="thisisaword"

我想搜索搜索子字符串中的所有实体,如"this""isa"等.

我怎么能在使用python的App引擎中做到这一点?

更新:

这里的单词将是域名.所以有一些限制,我猜这个词的大小.例如google.com,facebook.com

当有人搜索"gle"时,我想显示"google.com"

python string search google-app-engine

1
推荐指数
1
解决办法
510
查看次数