I want the 3rd party library (Authy) to work without modification in a way 
that is unlikely to break upon a change in that library, GAE, or the python 
2.7 native API.  Authy only uses the result of platform.platform() to 
create its user agent string for http requests, so it doesn't really matter 
what it returns. The hack I am currently using, that technically works, is

import platform

platform.platform = lambda aliased=0, terse=0: 'GAE'


This may be as good as it gets until the 3rd party library includes better 
exception handling, but I am happy to solicit solutions that may be less 
likely to break.


On Tuesday, August 11, 2015 at 9:55:48 AM UTC-4, Patrice (Cloud Platform 
Support) wrote:
>
> Hi!
>
> What do you want exactly? The platform.platform call to work? I don't 
> think it can, unless you can change where it tries to get libc's version.
>
> Do you want to be able to look in the fs of your instance? You can't. 
>
> If what you want is a "platform string", you could always create your own 
> string, put it in an environment variable (in your app.yaml) and get it 
> there?
>
> If you could explain what you expect to get and do with the 
> platform.platform return, I'd be happy to look into ways for you to do it.
>
> Cheers!
>
> On Monday, August 10, 2015 at 8:51:13 PM UTC-4, Michael Spainhower wrote:
>>
>> I have a 3rd party library (Authy) that calls `platform.platform()` (
>> https://docs.python.org/2/library/platform.html#platform.platform). 
>>  Unfortunately, when this function tries to get the libc version (assuming 
>> so, function is named libc_ver), it tries to open the file /usr/bin/python. 
>>  Obviously this does not work.
>>
>> Is there an established approach to handle this?  It seems like the kind 
>> of thing that would be stubbed out by GAE SDK (returning its own platform 
>> string, or an empty string).  I'll probably submit a PR for better 
>> exception handling with the library maintainer, but in the meantime I'd 
>> love a reasonable mitigation (I can think of some nasty hacks that would 
>> work).
>>
>> Cheers,
>> --Spain
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/dcd8be6f-88c1-460d-a61d-44bde07452d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to