Yes! You got it.
>From a linux command line, I set locale to default:
# export LC_ALL=C (can I do this directly in bpython?)
And now magically from bpython:
>>> import whois
>>> w=whois.whois('google.com')
>>> w.expiration_date
datetime.datetime(2020, 9, 14, 0, 0)
Thanks!
A further question (forgive me if sounds dumb, I'm not a guru in Python
objects):
Is there a way to know what locale setting is a datetime object using?
Cannot bpython "read" the locale and correctly interpret the real date
from a datetime?
Il giorno mercoledì 29 maggio 2013 13:17:22 UTC+2, marienz ha scritto:
>
> On Wed, May 29, 2013 at 9:07 PM, Antonio Mignolli
> <[email protected] <javascript:>> wrote:
> > Could be a python-whois issue?
> > Looks very strange to me.
>
> I bet it's the localization setup again. This has bit bpython in the past.
>
> Looking at the whois data for google.com using the commandline "whois"
> tool, I see an expiration date of "14-sep-2020". The "whois" package
> tries to "cast" strings to dates by applying datetime.strptime and a
> bunch of known formats, and just gives you a string if all formats
> fail. The format that should match here is '%d-%b-%Y', and %b is
> locale-sensitive (just checked the docs).
>
> This code in whois is a little dodgy, it needs to find a
> locale-insensitive way of parsing this date. It would be good if
> bpython would not be different from regular python here, but if I
> recall correctly that's hard: there was a reason we set up
> localization, and evaluating your code in a separate interpreter is
> not an easy feature to add to bpython.
>
> Sorry :(
>
> --
> Marien.
>
--
You received this message because you are subscribed to the Google Groups
"bpython" 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/bpython?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.