rethinkdb / rethinkdb/docs

Troubleshooting - AttributeError "..." has no method "..."

Open
#377 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
CSS
Stars
118
Forks
161
PR merge metrics
No merged PRs in 30d

Description

Something that I've seen a few times is when a user create a function and

AttributeError: 'float' object has no attribute 'do'

Basically will do something like

def reql_cos(x)
  return x.do(lamba x: ... ))

Which throws if you call reql_cos with a float and not a ReQL term.

The proper way to define a function that may take non reql terms as arguments is to wrap them in r.expr
Something like

def reql_cos(x)
  return r.expr(x).do(lamba x: ... ))

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue does not name a documentation file or test. Start by locating the troubleshooting documentation and review nearby entries, then add guidance for AttributeError cases caused by calling a ReQL method on a non-ReQL value, including the r.expr example shown here. Done means the troubleshooting page explains the cause and the documented remedy clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.