For web3 v5.x.x,

Event Log Filters is as follows:

event_filter= myContract.events.<event_name>.createFilter(fromBlock="latest", argument_filters={'arg1':10}) 

Goal: I want to print logs of the smart contract, like I do on web3.js, using web3.py.

On web3.js side, following code piece works:

var event = myContract.LogJob({}, {fromBlock:0, toBlock:'latest'});
event.watch(function(error, result) {

But on the web3.py side I was not able to make it work. :( I have followed following documentation.

event_filter = myContract.eventfilter('LogJob', {'filter': {'arg1':10}})

Error I am having:

AttributeError: 'Contract' object has no attribute 'eventFilter'

I have also tried following line of code, but it did not worked as well:

event = myContract.call().LogJob({}, {'fromBlock':100, 'toBlock':110});

[Q] Am I doing something wrong? How could I fix this?

1 Answer 1


You're trying to use a v4 feature. Chances are good that you have v3 installed. To install the latest v4 version, use:

pip3 install --upgrade web3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.