Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typing r.table_list() into Python repl throws an error #1005

Closed
coffeemug opened this issue Jun 13, 2013 · 4 comments
Closed

Typing r.table_list() into Python repl throws an error #1005

coffeemug opened this issue Jun 13, 2013 · 4 comments
Assignees
Milestone

Comments

@coffeemug
Copy link
Contributor

Type this in the repl:

import rethinkdb as r
r.table_list()

Output:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/rethinkdb/ast.py", line 54, in __repr__
    return "<RqlQuery instance: %s >" % str(self)
  File "/usr/local/lib/python2.7/site-packages/rethinkdb/ast.py", line 51, in __str__
    return qp.print_query()
  File "/usr/local/lib/python2.7/site-packages/rethinkdb/errors.py", line 38, in print_query
    return ''.join(self.compose_term(self.root))
  File "/usr/local/lib/python2.7/site-packages/rethinkdb/errors.py", line 48, in compose_term
    return term.compose(args, optargs)
  File "/usr/local/lib/python2.7/site-packages/rethinkdb/ast.py", line 361, in compose
    if needs_wrap(self.args[0]):
IndexError: list index out of range

Note, I'm not trying to send it to the server. It's likely a printing bug.

@ghost ghost assigned wmrowan Jun 13, 2013
@wmrowan
Copy link
Contributor

wmrowan commented Jun 13, 2013

Yeah. Looks like this will throw anytime we try to print a 0 argument AST node.

@wmrowan
Copy link
Contributor

wmrowan commented Jun 13, 2013

Note that this is another issue that would have been caught by proper backtrace tests.

@wmrowan
Copy link
Contributor

wmrowan commented Jun 13, 2013

This is in review 638 by @coffeemug

The underlying issue is the duality between r.table_list and r.db(...).table_list(). We try to print both as the latter but choke when we find there is no db argument. The same applies for table_create and table_drop.

@wmrowan
Copy link
Contributor

wmrowan commented Jun 17, 2013

This is in v1.6.x and next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants