Skip to content
This repository has been archived by the owner on Nov 11, 2020. It is now read-only.

TypeError: '_Yes' object is not iterable #4

Closed
mrunge opened this issue May 2, 2011 · 19 comments
Closed

TypeError: '_Yes' object is not iterable #4

mrunge opened this issue May 2, 2011 · 19 comments

Comments

@mrunge
Copy link

mrunge commented May 2, 2011

I cloned https://github.com/mollyproject/mollyproject.git

cd to mollyproject/molly/apps/home
and run django-lint views.py

returns

[mrunge@mrungexp home]$ django-lint views.py
Traceback (most recent call last):
File "/usr/bin/django-lint", line 25, in
sys.exit(script.main())
File "/usr/lib/python2.7/site-packages/DjangoLint/script.py", line 120, in main
linter.check([target])
File "/usr/lib/python2.7/site-packages/pylint/lint.py", line 489, in check
self.check_astng_module(astng, walker, rawcheckers)
File "/usr/lib/python2.7/site-packages/pylint/lint.py", line 563, in check_astng_module
walker.walk(astng)
File "/usr/lib/python2.7/site-packages/pylint/utils.py", line 520, in walk
self.walk(child)
File "/usr/lib/python2.7/site-packages/pylint/utils.py", line 517, in walk
cb(astng)
File "/usr/lib/python2.7/site-packages/DjangoLint/AstCheckers/model_methods.py", line 117, in visit_class
if not is_model(node):
File "/usr/lib/python2.7/site-packages/DjangoLint/AstCheckers/utils.py", line 40, in is_model
for node in nodes:
TypeError: '_Yes' object is not iterable

@cnorthwood
Copy link

the Molly tree's changed significantly since I submitted this bug to the Fedora issue tracker. To replicate now, you need to checkout the 'oxford_stable' branch of Molly: https://github.com/mollyproject/mollyproject/tree/oxford_stable

@mrunge
Copy link
Author

mrunge commented May 2, 2011

I think, this does not matter, because the error is the same (even with another file of molly), don't you think?

@cnorthwood
Copy link

True, but I thought I'd include it incase someone tries to replicate using exactly the issues in the Fedora bug tracker :) (although I now notice run it on the same files in this report as on the downstream bug, oops!)

@sidmitra
Copy link

I can replicate this on a closed project:

Here's the trace:
Traceback (most recent call last):
File "/home/sid/.virtualenvs/project/bin/django-lint", line 8, in
load_entry_point('django-lint==0.0.0', 'console_scripts', 'django-lint')()
File "/home/sid/.virtualenvs/project/src/djangolint/DjangoLint/script.py", line 139, in main
linter.check([target])
File "/home/sid/.virtualenvs/project/lib/python2.7/site-packages/pylint/lint.py", line 493, in check
self.check_astng_module(astng, walker, rawcheckers)
File "/home/sid/.virtualenvs/project/lib/python2.7/site-packages/pylint/lint.py", line 565, in check_astng_module
walker.walk(astng)
File "/home/sid/.virtualenvs/project/lib/python2.7/site-packages/pylint/utils.py", line 524, in walk
self.walk(child)
File "/home/sid/.virtualenvs/project/lib/python2.7/site-packages/pylint/utils.py", line 521, in walk
cb(astng)
File "/home/sid/.virtualenvs/project/src/djangolint/DjangoLint/AstCheckers/model_methods.py", line 127, in visit_class
if is_model(node):
File "/home/sid/.virtualenvs/project/src/djangolint/DjangoLint/AstCheckers/utils.py", line 25, in is_model
return nodeisinstance(node, ('django.db.models.base.Model',), **kwargs)
File "/home/sid/.virtualenvs/project/src/djangolint/DjangoLint/AstCheckers/utils.py", line 43, in nodeisinstance
for node in nodes:
TypeError: '_Yes' object is not iterable

@mrooney
Copy link

