astropy/astropy — pull request #1949 by taldcroft (2014-01-07 19:43:37+00:00)
Title: delimiter in CSV writer should support unicode

I think the following should probably be made to work:

```
In [6]: t.write('test.csv', format='ascii', delimiter=u',')
ERROR: TypeError: "delimiter" must be an 1-character string [astropy.io.ascii.core]
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in ()
----> 1 t.write('test.csv', format='ascii', delimiter=u',')

/Users/tom/Library/Python/2.7/lib/python/site-packages/astropy-0.4.dev6923-py2.7-macosx-10.8-x86_64.egg/astropy/table/table.pyc in write(self, *args, **kwargs)
1732 passed through to the underlying data reader (e.g. `~astropy.io.ascii.ui.write`).
1733 """
-> 1734 io_registry.write(self, *args, **kwargs)
1735
1736 def copy(self, copy_data=True):

/Users/tom/Library/Python/2.7/lib/python/site-packages/astropy-0.4.dev6923-py2.7-macosx-10.8-x86_64.egg/astropy/io/registry.pyc in write(data, *args, **kwargs)
356
357 writer = get_writer(format, data.__class__)
--> 358 writer(data, *args, **kwargs)
359
360

/Users/tom/Library/Python/2.7/lib/python/site-packages/astropy-0.4.dev6923-py2.7-macosx-10.8-x86_64.egg/astropy/io/ascii/connect.pyc in write_asciitable(table, filename, **kwargs)
23 def write_asciitable(table, filename, **kwargs):
24 from .ui import write
---> 25 return write(table, filename, **kwargs)
26
27 io_registry.register_writer('ascii', Table, write_asciitable)

/Users/tom/Library/Python/2.7/lib/python/site-packages/astropy-0.4.dev6923-py2.7-macosx-10.8-x86_64.egg/astropy/io/ascii/ui.pyc in write(table, output, format, Writer, **kwargs)
293 Writer = _get_format_class(format, Writer, 'Writer')
294 writer = get_writer(Writer=Writer, **kwargs)
--> 295 lines = writer.write(table)
296
297 # Write the lines to output

/Users/tom/Library/Python/2.7/lib/python/site-packages/astropy-0.4.dev6923-py2.7-macosx-10.8-x86_64.egg/astropy/io/ascii/core.pyc in write(self, table)
914 # Write header and data to lines list
915 lines = []
--> 916 self.header.write(lines)
917 self.data.write(lines)
918

/Users/tom/Library/Python/2.7/lib/python/site-packages/astropy-0.4.dev6923-py2.7-macosx-10.8-x86_64.egg/astropy/io/ascii/core.pyc in write(self, lines)
414 itertools.cycle(self.write_spacer_lines)):
415 lines.append(spacer_line)
--> 416 lines.append(self.splitter.join([x.name for x in self.cols]))
417
418 @property

/Users/tom/Library/Python/2.7/lib/python/site-packages/astropy-0.4.dev6923-py2.7-macosx-10.8-x86_64.egg/astropy/io/ascii/core.pyc in join(self, vals)
294 quotechar=self.quotechar,
295 quoting=self.quoting,
--> 296 lineterminator='',
297 )
298 self.csv_writer_out.seek(0)

TypeError: "delimiter" must be an 1-character string
```

I found this in a script that was importig ``unicode_literals`` from ``__future__``

cc @taldcroft