Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python example #641

Merged
merged 1 commit into from
Jul 28, 2015
Merged

Python example #641

merged 1 commit into from
Jul 28, 2015

Conversation

nirgal
Copy link
Contributor

@nirgal nirgal commented Jul 28, 2015

When using python rrdtool.graph(), the locale environment is ignored and months names were always output in English.

The first patch add a hint in documentation pydoc rrdtool.graph about calling setlocale first.

The second patch add the stripes example, re-implemented in python (with the locale.setlocale call).

@oetiker
Copy link
Owner

oetiker commented Jul 28, 2015

This is not something python specific but the way locales are to be handled ... see 'man setlocale'

On startup of the main program, the portable "C" locale is selected as default. A program may be made portable to all locales by calling:

setlocale(LC_ALL, "");

so mentioning this explicitly for the python bindings seems a bit odd.

Like the example though ...

This include the locale.setlocale() trick
@nirgal
Copy link
Contributor Author

nirgal commented Jul 28, 2015

I forgot the setlocale in the past and it took me forever to understand. But I agree this is not the best place to document that.
So I changed by branch to skip the python docstring change.
That branch now only has the python example. I think this is enough since have it would have put me in the right track then.

@nirgal nirgal changed the title Python locale warning and example Python example Jul 28, 2015
@oetiker
Copy link
Owner

oetiker commented Jul 28, 2015

thanks!

oetiker added a commit that referenced this pull request Jul 28, 2015
@oetiker oetiker merged commit e8e9611 into oetiker:1.5 Jul 28, 2015
@nirgal nirgal deleted the python-locale branch July 28, 2015 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants