Actually after looking deeper, if they're use copy_from with an attribute that doesnt have values changes, the whole code breaks.
On Sunday, May 30, 2021 at 1:56:11 AM UTC+2 Andi Jankovic wrote: > Also, why is there a duplication of code in the documentation? Check > documentation. > > > On Sunday, May 30, 2021 at 1:54:37 AM UTC+2 Andi Jankovic wrote: > >> Hi, >> >> I am following step by step in python the guide to update attribute >> values in a feed: >> >> https://github.com/googleads/google-ads-python/blob/99b99e560b4ab6c28e0e16e8d92d1e077f6d7f15/examples/feeds/update_flights_feed_item_string_attribute_value.py >> >> However, I keep getting the issue of: >> >> errors { >> error_code { >> field_mask_error: FIELD_MASK_MISSING >> } >> message: "Cannot use empty field mask in update operation." >> location { >> field_path_elements { >> field_name: "operations" >> index: 0 >> } >> } >> >> Yet my code runs smoothly but there seems to be some issues when I'm >> copying the update_mask. Here is my code >> >> feed_item_operation = adwords_client.get_type("FeedItemOperation") >> feed_item_service = adwords_client.get_service("FeedItemService") >> adwords_client.copy_from(feed_item_operation.update, feed_item) >> updated_feed_item = feed_item_operation.update >> adwords_client.copy_from(updated_feed_item.attribute_values[x], >> all_attributes[x]) >> >> # Create a field mask using the old feed_item and the updated_feed_item. >> adwords_client.copy_from( >> feed_item_operation.update_mask, >> protobuf_helpers.field_mask(feed_item._pb, updated_feed_item._pb), >> ) >> >> # Create a field mask using the old feed_item and the updated_feed_item. >> feed_item_operation.update_mask.CopyFrom( >> protobuf_helpers.field_mask(feed_item._pb, updated_feed_item._pb) >> ) >> >> # Mutate the feeds. >> response = feed_item_service.mutate_feed_items( >> customer_id=client_customer_id, operations=[feed_item_operation] >> ) >> print( >> "Feed item with resource name: " >> f"'{response.results[0].resource_name}' and ID: " >> f"'{x}' was updated." >> ) >> >> Either there is something wrong in the documentation or I'm doing >> something wrong. How can my field_mask be missing when everything else is >> completely the same as in documentation. >> >> Thank you. >> > -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 [email protected] To unsubscribe from this group, send email to [email protected] 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/e94f4ac5-e363-4442-904d-30ee719754c1n%40googlegroups.com.
