Opened 9 years ago

Closed 9 years ago

#324 closed defect (fixed)

Installation problem CsvMacro

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

Description (last modified by athomas)

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 9 years ago by athomas

  • Description modified (diff)
  • Status changed from new to assigned

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

comment:2 Changed 9 years ago by anonymous

  • Severity changed from blocker to normal

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 9 years ago by athomas

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 9 years ago by athomas

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 9 years ago by athomas

  • Resolution set to fixed
  • Status changed from assigned to closed

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

Add Comment

Modify Ticket

as closed The owner will remain athomas.
The resolution will be deleted. Next status will be 'reopened'.

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

Note: See TracTickets for help on using tickets.