-1

I have this basic namedtuple:

from collections import namedtuple

DBInfos = namedtuple('dbname', 'dbpath', 'dbfile')

When I try to instantiate one with

d = DBInfos._make(['test', 'a/b/c', '.index.db'])

I get the following error:

Traceback (most recent call last):
 File "./test.py", line 5, in <module>
 d = DBInfos._make(['test', 'a/b/c', '.index.db'])
 File "<string>", line 21, in _make
TypeError: Expected 1 arguments, got 3

But I don't know why :/

valentin
  • 2,596
  • 6
  • 28
  • 48

1 Answers1

3

Your call to the namedtuple function is incorrect. It should be:

DBInfos = namedtuple('DBInfos', ['dbname', 'dbpath', 'dbfile'])

See: https://docs.python.org/2.7/library/collections.html#collections.namedtuple

jangler
  • 949
  • 6
  • 7