astropy/astroquery — pull request #371 by keflavich (2014-07-09 11:53:50+00:00)
Title: Simbad query_object() with wildcard returns no results

```
>>> print astroquery.simbad.Simbad.query_object("m [0-9]", wildcard=True)
MAIN_ID RA DEC RA_PREC DEC_PREC COO_ERR_MAJA COO_ERR_MINA COO_ERR_ANGLE COO_QUAL COO_WAVELENGTH COO_BIBCODE
------- --- --- ------- -------- ------------ ------------ ------------- -------- -------------- -----------
>>> print astroquery.simbad.Simbad.last_parsed_result.script
votable {main_id,coordinates}
votable open
query id wildcard m [0-9]
votable close
>>> print astroquery.simbad.Simbad.last_parsed_result.error_raw
[3] Identifier not found in the database : ^ +m +[0-9]$
```

The problem is the leading space, from this line in `astroquery.simbad.Simbad._args_to_payload()`:

```
script += ' '.join([" ", args_str, kwargs_str, "\n"])
```

Removing the leading space breaks many tests, however. I don't have a good idea for a quick fix at the moment. `_args_to_payload()` is an ugly function that should probably be eliminated in favor of query-specialized script-building code, instead of this "one function does all" approach...

Note that the tests aren't picking this bug up at the moment because they simply check that the result is an instance of `astropy.table.Table`.