Skip to content

txmongo/examples/deferreds/insert.py is not working in Python 3.6.x and mongo 3.2.16 #215

@harshathulasi

Description

@harshathulasi

When trying to execute the "txmongo/examples/deferreds/insert.py" script, script fails with the following message:

~/twsited_mongo_play$ python3 dummy.py
2017-09-10 18:53:36-0700 [-] Log opened.
2017-09-10 18:53:36-0700 [-] getting connection...
2017-09-10 18:53:36-0700 [-] Starting factory <txmongo.connection._Connection object at 0x7f04044ee160>
2017-09-10 18:53:36-0700 [-] Connection is: Connection('127.0.0.1', 27017)
2017-09-10 18:53:36-0700 [-] Traceback (most recent call last):
2017-09-10 18:53:36-0700 [-] File "dummy.py", line 76, in
2017-09-10 18:53:36-0700 [-] example()
2017-09-10 18:53:36-0700 [-] File "dummy.py", line 61, in example
2017-09-10 18:53:36-0700 [-] d.addCallback(getDatabase, "vel_test")
2017-09-10 18:53:36-0700 [-] TypeError: call() takes 2 positional arguments but 3 were given
~/twsited_mongo_play$

Not sure if this code is compatible with python3 or some version mismatch:

def example():
    d = getConnection()
    errback_out = d.addErrback(log.err)
    d.addCallback(getDatabase, "vel_test")
    d.addCallback(getCollection, "messages")
    d.addCallback(insertData)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions