astropy/astropy — pull request #1288 by mdboom (2013-07-26 20:05:00+00:00)
Title: Another unreadable VO table: unit parsing failure

http://vizier.cfa.harvard.edu/viz-bin/votable?-meta.all=1&-words=chen+maser+bgps

In this case, it fails to parse this unit:
`10+22/cm2`
which I assume is meant to be, e.g., `1e+22 / cm2`

Is there any way to tell `votable.parse` to give up on unparseable units?

Full source code required to reproduce:
```
>>> import requests
>>> import StringIO
>>> response = requests.post('http://vizier.cfa.harvard.edu/viz-bin/votable', data={'-meta.all':1,'-words':'chen maser bgps'})
>>> votable.parse(StringIO.StringIO(response.text))
ERROR: TypeError: unsupported operand type(s) for ** or pow(): 'unicode' and 'int' [astropy.units.format.cds]
Traceback (most recent call last):
File "", line 1, in
votable.parse(StringIO.StringIO(response.text))
File "/Volumes/disk5/Users/adam/repos/astropy/astropy/io/votable/table.py", line 129, in parse
config=config, pos=(1, 1)).parse(iterator, config)
File "/Volumes/disk5/Users/adam/repos/astropy/astropy/io/votable/tree.py", line 3256, in parse
iterator, tag, data, config, pos)
File "/Volumes/disk5/Users/adam/repos/astropy/astropy/io/votable/tree.py", line 3185, in _add_resource
resource.parse(self, iterator, config)
File "/Volumes/disk5/Users/adam/repos/astropy/astropy/io/votable/tree.py", line 3030, in parse
iterator, tag, data, config, pos)
File "/Volumes/disk5/Users/adam/repos/astropy/astropy/io/votable/tree.py", line 2987, in _add_table
table.parse(iterator, config)
File "/Volumes/disk5/Users/adam/repos/astropy/astropy/io/votable/tree.py", line 2248, in parse
iterator, tag, data, config, pos)
File "/Volumes/disk5/Users/adam/repos/astropy/astropy/io/votable/tree.py", line 2163, in _add_field
field = Field(self._votable, config=config, pos=pos, **data)
File "/Volumes/disk5/Users/adam/repos/astropy/astropy/io/votable/tree.py", line 1154, in __init__
self.unit = unit
File "/Volumes/disk5/Users/adam/repos/astropy/astropy/io/votable/tree.py", line 1320, in unit
unit, format=default_format, parse_strict='silent')
File "/Volumes/disk5/Users/adam/repos/astropy/astropy/units/core.py", line 1208, in __call__
return f.parse(s)
File "/Volumes/disk5/Users/adam/repos/astropy/astropy/units/format/cds.py", line 292, in parse
return self._parser.parse(s, lexer=self._lexer, debug=debug)
File "/Volumes/disk5/Users/adam/repos/astropy/astropy/extern/ply/yacc.py", line 265, in parse
return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc)
File "/Volumes/disk5/Users/adam/repos/astropy/astropy/extern/ply/yacc.py", line 971, in parseopt_notrack
p.callable(pslice)
File "/Volumes/disk5/Users/adam/repos/astropy/astropy/units/format/cds.py", line 177, in p_division_of_units
p[0] = p[1] ** -1
TypeError: unsupported operand type(s) for ** or pow(): 'unicode' and 'int'
```