【发布时间】:2014-05-11 00:28:52
【问题描述】:
对于无法进一步说明问题,我深表歉意,但那是因为我不明白这里出了什么问题。该错误是由第 75 行引起的,但他拥有我调用的变量的所有值。我显然在这里遗漏了一些东西,我希望有人能告诉我什么。
我正在尝试为列表的每个部分添加一个字符串到一个变量中。
<type 'exceptions.MemoryError'> Python 2.6.4: /opt/users/ipg/s/p/ipg.*********/python/python
Sat May 10 19:42:39 2014
A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
73 """ % (description[field_count].value)
74 for item in upload_field:
75 article_content += '<img src="http://www.*****.com/images/%s/%s">' % (link_title, item.filename)
76 field_count = field_count + 1
77 elif isinstance(description, basestring):
___
article_content undefined, link_title = 'sssfzxs', item = FieldStorage('upload_image1', '857143_7542303279...\x94\x01\xa3\x89\x82\xcc0\xc9n\xea/\x87\xff\xd9'), item.filename = '857143_754230327924155_1256712041_o.jpg'
<type 'exceptions.MemoryError'>:
args = ()
message = ''
【问题讨论】:
-
使用
+=运算符构建字符串的内存效率非常低。大概你正在构建一个如此大的字符串,以至于你的可用内存不足。不过,这里没有足够的信息可以说更多。 -
@Wooble 这通常只会将 3 次添加到空字符串中,因此通常它不会很快耗尽内存。
标签: python exception out-of-memory python-2.6