> > I am trying to programmatically add/update user lists in AdWords, I;ve got > to the code so far by following code examples in the docs, but when I try > to create a list I get the error *TypeError: can't pickle CompiledFFI > objects*, and I can't work out how to get around it!
from googleads import oauth2 key_file='my_key.json' application_name = "test" # Initialize the GoogleRefreshTokenClient using the credentials you received # in the earlier steps. oauth2_client = oauth2.GoogleServiceAccountClient( key_file, oauth2.GetAPIScope('adwords')) # Initialize the Ad Manager client. client = adwords.AdWordsClient(oauth2_client, application_name) user_list_service = client.GetService('AdwordsUserListService', 'v201809') user_list = { 'xsi_type': 'CrmBasedUserList', 'name': 'Test list #%d' % uuid.uuid4(), 'description': 'A test list', # CRM-based user lists can use a membershipLifeSpan of 10000 to indicate # unlimited; otherwise normal values apply. 'membershipLifeSpan': 30, 'uploadKeyType': 'CONTACT_INFO' } # Create an operation to add the user list. operations = [{ 'operator': 'ADD', 'operand': user_list }] result = user_list_service.mutate(operations) And here is the full error: --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-43-797ee50d19e7> in <module> 5 }] 6 ----> 7 result = user_list_service.mutate(operations) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\googleads\common.py in MakeSoapRequest(*args) 1380 try: 1381 return soap_service_method( -> 1382 *packed_args, _soapheaders=soap_headers)['body']['rval'] 1383 except zeep.exceptions.Fault as e: 1384 error_list = () ~\AppData\Local\Continuum\anaconda3\lib\site-packages\zeep\proxy.py in __call__(self, *args, **kwargs) 40 return self._proxy._binding.send( 41 self._proxy._client, self._proxy._binding_options, ---> 42 self._op_name, args, kwargs) 43 44 ~\AppData\Local\Continuum\anaconda3\lib\site-packages\zeep\wsdl\bindings\soap.py in send(self, client, options, operation, args, kwargs) 119 operation, args, kwargs, 120 client=client, --> 121 options=options) 122 123 response = client.transport.post_xml( ~\AppData\Local\Continuum\anaconda3\lib\site-packages\zeep\wsdl\bindings\soap.py in _create(self, operation, args, kwargs, client, options) 66 67 # Create the SOAP envelope ---> 68 serialized = operation_obj.create(*args, **kwargs) 69 self._set_http_headers(serialized, operation_obj) 70 ~\AppData\Local\Continuum\anaconda3\lib\site-packages\zeep\wsdl\definitions.py in create(self, *args, **kwargs) 198 199 def create(self, *args, **kwargs): --> 200 return self.input.serialize(*args, **kwargs) 201 202 def process_reply(self, envelope): ~\AppData\Local\Continuum\anaconda3\lib\site-packages\zeep\wsdl\messages\soap.py in serialize(self, *args, **kwargs) 61 # Create the soap:header element 62 headers_value = kwargs.pop('_soapheaders', None) ---> 63 header = self._serialize_header(headers_value, nsmap) 64 if header is not None: 65 envelope.append(header) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\zeep\wsdl\messages\soap.py in _serialize_header(self, headers_value, nsmap) 322 return 323 --> 324 headers_value = copy.deepcopy(headers_value) 325 326 soap = ElementMaker(namespace=self.nsmap['soap-env'], nsmap=nsmap) ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 148 copier = _deepcopy_dispatch.get(cls) 149 if copier: --> 150 y = copier(x, memo) 151 else: 152 try: ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _deepcopy_dict(x, memo, deepcopy) 238 memo[id(x)] = y 239 for key, value in x.items(): --> 240 y[deepcopy(key, memo)] = deepcopy(value, memo) 241 return y 242 d[dict] = _deepcopy_dict ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 159 copier = getattr(x, "__deepcopy__", None) 160 if copier: --> 161 y = copier(memo) 162 else: 163 reductor = dispatch_table.get(cls) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\zeep\xsd\valueobjects.py in __deepcopy__(self, memo) 144 def __deepcopy__(self, memo): 145 new = type(self)() --> 146 new.__values__ = copy.deepcopy(self.__values__) 147 for attr, value in self.__dict__.items(): 148 if attr != '__values__': ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 178 y = x 179 else: --> 180 y = _reconstruct(x, memo, *rv) 181 182 # If is its own copy, don't memoize. ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy) 304 for key, value in dictiter: 305 key = deepcopy(key, memo) --> 306 value = deepcopy(value, memo) 307 y[key] = value 308 else: ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 178 y = x 179 else: --> 180 y = _reconstruct(x, memo, *rv) 181 182 # If is its own copy, don't memoize. ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy) 278 if state is not None: 279 if deep: --> 280 state = deepcopy(state, memo) 281 if hasattr(y, '__setstate__'): 282 y.__setstate__(state) ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 148 copier = _deepcopy_dispatch.get(cls) 149 if copier: --> 150 y = copier(x, memo) 151 else: 152 try: ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _deepcopy_dict(x, memo, deepcopy) 238 memo[id(x)] = y 239 for key, value in x.items(): --> 240 y[deepcopy(key, memo)] = deepcopy(value, memo) 241 return y 242 d[dict] = _deepcopy_dict ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 178 y = x 179 else: --> 180 y = _reconstruct(x, memo, *rv) 181 182 # If is its own copy, don't memoize. ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy) 278 if state is not None: 279 if deep: --> 280 state = deepcopy(state, memo) 281 if hasattr(y, '__setstate__'): 282 y.__setstate__(state) ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 148 copier = _deepcopy_dispatch.get(cls) 149 if copier: --> 150 y = copier(x, memo) 151 else: 152 try: ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _deepcopy_dict(x, memo, deepcopy) 238 memo[id(x)] = y 239 for key, value in x.items(): --> 240 y[deepcopy(key, memo)] = deepcopy(value, memo) 241 return y 242 d[dict] = _deepcopy_dict ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 178 y = x 179 else: --> 180 y = _reconstruct(x, memo, *rv) 181 182 # If is its own copy, don't memoize. ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy) 278 if state is not None: 279 if deep: --> 280 state = deepcopy(state, memo) 281 if hasattr(y, '__setstate__'): 282 y.__setstate__(state) ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 148 copier = _deepcopy_dispatch.get(cls) 149 if copier: --> 150 y = copier(x, memo) 151 else: 152 try: ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _deepcopy_dict(x, memo, deepcopy) 238 memo[id(x)] = y 239 for key, value in x.items(): --> 240 y[deepcopy(key, memo)] = deepcopy(value, memo) 241 return y 242 d[dict] = _deepcopy_dict ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 178 y = x 179 else: --> 180 y = _reconstruct(x, memo, *rv) 181 182 # If is its own copy, don't memoize. ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy) 278 if state is not None: 279 if deep: --> 280 state = deepcopy(state, memo) 281 if hasattr(y, '__setstate__'): 282 y.__setstate__(state) ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 148 copier = _deepcopy_dispatch.get(cls) 149 if copier: --> 150 y = copier(x, memo) 151 else: 152 try: ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _deepcopy_dict(x, memo, deepcopy) 238 memo[id(x)] = y 239 for key, value in x.items(): --> 240 y[deepcopy(key, memo)] = deepcopy(value, memo) 241 return y 242 d[dict] = _deepcopy_dict ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 178 y = x 179 else: --> 180 y = _reconstruct(x, memo, *rv) 181 182 # If is its own copy, don't memoize. ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy) 278 if state is not None: 279 if deep: --> 280 state = deepcopy(state, memo) 281 if hasattr(y, '__setstate__'): 282 y.__setstate__(state) ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 148 copier = _deepcopy_dispatch.get(cls) 149 if copier: --> 150 y = copier(x, memo) 151 else: 152 try: ~\AppData\Local\Continuum\anaconda3\lib\copy.py in _deepcopy_dict(x, memo, deepcopy) 238 memo[id(x)] = y 239 for key, value in x.items(): --> 240 y[deepcopy(key, memo)] = deepcopy(value, memo) 241 return y 242 d[dict] = _deepcopy_dict ~\AppData\Local\Continuum\anaconda3\lib\copy.py in deepcopy(x, memo, _nil) 167 reductor = getattr(x, "__reduce_ex__", None) 168 if reductor: --> 169 rv = reductor(4) 170 else: 171 reductor = getattr(x, "__reduce__", None) TypeError: can't pickle CompiledFFI objects *********************************************************************************************************************** This electronic transmission and any files attached to it are strictly confidential and intended solely for the addressee. If you are not the intended addressee, you must not disclose, copy or take any action in relation to this transmission. If you have received this transmission in error, please notify us by return and delete the same. The views expressed in this electronic transmission do not necessarily reflect those of M and M Direct Ltd. More information on M and M Direct Ltd is available on our website at www.mandmdirect.com . M and M Direct Ltd endeavour to maintain a computer virus-free network. However, the sender cannot warrant that this transmission is virus-free and will not be liable for any resultant damages. It is your responsibility to scan the email and any attachments. All emails received and sent by M and M Direct Ltd may be monitored to protect its business interests. ************************************************************************************************************************ *********************************************************************************************************************** This electronic transmission and any files attached to it are strictly confidential and intended solely for the addressee. If you are not the intended addressee, you must not disclose, copy or take any action in relation to this transmission. If you have received this transmission in error, please notify us by return and delete the same. The views expressed in this electronic transmission do not necessarily reflect those of M and M Direct Ltd. More information on M and M Direct Ltd is available on our website at www.mandmdirect.com . M and M Direct Ltd endeavour to maintain a computer virus-free network. However, the sender cannot warrant that this transmission is virus-free and will not be liable for any resultant damages. It is your responsibility to scan the email and any attachments. All emails received and sent by M and M Direct Ltd may be monitored to protect its business interests. ************************************************************************************************************************ -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog: https://googleadsdeveloper.blogspot.com/ =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en --- You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. Visit this group at https://groups.google.com/group/adwords-api. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/5f7f1917-7bbe-40f2-93d3-b47b33299496%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.