Re: AdWords API Python - Internal Error or Parsing Error

2016-08-26 Thread Mark Saniscalchi
Hello Tejas,

The googleads library is compatible with Python 3, as indicated by the fact 
that the report data was successfully retrieved. However, if you're 
decoding the report output (containing non-ascii data) to ascii at some 
point, that will raise an Exception. Often times, the encoding will default 
to the system encoding, which could potentially be something other than 
utf-8. If an option to set the encoding is offered, try setting it to utf-8.

Regards,
Mark

On Thursday, August 25, 2016 at 5:07:01 PM UTC-4, Tejas Manohar wrote:
>
> Moreover, looks like TextIOWrapper accepts an encoding option... 
> https://docs.python.org/2/library/io.html#io.TextIOWrapper - what would 
> you suggest here (considering what sort of data the googleadwords lib / 
> AdWords API is returning)?
>
> On Thu, Aug 25, 2016 at 2:05 PM Tejas Manohar <te...@segment.com 
> > wrote:
>
>> *from csv import DictReader as parse_csv*
>> *from io import TextIOWrapper*
>>
>> Gotcha. Those are both standard library methods. Do you have an 
>> alternative way you'd suggest decoding in a Python 3 environment (given the 
>> Unicode changes)? I'd be happy to migrate. If really needed, I can move 
>> this service to Python 2 (fixing this error is top priority)... but that 
>> may require some widespread changes (though small ones). Thanks again!
>>
>> (Sorry if I've asked a stupid question. Python frankly isn't my strong 
>> point. Used it because maintaining an AdWords SOAP wrapper in Go or Node is 
>> quite a burden.)
>>
>> On Thu, Aug 25, 2016 at 1:58 PM Mark Saniscalchi <
>> msanis88.adxb...@gmail.com > wrote:
>>
>>> Hello Tejas,
>>>
>>> Based on the stacktrace, I can see that the root cause is that you're 
>>> decoding with ASCII specified as the encoding. That will produce a 
>>> UnicodeEncode error if non-ASCII text appears in the reporting data. It 
>>> appears that one of the libraries you're using is probably the culprit 
>>> here, but it's hard to tell which. I'm pretty confident this isn't caused 
>>> by the googleads library though. I suggest taking a closer look at 
>>> TextIOWrapper and the parse_csv method.
>>>
>>> Regards,
>>> Mark
>>>
>>>
>>> On Thursday, August 25, 2016 at 4:24:43 PM UTC-4, Tejas Manohar wrote:
>>>
>>>> Hey Mark,
>>>>
>>>> The issue is back and is not being solved by retries for our customer. 
>>>> Here's 
>>>> code + logs- 
>>>> https://gist.github.com/tejasmanohar/24f15ddb830f8bc611e9e50fdf56f688. 
>>>> Let me know what other information I can provide to help you debug this. 
>>>> It's currently blocking syncs with our beta AdWords Source at Segment (
>>>> https://segment.com/sources) for a subset of customers (launch date 
>>>> next week).
>>>>
>>>> On Tue, Aug 23, 2016 at 4:57 PM Tejas Manohar <te...@segment.com> 
>>>> wrote:
>>>>
>>> Got it. We have not seen the error today. I'll follow-up if it comes 
>>>>> back. Thanks!
>>>>>
>>>>> On Tue, Aug 23, 2016 at 4:21 PM Mark Saniscalchi <
>>>>> msanis88.adxb...@gmail.com> wrote:
>>>>>
>>>> Hello Tejas,
>>>>>>
>>>>>> The stacktrace you linked to actually seems indicative of a separate 
>>>>>> issue, I suspect you're seeing this issue 
>>>>>> <https://groups.google.com/forum/#!topic/adwords-api/BXnAVhYe538> 
>>>>>> instead. I can tell because the UnicodeDecodeError you're receiving 
>>>>>> indicates that you're likely receiving something that was gzipped, but 
>>>>>> your 
>>>>>> report definition indicates that you set the format to CSV.
>>>>>>
>>>>>> That said, I can't verify whether the original issue is still in 
>>>>>> effect. If you're still experiencing issues with new reports, can you 
>>>>>> send 
>>>>>> another report definition / stacktrace?
>>>>>>
>>>>>> Regards,
>>>>>> Mark
>>>>>>
>>>>>> On Friday, August 19, 2016 at 10:12:39 PM UTC-4, Tejas Manohar wrote:
>>>>>>
>>>>>>> Hey Mark,
>>>>>>>
>>>>>>> Sorry for the delay here. Here's report definition + error in logs- 
>>>>>>> https://gist.github.com/tejasmanohar/fd539957f8653a6c8375cd3b5a2cd7f5. 
>>>>>&

Re: AdWords API Python - Internal Error or Parsing Error

2016-08-25 Thread Mark Saniscalchi
Hello Tejas,

Based on the stacktrace, I can see that the root cause is that you're 
decoding with ASCII specified as the encoding. That will produce a 
UnicodeEncode error if non-ASCII text appears in the reporting data. It 
appears that one of the libraries you're using is probably the culprit 
here, but it's hard to tell which. I'm pretty confident this isn't caused 
by the googleads library though. I suggest taking a closer look at 
TextIOWrapper and the parse_csv method.

Regards,
Mark

On Thursday, August 25, 2016 at 4:24:43 PM UTC-4, Tejas Manohar wrote:
>
> Hey Mark,
>
> The issue is back and is not being solved by retries for our customer. Here's 
> code + logs- 
> https://gist.github.com/tejasmanohar/24f15ddb830f8bc611e9e50fdf56f688. 
> Let me know what other information I can provide to help you debug this. 
> It's currently blocking syncs with our beta AdWords Source at Segment (
> https://segment.com/sources) for a subset of customers (launch date next 
> week).
>
> On Tue, Aug 23, 2016 at 4:57 PM Tejas Manohar <te...@segment.com 
> > wrote:
>
>> Got it. We have not seen the error today. I'll follow-up if it comes 
>> back. Thanks!
>>
>> On Tue, Aug 23, 2016 at 4:21 PM Mark Saniscalchi <
>> msanis88.adxb...@gmail.com > wrote:
>>
>>> Hello Tejas,
>>>
>>> The stacktrace you linked to actually seems indicative of a separate 
>>> issue, I suspect you're seeing this issue 
>>> <https://groups.google.com/forum/#!topic/adwords-api/BXnAVhYe538> 
>>> instead. I can tell because the UnicodeDecodeError you're receiving 
>>> indicates that you're likely receiving something that was gzipped, but your 
>>> report definition indicates that you set the format to CSV.
>>>
>>> That said, I can't verify whether the original issue is still in effect. 
>>> If you're still experiencing issues with new reports, can you send another 
>>> report definition / stacktrace?
>>>
>>> Regards,
>>> Mark
>>>
>>> On Friday, August 19, 2016 at 10:12:39 PM UTC-4, Tejas Manohar wrote:
>>>
>>>> Hey Mark,
>>>>
>>>> Sorry for the delay here. Here's report definition + error in logs- 
>>>> https://gist.github.com/tejasmanohar/fd539957f8653a6c8375cd3b5a2cd7f5. 
>>>> How can I determine the locale of customers? Btw, this error happens on 
>>>> many reports for this customer, not just one, so I can provide more 
>>>> examples, and retries are solving the problem for now, but it slows 
>>>> everything down. 
>>>>
>>>> Let me know what else I can provide to help. Thanks!
>>>>
>>>> On Fri, Jul 29, 2016 at 3:13 PM Tejas Manohar <te...@segment.com> 
>>>> wrote:
>>>>
>>> Hey Mark,
>>>>>
>>>>> Thanks! I will get all this information to you on Monday.
>>>>>
>>>>> On Fri, Jul 29, 2016 at 3:05 PM Mark Saniscalchi <
>>>>> msanis88.adxb...@gmail.com> wrote:
>>>>>
>>>> Hello Tejas,
>>>>>>
>>>>>> I'm the owner of the Python Client Library, and am taking a look at 
>>>>>> this issue. It's difficult to say for certain whether this is a client 
>>>>>> or 
>>>>>> server-based issue because the snippet and stacktrace are incomplete, 
>>>>>> but 
>>>>>> I'm leaning towards this being a server issue or a mixture of both. 
>>>>>> The AdWordsReportBadRequestError is raised when a reportDownloadError is 
>>>>>> detected in the response--this is usually the result of bad input.
>>>>>>
>>>>>> The UnicodeDecodeError is a bit of a mystery at the moment, as I 
>>>>>> can't replicate it (also in Python 3) with a data source known to 
>>>>>> contain 
>>>>>> utf-8. The fact that it seems to be expecting ascii input is telling, 
>>>>>> and 
>>>>>> I'm wondering if something else in your program would be expecting ascii 
>>>>>> input? It might be the TextIOWrapper, which will default to the system 
>>>>>> encoding (which may be ascii in your case).
>>>>>>
>>>>>> In short, I can't specifically point out what went wrong here because 
>>>>>> I don't have the full picture. I need to at least see what the report 
>>>>>> definition contains in order to attempt to reproduce 
>>>>>> theAdWordsReportBadRequestError; it'd also be helpf

Re: AdWords API Python - Internal Error or Parsing Error

2016-08-23 Thread Mark Saniscalchi
Hello Tejas,

The stacktrace you linked to actually seems indicative of a separate issue, 
I suspect you're seeing this issue 
<https://groups.google.com/forum/#!topic/adwords-api/BXnAVhYe538> instead. 
I can tell because the UnicodeDecodeError you're receiving indicates that 
you're likely receiving something that was gzipped, but your report 
definition indicates that you set the format to CSV.

That said, I can't verify whether the original issue is still in effect. If 
you're still experiencing issues with new reports, can you send another 
report definition / stacktrace?

Regards,
Mark