mrooney commented May 31, 2011

I don't see a way to subscribe / vote without "me too"ing, so, we're also seeing this issue. Has anyone worked around it?

@mrunge
Copy link
Author

mrunge commented Jun 14, 2011

I tested with a try/except-block. This will at least end this error message, but I'm unsure, if the error is caused by something else broken.

@vladimiroff
Copy link
Contributor

Same issue out here with any project I have.

@robfig
Copy link

robfig commented Jul 28, 2011

Ditto, doesn't work for me

@rbdcti
Copy link

rbdcti commented Aug 3, 2011

same...seems related to http://www.logilab.org/ticket/20464

I grabbed the newest astng from logilab's mercurial repo but it still didn't fix the issue. Seems to be multiple manifestations of this bug and they've only partially fixed it.

case in point, my traceback is a bit different:

Traceback (most recent call last):
File "/usr/bin/django-lint", line 25, in
sys.exit(script.main())
File "/usr/lib/pymodules/python2.7/DjangoLint/script.py", line 120, in main
linter.check([target])
File "/usr/lib/pymodules/python2.7/pylint/lint.py", line 493, in check
self.check_astng_module(astng, walker, rawcheckers)
File "/usr/lib/pymodules/python2.7/pylint/lint.py", line 565, in check_astng_module
walker.walk(astng)
File "/usr/lib/pymodules/python2.7/pylint/utils.py", line 526, in walk
cb(astng)
File "/usr/lib/pymodules/python2.7/DjangoLint/AstCheckers/settings.py", line 42, in leave_module
self.check_middleware(node)
File "/usr/lib/pymodules/python2.7/DjangoLint/AstCheckers/settings.py", line 81, in check_middleware
middleware = self.get_constant_values(node, 'MIDDLEWARE_CLASSES')
File "/usr/lib/pymodules/python2.7/DjangoLint/AstCheckers/settings.py", line 78, in get_constant_values
return [(x, x.value) for x in xs if isinstance(safe_infer(x), astng.Const)]
TypeError: '_Yes' object is not iterable

@tijs
Copy link

tijs commented Aug 18, 2011

Afraid i have the same issue, slightly different trace: http://dpaste.com/597179/

@patrys
Copy link
Contributor

patrys commented Sep 13, 2011

I've submitted a pull request with a fix for that as issue #5.

@rbdcti
Copy link

rbdcti commented Sep 13, 2011

Awesome, I'll check it out.

Robby

On Sep 13, 2011, at 7:18 AM, Patryk Zawadzki
reply@reply.github.com
wrote:

I've submitted a pull request with a fix for that as issue #5.

Reply to this email directly or view it on GitHub:
#4 (comment)

@vladimiroff
Copy link
Contributor

@patrys, I've just tried and it doesn't fix it with your patch, either.

@patrys
Copy link
Contributor

patrys commented Sep 13, 2011

@vladimiroff, can you point me to code that breaks?

@vladimiroff
Copy link
Contributor

Sadly, but no. In a day or two will try to inspect it deeper.

@vladimiroff
Copy link
Contributor

It seems like I've fixed it. Works like a charm on my side, but could someone else test it?
#6

@justquick
Copy link

Just tried to setup pylint/django-lint for the first time and ran into this issue. I downloaded the patch above and seems to fix the TypeError but I am also getting a ValueError which might be related. It is able to give me some feedback but craps out before finishing. If this is an unrelated error I can raise a new issue.

https://gist.github.com/1389784

Example project is from https://github.com/justquick/django-activity-stream

@mrunge
Copy link
Author

mrunge commented Dec 2, 2011

I recently pushed a patched version to Fedora 16, based on Vladimiroffs fix.

lamby added a commit that referenced this issue Jan 23, 2012
@lamby
Copy link
Owner

lamby commented Jan 23, 2012

merged

@lamby lamby closed this as completed Jan 23, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests