【问题标题】:Waitress in Pyramid 1.4金字塔中的女服务员 1.4
【发布时间】:2013-10-20 06:07:17
【问题描述】:

我有一个用 Python 2.7.5 编写的程序,我想将它转移到我在 WebFaction 上托管的帐户中。在那里,我想使用 Pyramid 1.4/Python 2.7 来实现它。我已经安装了所有软件包,但似乎 Pyramid 本身有问题。我使用的软件包列表下方是我得到的错误。

md5, sys, os, tempfile, json, re, urllib2, time, multiprocessing requests

2013-10-18 21:37:48,821 ERROR [waitress][Dummy-1] Exception when serving /
Traceback (most recent call last):
  File "/home/.../lib/python2.7/waitress/channel.py", line 329, in service
    task.service()
  File "/home/.../lib/python2.7/waitress/task.py", line 173, in service
    self.execute()
  File "/home/.../lib/python2.7/waitress/task.py", line 412, in execute
    self.write(chunk)
  File "/home/.../lib/python2.7/waitress/task.py", line 303, in write
    channel.write_soon(towrite)
  File "/home/.../lib/python2.7/waitress/channel.py", line 311, in write_soon
    self.outbufs[-1].append(data)
  File "/home/.../lib/python2.7/waitress/buffers.py", line 243, in append
    self.strbuf = strbuf + s
TypeError: cannot concatenate 'str' and 'list' objects

对如何调试有什么建议吗?

【问题讨论】:

    标签: python multiprocessing pyramid waitress


    【解决方案1】:

    解决方案很简单,但并不那么明显。在 view.py 我有一个正在返回的视图

    Response(x)
    

    其中 x 是我的多进程代码的输出,但它也是一个 list。这导致了一个问题。最后我使用 render_to_response 并将结果作为字典的一部分传递

    return render_to_response('main.mak', {'results':x})
    

    【讨论】:

      猜你喜欢
      • 2018-03-07
      • 1970-01-01
      • 2021-06-03
      • 2020-10-12
      • 2015-01-03
      • 1970-01-01
      • 2017-03-17
      • 1970-01-01
      • 2019-09-14
      相关资源
      最近更新 更多