On Friday, August 19, 2016 at 10:12:39 PM UTC-4, Tejas Manohar wrote:
>
> Hey Mark,
>
> Sorry for the delay here. Here's report definition + error in logs- 
> https://gist.github.com/tejasmanohar/fd539957f8653a6c8375cd3b5a2cd7f5. 
> How can I determine the locale of customers? Btw, this error happens on 
> many reports for this customer, not just one, so I can provide more 
> examples, and retries are solving the problem for now, but it slows 
> everything down. 
>
> Let me know what else I can provide to help. Thanks!
>
> On Fri, Jul 29, 2016 at 3:13 PM Tejas Manohar <te...@segment.com 
> > wrote:
>
>> Hey Mark,
>>
>> Thanks! I will get all this information to you on Monday.
>>
>> On Fri, Jul 29, 2016 at 3:05 PM Mark Saniscalchi <
>> msanis88.adxb...@gmail.com > wrote:
>>
>>> Hello Tejas,
>>>
>>> I'm the owner of the Python Client Library, and am taking a look at this 
>>> issue. It's difficult to say for certain whether this is a client or 
>>> server-based issue because the snippet and stacktrace are incomplete, but 
>>> I'm leaning towards this being a server issue or a mixture of both. 
>>> The AdWordsReportBadRequestError is raised when a reportDownloadError is 
>>> detected in the response--this is usually the result of bad input.
>>>
>>> The UnicodeDecodeError is a bit of a mystery at the moment, as I can't 
>>> replicate it (also in Python 3) with a data source known to contain utf-8. 
>>> The fact that it seems to be expecting ascii input is telling, and I'm 
>>> wondering if something else in your program would be expecting ascii input? 
>>> It might be the TextIOWrapper, which will default to the system encoding 
>>> (which may be ascii in your case).
>>>
>>> In short, I can't specifically point out what went wrong here because I 
>>> don't have the full picture. I need to at least see what the report 
>>> definition contains in order to attempt to reproduce 
>>> theAdWordsReportBadRequestError; it'd also be helpful if I knew what locale 
>>> settings are.
>>>
>>> Regards,
>>> Mark
>>>
>>> On Tuesday, July 26, 2016 at 9:18:17 PM UTC-4, Tejas Manohar wrote:
>>>
>>>> Hey Shwetha,
>>>>
>>>> I've confirmed that this issue is resolved by retrying, but it happens 
>>>> very consistently. Since it's resolved by retrying and I'm using 
>>>> codecs#getreader which knows how to handle Python unicode in both v2 and 
>>>> v3, I really believe this issue is due to malformed data sent back from 
>>>> the 
>>>> API as a result of an error. Let me know what more info I could provide to 
>>>> help. Thanks!
>>>>
>>>> On Wed, Jul 20, 2016 at 1:56 PM 'Shwetha Vastrad (AdWords API Team)' 
>>>> via AdWords API Forum <adwor...@googlegroups.com> wrote:
>>>>
>>> Hi Tejas,
>>>>>
>>>>> This issue is related to how Python handles data streams and not 
>>>>> specific to AdWords API. I suggest that you post your query in the 
>>>>> AdWords 
>>>>> API Python library repository 
>>>>> <https://github.com/googleads/googleads-python-lib> as they are 
>>>>> better equipped to help you out.
>>>>>
>>>>> Regards,
>>>>> Shwetha, AdWords API Team.
>>>>>
>>>>> -- 
>>>>> -- 
>>>>> =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
>>>>> Also find us on our blog and Google+:
>>>>> https://googleadsdeveloper.blogspot.com/
>>>>> https://plus.google.com/+GoogleAdsDevelopers/posts
>>>>> =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
>>>>>  
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "AdWords API Forum" group.
>>>>>
>>>> To post to th

Re: AdWords API Python - Internal Error or Parsing Error

2016-07-29 Thread Mark Saniscalchi
Hello Tejas,

I'm the owner of the Python Client Library, and am taking a look at this 
issue. It's difficult to say for certain whether this is a client or 
server-based issue because the snippet and stacktrace are incomplete, but 
I'm leaning towards this being a server issue or a mixture of both. 
The AdWordsReportBadRequestError is raised when a reportDownloadError is 
detected in the response--this is usually the result of bad input.

The UnicodeDecodeError is a bit of a mystery at the moment, as I can't 
replicate it (also in Python 3) with a data source known to contain utf-8. 
The fact that it seems to be expecting ascii input is telling, and I'm 
wondering if something else in your program would be expecting ascii input? 
It might be the TextIOWrapper, which will default to the system encoding 
(which may be ascii in your case).

In short, I can't specifically point out what went wrong here because I 
don't have the full picture. I need to at least see what the report 
definition contains in order to attempt to reproduce 
theAdWordsReportBadRequestError; it'd also be helpful if I knew what locale 
settings are.

Regards,
Mark

