да, прикол именно вызвать стандартный модуль из командной строки с нужной локалью. Просто из файла “как программа” все ОК!
rodegast@rodegast:~$ python -m calendar -L “ru” -e “UTF-8” 2019 1
Январь 2019
Пн Вт Ср Чт Пт Сб Вс
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Премного-премного благодарен. Этого то я и хотел.
Работает. Но под Linux.
А под Win - нет, к сожалению.
I:\[Alex(progress)dict]>python -m calendar -L "ru" -e "1251" 2019 1
Traceback (most recent call last):
File "C:\Python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python36\lib\calendar.py", line 713, in <module>
main(sys.argv)
File "C:\Python36\lib\calendar.py", line 704, in main
result = cal.formatmonth(options.year, options.month, **optdict)
File "C:\Python36\lib\calendar.py", line 325, in formatmonth
s = self.formatmonthname(theyear, themonth, 7 * (w + 1) - 1)
File "C:\Python36\lib\calendar.py", line 525, in formatmonthname
with different_locale(self.locale):
File "C:\Python36\lib\calendar.py", line 495, in __enter__
_locale.setlocale(_locale.LC_TIME, self.locale)
File "C:\Python36\lib\locale.py", line 598, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
J:\...hings.S01E16.720p.WEB.x264-TBS[rarbg]>python -m calendar -L "ru" -e "UTF-8" 2019 1
Traceback (most recent call last):
File "C:\Python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python36\lib\calendar.py", line 713, in <module>
main(sys.argv)
File "C:\Python36\lib\calendar.py", line 704, in main
result = cal.formatmonth(options.year, options.month, **optdict)
File "C:\Python36\lib\calendar.py", line 325, in formatmonth
s = self.formatmonthname(theyear, themonth, 7 * (w + 1) - 1)
File "C:\Python36\lib\calendar.py", line 525, in formatmonthname
with different_locale(self.locale):
File "C:\Python36\lib\calendar.py", line 495, in __enter__
_locale.setlocale(_locale.LC_TIME, self.locale)
File "C:\Python36\lib\locale.py", line 598, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
I:\[Alex(progress)dict]>python -m calendar -L "deutsch" -e "1251" 2019 1
Traceback (most recent call last):
File "C:\Python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python36\lib\calendar.py", line 713, in <module>
main(sys.argv)
File "C:\Python36\lib\calendar.py", line 704, in main
result = cal.formatmonth(options.year, options.month, **optdict)
File "C:\Python36\lib\calendar.py", line 325, in formatmonth
s = self.formatmonthname(theyear, themonth, 7 * (w + 1) - 1)
File "C:\Python36\lib\calendar.py", line 525, in formatmonthname
with different_locale(self.locale):
File "C:\Python36\lib\calendar.py", line 495, in __enter__
_locale.setlocale(_locale.LC_TIME, self.locale)
File "C:\Python36\lib\locale.py", line 598, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
то же со строками:
python -m calendar -L "rus" -e "1251" 2019 1
python -m calendar -L "russian" -e "1251" 2019 1
python -m calendar -L "Russian" -e "1251" 2019 1
python -m calendar -L "Russian_Russia" -e "1251" 2019 1
python -m calendar -L "deutsch" -e "1251" 2019 1
python -m calendar -L "ru" -e "1251" 2019 1
python -m calendar -L "ru" -e "UTF-8" 2019 1
py -m calendar -L "ru" -e "UTF-8" 2019 1
py -m calendar -L "ru" -e "UTF-8" 2019
python -m calendar -L "deutsch" -e "UTF8" 2019 1
python -m calendar -L "deutsch" -e "UTF-8" 2019 1
python -m calendar -L "deutsch" -e "1251" 2019 1
python -m calendar -L "deutsch" -e "cp1251" 2019 1
python -m calendar -L "deutsch" -e "win1251" 2019 1
python -m calendar -L "deutsch" -e "866" 2019 1
python -m calendar -L "deutsch" -e "cp866" 2019 1
============
по “py” у меня там 3.7, вообще есть оба 32/64
все, устал перебирать.
Пытался понять трэйсбэк, но ума не хватило.
Вся надежда на вас всех….
P.S. кавычки, разумеется, все прямые, как видно в трейсбэках