Python中文
首页
教程
问答
标签
搜索
登录
注册
如何將某些資料傳送到Python和Google地圖引擎中的Thread模組
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<pre><code>from google.appengine.ext import db class Log(db.Model): content = db.StringProperty(multiline=True) class MyThread(threading.Thread): def run(self,request): #logs_query = Log.all().order('-date') #logs = logs_query.fetch(3) log=Log() log.content=request.POST.get('content',None) log.put() def Log(request): thr = MyThread() thr.start(request) return HttpResponse('') </code></pre> <p>错误是:</p> <pre><code>TypeError at /log start() takes exactly 1 argument (2 given) </code></pre> <p>当我不发送请求时</p> <pre><code>class MyThread(threading.Thread): def run(self): log=Log() log.content=request.POST.get('content',None) log.put() def Log(request): thr = MyThread() thr.start() return HttpResponse('') </code></pre> <p>错误是:</p> <pre><code>Exception in thread Thread-1: Traceback (most recent call last): File "D:\Python25\lib\threading.py", line 486, in __bootstrap_inner self.run() File "D:\zjm_code\helloworld\views.py", line 33, in run log.content=request.POST.get('content',None) NameError: global name 'request' is not defined </code></pre>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>我不确定这将满足您的需要,甚至可能在谷歌appengine,但</p> <p>如果将<code>thr.start(request)</code>更改为<code>thr.run(request)</code>,则错误应该消失</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
使用Python创建一个非常大的二进制频率矩阵来运行协作过滤
4 回答
使用Python创建一张HTML网页,其中在不同颜色中重复n遍显示“Hello World”的方法
7 回答
使用Python创建一组唯一的值length L
5 回答
使用python创建不同表格的透视表
4 回答
使用python创建不和谐频道
2 回答
使用python创建不存在的多个文件夹
3 回答
使用python创建串行远程文件
8 回答
使用python创建交互式仪表板时出现问题
5 回答
使用python创建交互式绘图
6 回答
使用python创建交互式自动电子邮件
3 回答
使用Python创建价格列表
2 回答
使用python创建修改的txt文件
9 回答
使用Python创建全局变量,初始化后更改值
2 回答
使用Python创建关键字搜索词数组
3 回答
使用Python创建具有不均匀块大小/堆叠条形图的热图
5 回答
使用Python创建具有依赖于另一列的值的列
3 回答
使用Python创建具有多列的HTML表
1 回答
使用Python创建具有时间范围数据的等距数据帧
3 回答
使用Python创建具有特定顺序或属性的XML文件
6 回答
使用Python创建具有级联功能的搜索栏
9 回答