datetime.now isn't correct

If you just do a plain vanilla 'import datetime' (as is implied by the lack of an import in the example) then you need to call datetime.datetime.now(), not datetime.now().