Troubleshooting - AttributeError "..." has no method "..."
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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