builtins.TypeError: cannot convert 'method' object to bytes : <p>I am getting "builtins.TypeError: cannot convert 'method' object to bytes" while trying to decode bson data which I have encoded just before. I would like to get the decoded data into a dict for each loop (to insert it in a mongoDb Collection). </p>

<p>I have tried to decode it like that : </p>

<p>1 - decode_datas = bson.BSON(bs).decode() who returns the TypeError</p>

<p>2 - transform = bytes(bs)</p>

<p>decode_data = bson.BSON(transform).decode() : it returns the same error.</p>

<pre><code> for row in metaData:   
        bs = bson.BSON.encode
        (
         {
            'dt': datetime.now(),
            'cid': str(row['clt_id']),
            'pid': str(row['clt_pro_id']),
            'sid': str(row['sit_id']),

            'mtr mid': mid,
            'mtr ez': int(row['met_eziview']),
            'mtr gwt': int(row['met_is_greenwatch_trading']),
            'mtr gs': int(row['met_is_greenstart']),
            'mtr net': int(row['met_without_gprs_network']),
            'mtr act': int(row['sim_is_deactivated']) if row['sim_is_deactivated'] is not None else 1,
            'mtr dt': row['met_first_production_date'] if row['met_first_production_date'] is not None else datetime.min,
            'mtr hea': int(row['inv_pan_heading']),
            'mtr slo': int(row['inv_pan_slope']),
            'mtr wp': wp,
            'mtr _t': sMtdPhases,
            'adr lat': float(row['ad_latitude']),                       
            'adr lon': float(row['ad_longitude']),                       
            'adr zip': str(row['ad_cp']),                       
         }
        )  
 decode_datas = bson.BSON(bs).decode
</code></pre>
