memory error while downloading the report

118 views
Skip to first unread message

Chaitanya Phani

unread,
Jan 23, 2018, 3:40:35 PM1/23/18
to AdWords API Forum

Hi, 

Trying to pull product report for one week only, got the following error. 

Error Message:

Traceback (most recent call last):
 
File "get_campaigns_new1.py", line 154, in <module>
    main
(adwords_client)
 
File "get_campaigns_new1.py", line 146, in main
    download_Performance_Criteria_Report
()
 
File "get_campaigns_new1.py", line 140, in download_Performance_Criteria_Report
    rep_downloader
.DownloadReport(report,output=_f,skip_report_header=False,skip_column_header=False,skip_report_summary=True)
 
File "C:\Python27\lib\site-packages\googleads\common.py", line 535, in Wrapper
   
return utility_method(*args, **kwargs)
 
File "C:\Python27\lib\site-packages\googleads\adwords.py", line 1361, in DownloadReport
    output
, **kwargs)
 
File "C:\Python27\lib\site-packages\googleads\adwords.py", line 1635, in _DownloadReport
   
else response.read())
 
File "C:\Python27\lib\socket.py", line 363, in read
   
return buf.getvalue()
MemoryError


This is the code I am using.
def download_Performance_Criteria_Report():
 
for client_customer_id in list(set(advertiser_accounts)):
   
print client_customer_id
    o2client
= GoogleRefreshTokenClient(adc['client_id'],adc['client_secret'],adc['refresh_token'])
    client
=AdWordsClient(adc['developer_token'],o2client,'OBI',client_customer_id=client_customer_id)
    _fpath
=os.path.join('D:/adwords/temp/Adwords_Shopping_MMA_'+str(client_customer_id)+'_'+datetime.datetime.now().strftime( "%Y%m%d%H%M") + '.csv')
 
##    client = AdWordsClient.LoadFromStorage('googleads.yaml')
    rep_downloader
= client.GetReportDownloader(version='v201710')
    report
= {
           
'reportName' : 'SHOPPING_PERFORMANCE_REPORT',
           
'dateRangeType' :'CUSTOM_DATE',
           
'reportType': 'SHOPPING_PERFORMANCE_REPORT',
           
'downloadFormat': 'CSV',
           
'selector': {
               
'fields': ['AccountDescriptiveName','AdGroupId','AdGroupName','AggregatorId','Brand','CampaignId','CampaignName','CategoryL1','CategoryL2','CategoryL3','CategoryL4','CategoryL5','CountryCriteriaId','CustomAttribute0','CustomAttribute1','CustomAttribute2','CustomAttribute3','CustomAttribute4','ExternalCustomerId','LanguageCriteriaId','MerchantId','OfferId','ProductTypeL1','ProductTypeL2','ProductTypeL3','ProductTypeL4','ProductTypeL5','StoreId','Date','AverageCpc','Clicks','ConversionRate','Conversions','ConversionValue','Cost','CostPerAllConversion','CostPerConversion','CrossDeviceConversions','Ctr','Impressions'],
               
'dateRange' : { 'min': '20171225' , 'max' : '20171231'}
               
}
           
}
    _f
=open(_fpath,'wb')
    rep_downloader
.DownloadReport(report,output=_f,skip_report_header=False,skip_column_header=False,skip_report_summary=True)


Please help me to fix this. 

Thanks,

Vincent Racaza (AdWords API Team)

unread,
Jan 24, 2018, 12:25:59 AM1/24/18
to AdWords API Forum
Hi Chaitanya,

The memory error that you are encountering seems to be a specific issue in your application/server, and not with the AdWords API itself. I suggest that you visit other forums on how to resolve memory error issues in Python. You may also post this concern in the Python client library itself as the library owners can provide better assistance on Python specific issues.

However, if you believe that this is an AdWords API specific issue, then kindly provide your clientCustomerId via Reply privately to author option so I can further check.

Thanks,
Vincent
AdWords API Team
Reply all
Reply to author
Forward
0 new messages