jendrikseipp / vulture

Find dead Python code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: 'Tuple' object has no attribute 'id'

AdnanMuhib opened this issue · comments

At the root directory of a an old big django 1.7, python 2.7 project, I ran vulture .
I got the following error.

Traceback (most recent call last):
  File "/home/xyz/webapps/django/bin/vulture", line 8, in <module>
    sys.exit(main())
  File "/home/xyz/webapps/django/lib/python2.7/site-packages/vulture/core.py", line 772, in main
    vulture.scavenge(args.paths, exclude=args.exclude)
  File "/home/xyz/webapps/django/lib/python2.7/site-packages/vulture/core.py", line 288, in scavenge
    self.scan(module_string, filename=module)
  File "/home/xyz/webapps/django/lib/python2.7/site-packages/vulture/core.py", line 259, in scan
    self.visit(node)
  File "/home/xyz/webapps/django/lib/python2.7/site-packages/vulture/core.py", line 664, in visit
    return self.generic_visit(node)
  File "/home/xyz/webapps/django/lib/python2.7/site-packages/vulture/core.py", line 698, in generic_visit
    self.visit(item)
  File "/home/xyz/webapps/django/lib/python2.7/site-packages/vulture/core.py", line 663, in visit
    visitor(node)
  File "/home/xyz/webapps/django/lib/python2.7/site-packages/vulture/core.py", line 580, in visit_FunctionDef
    first_arg = node.args.args[0].id
AttributeError: 'Tuple' object has no attribute 'id'

Vulture doesn't run on Python 2. That's expected, especially over 4 years after Python 2 is EOL...

Vulture doesn't run on Python 2. That's expected, especially over 4 years after Python 2 is EOL...

Thanks @The-Compiler for your response.
For me, the idea was to use Vulture on a legacy monolith application which has a lot of dead code. After removing the dead code, upgrade to newer python/django and other dependencies.

You can use Vulture 1.6 for this. That's the last version to support Python 2.7.