[ python-Bugs-956246 ] csv.writer refuses a variable parameter
SourceForge.net
noreply at sourceforge.net
Tue May 18 21:55:12 EDT 2004
Bugs item #956246, was opened at 2004-05-18 16:12
Message generated for change (Comment added) made by montanaro
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=956246&group_id=5470
Category: Python Library
Group: Python 2.3
Status: Deleted
Resolution: None
Priority: 5
Submitted By: Xavier BASSERY (balthus)
Assigned to: Skip Montanaro (montanaro)
Summary: csv.writer refuses a variable parameter
Initial Comment:
Hi,
I've reproduced that bug on both the win client and the
cygwin build (windows 2000).
When i do a call on writer like this :
cvsWriter = csv.writer(pseudoFichier, 'excel',
delimiter=delimiteur)
with delimiteur being a variable == ';' ,
pseudoFichier : a cStringIO
I get that error message :
cvsWriter = csv.writer(pseudoFichier, 'excel',
delimiter=delimiteur)
TypeError: bad argument type for built-in operation
A way to fix it is to replace the variable delimiteur
with it's value, so
cvsWriter = csv.writer(pseudoFichier, 'excel',
delimiter=';')
works like a bliss !
I've tried to look at the source of csv.py just to see
that the method that i wanted to see is imported from a
c library (_csv.lib).
I'm not strong enough to look further.
I hope someone here will be able to find the reason of
what seems to be a bug.
Greetings,
Xavier
----------------------------------------------------------------------
>Comment By: Skip Montanaro (montanaro)
Date: 2004-05-18 20:55
Message:
Logged In: YES
user_id=44345
I can't reproduce the problem:
>>> import csv
>>> import cStringIO
>>> pseudoFichier = cStringIO.StringIO()
>>> delimiteur = ';'
>>> writer = csv.writer(pseudoFichier, 'excel',
delimiter=delimiteur)
>>> writer.writerow([1,2,3,4])
>>> pseudoFichier.getvalue()
'1;2;3;4\r\n'
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=956246&group_id=5470
More information about the Python-bugs-list
mailing list