On Tuesday, July 26, 2016 at 9:18:17 PM UTC-4, Tejas Manohar wrote:
>
> Hey Shwetha,
>
> I've confirmed that this issue is resolved by retrying, but it happens 
> very consistently. Since it's resolved by retrying and I'm using 
> codecs#getreader which knows how to handle Python unicode in both v2 and 
> v3, I really believe this issue is due to malformed data sent back from the 
> API as a result of an error. Let me know what more info I could provide to 
> help. Thanks!
>
> On Wed, Jul 20, 2016 at 1:56 PM 'Shwetha Vastrad (AdWords API Team)' via 
> AdWords API Forum  wrote:
>
>> Hi Tejas,
>>
>> This issue is related to how Python handles data streams and not specific 
>> to AdWords API. I suggest that you post your query in the AdWords API 
>> Python library repository 
>>  as they are better 
>> equipped to help you out.
>>
>> Regards,
>> Shwetha, AdWords API Team.
>>
>> -- 
>> -- 
>> =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
>> Also find us on our blog and Google+:
>> https://googleadsdeveloper.blogspot.com/
>> https://plus.google.com/+GoogleAdsDevelopers/posts
>> =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
>>  
>> You received this message because you are subscribed to the Google
>> Groups "AdWords API Forum" group.
>> To post to this group, send email to adwor...@googlegroups.com 
>> 
>> To unsubscribe from this group, send email to
>> adwords-api...@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 a topic in the 
>> Google Groups "AdWords API Forum" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/adwords-api/Jmbqifyr_Ro/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> adwords-api...@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/780b5d92-b91a-41d5-9467-246325408472%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> -- 
> Best regards,
>
> Tejas Manohar
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords 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 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/e19ae838-4b54-420d-9945-629c26205f5d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: BatchJobService Attribute error in Python 3 but not Python 2

2016-03-19 Thread Mark Saniscalchi
Hello,

It looks like you stumbled into a bug with the Python Client Library. I've 
filed an issue for it here 
<https://github.com/googleads/googleads-python-lib/issues/111> and intend 
to have it resolved in an upcoming API release.

If you have any further comments regarding this issue, please leave it on 
the issue tracker.

Regards,
Mark Saniscalchi

On Wednesday, March 16, 2016 at 5:24:19 PM UTC-4, Nadine Sundquist (AdWords 
API Team) wrote:
>
> Hello,
>
> I'm not aware of any issues. Let me check with my teammate who is our 
> resident expert in Python. I'll get back to you when I've learned more.
>
> Best,
> Nadine, AdWords API Team
>
> On Wednesday, March 16, 2016 at 11:41:55 AM UTC-4, 
> fol...@brainlabsdigital.com  wrote:
>>
>> When I try to run a particular script in python3.5 I get the error:
>>
>>
>> AttributeError: 'bytes' object has no attribute 'encode'. Is this common 
>> or am I doing something wrong. 
>>
>> Python 2.7 works perfect. 
>>
>> The particular line of code that causes this is 
>> batch_job_helper.UploadOperations(upload_url, operations).
>>
>> Assume the operations and upload_url are perfectly fine, as I can run the 
>> same line in python2 and it works fine.
>>
>>  stack trace is below:
>>
>>   File 
>> "/Users/folusoogunlana/Documents/webProgramming/brainlabs/ts/techstack/brsb/brsb_helper.py",
>>  
>> line 661, in upload_batch_operations
>>
>> batch_job_helper.UploadOperations(upload_url, operations)
>>
>>   File 
>> "/Users/folusoogunlana/.virtualenvs/blabs/lib/python3.5/site-packages/googleads/adwords.py",
>>  
>> line 845, in UploadOperations
>>
>> uploader.UploadOperations(operations, is_last=True)
>>
>>   File 
>> "/Users/folusoogunlana/.virtualenvs/blabs/lib/python3.5/site-packages/googleads/adwords.py",
>>  
>> line 990, in UploadOperations
>>
>> current_content_length=self._current_content_length, is_last=is_last)
>>
>>   File 
>> "/Users/folusoogunlana/.virtualenvs/blabs/lib/python3.5/site-packages/googleads/adwords.py",
>>  
>> line 591, in BuildUploadRequest
>>
>> has_suffix=is_last)
>>
>>   File 
>> "/Users/folusoogunlana/.virtualenvs/blabs/lib/python3.5/site-packages/googleads/adwords.py",
>>  
>> line 628, in _BuildUploadRequestBody
>>
>> for operations_list in operations])
>>
>>   File 
>> "/Users/folusoogunlana/.virtualenvs/blabs/lib/python3.5/site-packages/googleads/adwords.py",
>>  
>> line 628, in 
>>
>> for operations_list in operations])
>>
>>   File 
>> "/Users/folusoogunlana/.virtualenvs/blabs/lib/python3.5/site-packages/googleads/adwords.py",
>>  
>> line 714, in _GenerateOperationsXML
>>
>> return 
>> self._ExtractOperations(self._GenerateRawRequestXML(operations))
>>
>>   File 
>> "/Users/folusoogunlana/.virtualenvs/blabs/lib/python3.5/site-packages/googleads/adwords.py",
>>  
>> line 653, in _ExtractOperations
>>
>> mutate = self._GetRawOperationsFromXML(full_soap_xml)
>>
>>   File 
>> "/Users/folusoogunlana/.virtualenvs/blabs/lib/python3.5/site-packages/googleads/adwords.py",
>>  
>> line 768, in _GetRawOperationsFromXML
>>
>> root = ElementTree.fromstring(raw_request_xml.encode('utf-8'))
>> AttributeError: 'bytes' object has no attribute 'encode' 
>>
>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords 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 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/ca96cb4f-6727-404c-8e78-11db02c2b563%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: SOAP XML error for Chinese Names in ManagedCustomerService

2016-02-23 Thread Mark Saniscalchi
Hello Sonic,

I can see that you have en_US.utf8 as an available locale, but is it 
actually being used? What is the output of echo $LANG? I've reproduced and 
resolved your issue by setting the locale to a different value, so I 
suspect you might not actually have that set correctly on the VM.

I pointed out the logger issue earlier because it appeared in the output 
and *was not* related to your case, so I wanted to make that clear. Sorry 
if that instead caused any confusion.

Regards,
Mark



On Saturday, February 20, 2016 at 2:14:47 AM UTC-5, maxSonic Sun wrote:
>
> Hi Mark,
>
> On my server machine, the locale is
> ubuntu@ip-10-0-24-250:~$ locale -a
> C
> C.UTF-8
> en_US.utf8
> POSIX
>
> But I still have the problem. The system I have is ubuntu 14.04 server on 
> aws. That should not be the ANSII encoding problem. 
> *And by the way, my problem is not caused by the logger as you pointed out 
> in the previous post, it is caused by the decoding of the xml. *The 
> scenario you pointed out happened nowhere on my machine.
>
> As you can see, is a SAX parser problem.
>
>
> <https://lh3.googleusercontent.com/-T-0kdzKwXWQ/Vp-ti3ztPcI/A4k/_WvW8uoQeZs/s1600/PastedGraphic-4.png>
>
>
>
>
>
> On Saturday, February 20, 2016 at 12:44:58 AM UTC+8, Mark Saniscalchi 
> wrote:
>>
>> Hello Sonic,
>>
>> Sorry for the delay. If you look to my initial response, I did run and 
>> successfully retrieve an account name containing utf-8 characters using the 
>> get_account_hierarchy.py example in v201509 using Python 2. This was on a 
>> machine where the default encoding is utf-8. I provided the code above as a 
>> potential work-around, but if that still fails to work, I would suggest 
>> modifying the default encoding used by your VM to utf-8.
>>
>> You may recall earlier that I was able to replicate your issue on a VM 
>> using ANSII encoding. I was also able to resolve the problem on that VM by 
>> modifying the default encoding to utf-8. The suds-jurko library doesn't 
>> seem to state this as a requirement, but it doesn't seem to handle utf-8 
>> characters well otherwise. Going forward, we'll be suggesting in our 
>> documentation that setting the default encoding to utf-8 is a requirement.
>>
>> Regards,
>> Mark
>>
>> On Friday, February 19, 2016 at 9:42:16 AM UTC-5, maxSonic Sun wrote:
>>>
>>> Hi Mark, 
>>>
>>> Any update?
>>>
>>> Best Regards,
>>> Sonic
>>>
>>> On Saturday, February 6, 2016 at 1:08:31 AM UTC+8, Mark Saniscalchi 
>>> wrote:
>>>>
>>>> Hello Sonic,
>>>>
>>>> That looks correct, so you are using the right version of suds-jurko at 
>>>> least.
>>>>
>>>> On my workstation, I created a campaign with the name that you're 
>>>> having issues parsing and ran the get_campaigns.py example. I ran (sort 
>>>> of) 
>>>> without issues:
>>>>
>>>> INFO:oauth2client.client:Refreshing access_token
>>>>> DEBUG:suds.transport.http:opening (
>>>>> https://adwords.google.com/api/adwords/cm/v201509/CampaignService?wsdl
>>>>> )
>>>>> DEBUG:suds.transport.http:sending:
>>>>> URL: https://adwords.google.com/api/adwords/cm/v201509/CampaignService
>>>>> HEADERS: {'Soapaction': '""', 'SOAPAction': '""', 'Content-Type': 
>>>>> 'text/xml; charset=utf-8', 'Content-type': 'text/xml; charset=utf-8', 
>>>>> 'Authorization': u'REDACTED'}
>>>>> MESSAGE:
>>>>> http://schemas.xmlsoap.org/soap/envelope/; xmlns:ns1="
>>>>> https://adwords.google.com/api/adwords/cm/v201509; xmlns:xsi="
>>>>> http://www.w3.org/2001/XMLSchema-instance; xmlns:tns="
>>>>> https://adwords.google.com/api/adwords/cm/v201509; xmlns:SOAP-ENV="
>>>>> http://schemas.xmlsoap.org/soap/envelope/
>>>>> ">REDACTEDREDACTEDREDACTEDfalsefalseIdNameStatus0100
>>>>> Traceback (most recent call last):
>>>>>   File "/usr/local/lib/python2.7/logging/__init__.py", line 859, in 
>>>>> emit
>>>>> msg = self.format(record)
>>>>>   File "/usr/local/lib/python2.7/logging/__init__.py", line 732, in 
>>>>> format
>>>>> return fmt.format(record)
>>>>>   File "/usr/local/lib/python2.7/logging/__init__.py", line 471, in 
>>>>> format
>>>>> record.message = record.getMessage()
>

