Opened 12 years ago

Closed 12 years ago

#324 closed defect (fixed)

Installation problem CsvMacro

Reported by: anonymous Owned by: Alec Thomas
Priority: normal Component: CsvMacro
Severity: normal Keywords:
Cc: Trac Release: 0.9

Description (last modified by Alec Thomas)

Python Traceback

Traceback (most recent call last):
  File "/usr/local/python/lib/python2.4/site-packages/trac/web/", line 300, in dispatch_request
  File "/usr/local/python/lib/python2.4/site-packages/trac/web/", line 176, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/local/python/lib/python2.4/site-packages/trac/wiki/", line 93, in process_request
    self._render_editor(req, db, page, preview=True)
  File "/usr/local/python/lib/python2.4/site-packages/trac/wiki/", line 312, in _render_editor
    info['page_html'] = wiki_to_html(page.text, self.env, req, db)
  File "/usr/local/python/lib/python2.4/site-packages/trac/wiki/", line 825, in wiki_to_html
    Formatter(env, req, absurls, db).format(wikitext, out, escape_newlines)
  File "/usr/local/python/lib/python2.4/site-packages/trac/wiki/", line 651, in format
  File "/usr/local/python/lib/python2.4/site-packages/trac/wiki/", line 621, in handle_code_block
    self.out.write(self.code_processor.process(self.req, self.code_text))
  File "/usr/local/python/lib/python2.4/site-packages/trac/wiki/", line 104, in process
    text = self.processor(req, text)
  File "/usr/local/python/lib/python2.4/site-packages/trac/wiki/", line 94, in _macro_processor
    return macro_provider.render_macro(req,, text)
  File "/usr/local/python/lib/python2.4/site-packages/trac/wiki/", line 501, in render_macro
    return module.execute(req and req.hdf, content, self.env)
  File "/var/www/cvsdude/trac/telerespons/kundeservice/wiki-macros/", line 7, in execute
    reader = csv.reader(StringIO(txt), dialect=sniffer.sniff(txt))
TypeError: bad argument type for built-in operation

(trac 0.10pre)

Any ideas?

Attachments (0)

Change History (5)

comment:1 Changed 12 years ago by Alec Thomas

Description: modified (diff)
Status: newassigned

No idea, can you provide me with a CSV sample that causes this?

comment:2 Changed 12 years ago by anonymous

Severity: blockernormal

I played around some more, and it wasn´t totally broken after all :-)

  • The code doesn´t produce valid html tables when there is a variable number of cells in each line, or blank cells.
  • If a blank line is produced above the csv data, it results in a blank table.
  • Also, it causes an exception if characters such as æøå is used.

comment:3 Changed 12 years ago by Alec Thomas

To fix the first problem would require two passes over the CSV object, the first to determine the total number of columns.

Second problem is not really a problem, it's a misuse IMO :). It also must be a feature of the underlying Python csv module.

And the exception is the one above?

comment:4 Changed 12 years ago by Alec Thomas

Apparently the csv module does not handle Unicode. I will force the input to ASCII and replace any Unicode characters.

I've also removed the sniffer call as it doesn't actually seem to be necessary.

comment:5 Changed 12 years ago by Alec Thomas

Resolution: fixed
Status: assignedclosed

(In [708]) Fix for lack of Unicode support in Python's csv module. Closes #324

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Alec Thomas.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.