Feature Requests item #1634717, was opened at 2007-01-13 14:53 Message generated for change (Comment added) made by gbrandl You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1634717&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: None >Status: Closed >Resolution: Accepted Priority: 5 Private: No Submitted By: Gabriel Genellina (gagenellina) Assigned to: Nobody/Anonymous (nobody) Summary: csv.DictWriter: Include offending name in error message Initial Comment: In csv.py, class DictWriter, method _dict_to_list, when rowdict contains a key that is not a known field name, a ValueError is raised, but no reference to the offending name is given. As the code iterates along the dict keys, and stops at the first unknown one, its trivial to include such information. Replace lines: if k not in self.fieldnames: raise ValueError, "dict contains fields not in fieldnames" with: if k not in self.fieldnames: raise ValueError, "dict contains field not in fieldnames: %r" % k ---------------------------------------------------------------------- >Comment By: Georg Brandl (gbrandl) Date: 2007-03-13 09:32 Message: Logged In: YES user_id=849994 Originator: NO Patch was applied, closing this as Accepted. ---------------------------------------------------------------------- Comment By: Mark Roberts (mark-roberts) Date: 2007-01-15 00:04 Message: Logged In: YES user_id=1591633 Originator: NO Even better would be a list of all extraneous fields fields. I offered patch 1635454. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1634717&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com