Re: SOAP XML error for Chinese Names in ManagedCustomerService

2016-02-19 Thread Mark Saniscalchi
Hello Sonic,

Sorry for the delay. If you look to my initial response, I did run and 
successfully retrieve an account name containing utf-8 characters using the 
get_account_hierarchy.py example in v201509 using Python 2. This was on a 
machine where the default encoding is utf-8. I provided the code above as a 
potential work-around, but if that still fails to work, I would suggest 
modifying the default encoding used by your VM to utf-8.

You may recall earlier that I was able to replicate your issue on a VM 
using ANSII encoding. I was also able to resolve the problem on that VM by 
modifying the default encoding to utf-8. The suds-jurko library doesn't 
seem to state this as a requirement, but it doesn't seem to handle utf-8 
characters well otherwise. Going forward, we'll be suggesting in our 
documentation that setting the default encoding to utf-8 is a requirement.

Regards,
Mark

On Friday, February 19, 2016 at 9:42:16 AM UTC-5, maxSonic Sun wrote:
>
> Hi Mark, 
>
> Any update?
>
> Best Regards,
> Sonic
>
> On Saturday, February 6, 2016 at 1:08:31 AM UTC+8, Mark Saniscalchi wrote:
>>
>> Hello Sonic,
>>
>> That looks correct, so you are using the right version of suds-jurko at 
>> least.
>>
>> On my workstation, I created a campaign with the name that you're having 
>> issues parsing and ran the get_campaigns.py example. I ran (sort of) 
>> without issues:
>>
>> INFO:oauth2client.client:Refreshing access_token
>>> DEBUG:suds.transport.http:opening (
>>> https://adwords.google.com/api/adwords/cm/v201509/CampaignService?wsdl)
>>> DEBUG:suds.transport.http:sending:
>>> URL: https://adwords.google.com/api/adwords/cm/v201509/CampaignService
>>> HEADERS: {'Soapaction': '""', 'SOAPAction': '""', 'Content-Type': 
>>> 'text/xml; charset=utf-8', 'Content-type': 'text/xml; charset=utf-8', 
>>> 'Authorization': u'REDACTED'}
>>> MESSAGE:
>>> http://schemas.xmlsoap.org/soap/envelope/; xmlns:ns1="
>>> https://adwords.google.com/api/adwords/cm/v201509; xmlns:xsi="
>>> http://www.w3.org/2001/XMLSchema-instance; xmlns:tns="
>>> https://adwords.google.com/api/adwords/cm/v201509; xmlns:SOAP-ENV="
>>> http://schemas.xmlsoap.org/soap/envelope/
>>> ">REDACTEDREDACTEDREDACTEDfalsefalseIdNameStatus0100
>>> Traceback (most recent call last):
>>>   File "/usr/local/lib/python2.7/logging/__init__.py", line 859, in emit
>>> msg = self.format(record)
>>>   File "/usr/local/lib/python2.7/logging/__init__.py", line 732, in 
>>> format
>>> return fmt.format(record)
>>>   File "/usr/local/lib/python2.7/logging/__init__.py", line 471, in 
>>> format
>>> record.message = record.getMessage()
>>>   File "/usr/local/lib/python2.7/logging/__init__.py", line 335, in 
>>> getMessage
>>> msg = msg % self.args
>>>   File "/usr/local/lib/python2.7/dist-packages/suds/__init__.py", line 
>>> 168, in 
>>> __str__ = lambda x: unicode(x).encode('utf-8')
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/suds/transport/__init__.py", line 
>>> 96, in __unicode__
>>> %s""" % (self.code, self.headers, self.message)
>>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 
>>> 577: ordinal not in range(128)
>>> Logged from file http.py, line 89
>>> Campaign with id '374649914', name '15-abc-1-mmep-中国-IOS', and status 
>>> 'ENABLED' was found.
>>
>>
>> The error you're seeing there is a known issue that the suds logger has 
>> with unicode characters, but it doesn't prevent the sample from completing. 
>> As you can see, the Campaign's name can be retrieved and printed without 
>> issues. This definitely seems like an issue specific to the environment the 
>> code is run on. I went a step further and ran this on a separate VM 
>> instance, and was able to reproduce it in that case.
>>
>> The workstation has its default character encoding set to utf-8 and the 
>> VM has it set to ANSIX3.4-1968, which is probably related. I think suds 
>> might have some flaky behavior here depending on the environment used. In 
>> the meantime, you can avoid this error by encoding the output of string 
>> fields such as:
>>
>> # Display results.
>> if 'entries' in page:
>>       for campaign in page['entries']:
>> print ('Campaign with id \'%s\', name \'%s\', and status \'%s\' 
>> was '
>>'found.' % (campaign['id'], 

Re: SOAP XML error for Chinese Names in ManagedCustomerService

2016-02-05 Thread Mark Saniscalchi
Hello Sonic,

That looks correct, so you are using the right version of suds-jurko at 
least.

On my workstation, I created a campaign with the name that you're having 
issues parsing and ran the get_campaigns.py example. I ran (sort of) 
without issues:

INFO:oauth2client.client:Refreshing access_token
> DEBUG:suds.transport.http:opening 
> (https://adwords.google.com/api/adwords/cm/v201509/CampaignService?wsdl)
> DEBUG:suds.transport.http:sending:
> URL: https://adwords.google.com/api/adwords/cm/v201509/CampaignService
> HEADERS: {'Soapaction': '""', 'SOAPAction': '""', 'Content-Type': 
> 'text/xml; charset=utf-8', 'Content-type': 'text/xml; charset=utf-8', 
> 'Authorization': u'REDACTED'}
> MESSAGE:
>  xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/; 
> xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201509; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
> xmlns:tns="https://adwords.google.com/api/adwords/cm/v201509; 
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/;>REDACTEDREDACTEDREDACTEDfalsefalseIdNameStatus0100
> Traceback (most recent call last):
>   File "/usr/local/lib/python2.7/logging/__init__.py", line 859, in emit
> msg = self.format(record)
>   File "/usr/local/lib/python2.7/logging/__init__.py", line 732, in format
> return fmt.format(record)
>   File "/usr/local/lib/python2.7/logging/__init__.py", line 471, in format
> record.message = record.getMessage()
>   File "/usr/local/lib/python2.7/logging/__init__.py", line 335, in 
> getMessage
> msg = msg % self.args
>   File "/usr/local/lib/python2.7/dist-packages/suds/__init__.py", line 
> 168, in 
> __str__ = lambda x: unicode(x).encode('utf-8')
>   File 
> "/usr/local/lib/python2.7/dist-packages/suds/transport/__init__.py", line 
> 96, in __unicode__
> %s""" % (self.code, self.headers, self.message)
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 577: 
> ordinal not in range(128)
> Logged from file http.py, line 89
> Campaign with id '374649914', name '15-abc-1-mmep-中国-IOS', and status 
> 'ENABLED' was found.


The error you're seeing there is a known issue that the suds logger has 
with unicode characters, but it doesn't prevent the sample from completing. 
As you can see, the Campaign's name can be retrieved and printed without 
issues. This definitely seems like an issue specific to the environment the 
code is run on. I went a step further and ran this on a separate VM 
instance, and was able to reproduce it in that case.

The workstation has its default character encoding set to utf-8 and the VM 
has it set to ANSIX3.4-1968, which is probably related. I think suds might 
have some flaky behavior here depending on the environment used. In the 
meantime, you can avoid this error by encoding the output of string fields 
such as:

# Display results.
if 'entries' in page:
  for campaign in page['entries']:
print ('Campaign with id \'%s\', name \'%s\', and status \'%s\' was 
'
   'found.' % (campaign['id'], campaign['name'].encode('utf-8'),
   campaign['status'].encode('utf-8')))

I'll continue investigating this, as a better fix may need to come upstream 
from the suds library.

Regards,
Mark

On Monday, February 1, 2016 at 9:12:24 PM UTC-5, maxSonic Sun wrote:
>
> Hi Mark,
>
> Here is the version:
> __version__ = "0.6"
> __build__ = ""
>
> Best Regards
> Sonic Sun
>
> On Monday, February 1, 2016 at 11:32:44 PM UTC+8, Mark Saniscalchi wrote:
>>
>> Hello Sonic,
>>
>> I'd just like to confirm, could you tell me what the version number is in 
>> the following file:
>>
>>
>> /project/apiservice/venvdocker/local/lib/python2.7/site-packages/suds/version.py
>>
>> Thanks,
>> Mark
>>
>>
>> On Monday, February 1, 2016 at 2:51:27 AM UTC-5, maxSonic Sun wrote:
>>>
>>> Hi,
>>>
>>> There is something weird here, I am able to parsed some other unicode 
>>> characters and also other accounts of my customer. I have listed all the 
>>> pip lib in my machine, I think I have installed all the lib correctly. By 
>>> the way, I didn't change any of the import in the py file, how can it be 
>>> changed to other libs if I do nothing in the lib?
>>>
>>> This issue is also happened in the Java lib for the same account of our 
>>> customer.
>>>
>>> After some debugging, it seems like there will be noway to parsed the id 
>>> like: 15-abc-1-mmep-中国-IOS. Please notice that the - is different from -.
>>>
>>> Best Regards,
&g

Re: SOAP XML error for Chinese Names in ManagedCustomerService

2016-02-01 Thread Mark Saniscalchi
Hello Sonic,

I'd just like to confirm, could you tell me what the version number is in 
the following file:

/project/apiservice/venvdocker/local/lib/python2.7/site-packages/suds/version.py

Thanks,
Mark


On Monday, February 1, 2016 at 2:51:27 AM UTC-5, maxSonic Sun wrote:
>
> Hi,
>
> There is something weird here, I am able to parsed some other unicode 
> characters and also other accounts of my customer. I have listed all the 
> pip lib in my machine, I think I have installed all the lib correctly. By 
> the way, I didn't change any of the import in the py file, how can it be 
> changed to other libs if I do nothing in the lib?
>
> This issue is also happened in the Java lib for the same account of our 
> customer.
>
> After some debugging, it seems like there will be noway to parsed the id 
> like: 15-abc-1-mmep-中国-IOS. Please notice that the - is different from -.
>
> Best Regards,
> Sonic Sun
>
> On Friday, January 22, 2016 at 4:39:42 AM UTC+8, Mark Saniscalchi wrote:
>>
>> Hello,
>>
>> We aren't able to replicate this issue with account names containing 
>> unicode characters. In my case, I ran the get_account_hierarchy.py 
>> <https://github.com/googleads/googleads-python-lib/blob/master/examples/adwords/v201509/account_management/get_account_hierarchy.py>
>>  
>> sample and got the expected result:
>>
>> CustomerId, Name
>> --Redacted, マーク Test Account
>>
>> I think this might have to do with something else. In the stacktrace, I 
>> noticed that you aren't using the sax parser embedded in the suds-jurko 
>> library. On even closer observation, I noticed that you weren't even using 
>> the suds-jurko library. This is almost definitely the cause of the problem, 
>> as I don't think our library is compatible with the original suds library, 
>> which is now woefully unmaintained. I suggest uninstalling both googleads 
>> and the suds library you're using currently. Then reinstall googleads with 
>> pip using the following command:
>>
>> pip install googleads
>>
>> Our setup.py file should then install all of the necessary dependencies 
>> automatically, which should resolve this problem.
>>
>> Regards,
>> Mark Saniscalchi
>>
>> On Wednesday, January 20, 2016 at 2:22:09 PM UTC-5, maxSonic Sun wrote:
>>>
>>> Hi,
>>>
>>> I have the error as shown in the first pic below. It seems that it is 
>>> caused by the decoding of the soap xm. The second pic  is my code. However, 
>>> if I remove the "name" from the selector, everything works fine.
>>> My customers have lots of Chinese Name in their MCC accounts. I think it 
>>> is caused by the unicode problem of python and both the Chinese. How can I 
>>> solve this problem to avoid this kind of error?
>>>
>>>
>>>
>>> <https://lh3.googleusercontent.com/-T-0kdzKwXWQ/Vp-ti3ztPcI/A4k/_WvW8uoQeZs/s1600/PastedGraphic-4.png>
>>>
>>>
>>> <https://lh3.googleusercontent.com/-lWDEJ7LLcPc/Vp-tlw4VxyI/A4s/5DkEn5oey7E/s1600/PastedGraphic-6.png>
>>>
>>>
>>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords 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 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/c4167087-85b4-4fff-83bf-710208c83a3c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: SOAP XML error for Chinese Names in ManagedCustomerService

2016-01-21 Thread Mark Saniscalchi
Hello,

We aren't able to replicate this issue with account names containing 
unicode characters. In my case, I ran the get_account_hierarchy.py 
<https://github.com/googleads/googleads-python-lib/blob/master/examples/adwords/v201509/account_management/get_account_hierarchy.py>
 
sample and got the expected result:

CustomerId, Name
--Redacted, マーク Test Account

I think this might have to do with something else. In the stacktrace, I 
noticed that you aren't using the sax parser embedded in the suds-jurko 
library. On even closer observation, I noticed that you weren't even using 
the suds-jurko library. This is almost definitely the cause of the problem, 
as I don't think our library is compatible with the original suds library, 
which is now woefully unmaintained. I suggest uninstalling both googleads 
and the suds library you're using currently. Then reinstall googleads with 
pip using the following command:

pip install googleads

Our setup.py file should then install all of the necessary dependencies 
automatically, which should resolve this problem.

Regards,
Mark Saniscalchi

On Wednesday, January 20, 2016 at 2:22:09 PM UTC-5, maxSonic Sun wrote:
>
> Hi,
>
> I have the error as shown in the first pic below. It seems that it is 
> caused by the decoding of the soap xm. The second pic  is my code. However, 
> if I remove the "name" from the selector, everything works fine.
> My customers have lots of Chinese Name in their MCC accounts. I think it 
> is caused by the unicode problem of python and both the Chinese. How can I 
> solve this problem to avoid this kind of error?
>
>
>
> <https://lh3.googleusercontent.com/-T-0kdzKwXWQ/Vp-ti3ztPcI/A4k/_WvW8uoQeZs/s1600/PastedGraphic-4.png>
>
>
> <https://lh3.googleusercontent.com/-lWDEJ7LLcPc/Vp-tlw4VxyI/A4s/5DkEn5oey7E/s1600/PastedGraphic-6.png>
>
>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords 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 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/68d6ddc2-f671-4fb7-bec4-20765ea1ed58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.