fixed bug with items_to_csv and Excel. thanks Mat for the patch. See:

http://groups.google.com/group/scrapy-developers/browse_thread/thread/9e2b80d226333011

--HG--
extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40838
This commit is contained in:
Pablo Hoffman 2009-02-10 02:43:19 +00:00
parent 1b2de80124
commit 90c1597cef
1 changed files with 3 additions and 2 deletions

View File

@ -140,7 +140,7 @@ def items_to_csv(file, items, delimiter=';', headers=None):
return
if isinstance(file, basestring):
file = open(file, 'a+')
file = open(file, 'ab+')
csv_file = csv.writer(file, delimiter=delimiter, quoting=csv.QUOTE_ALL)
header = headers or sorted([key for key in items[0].__dict__.keys() if not key.startswith('_')])
if not file.tell():
@ -157,7 +157,8 @@ def items_to_csv(file, items, delimiter=';', headers=None):
CAMELCASE_INVALID_CHARS = re.compile('[^a-zA-Z]')
def string_camelcase(string):
""" Convert a word to it CamelCase version
""" Convert a word to its CamelCase version and remove invalid chars
>>> string_camelcase('lost-pound')
LostPound