Zim

automatic date in template using strftime() not working

Asked by david on 2016-03-09

Hi,

I'm new to Zim yesterday, and the automatic date is not working for me. It is returning the following when I run verbose:

[code]
ERROR: Error in strftime "%A %d %B %Y"
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/zim/templates/functions.py", line 47, in template_strf
time
    string = datetime.strftime(format, datetime.now())
  File "/usr/lib/python2.7/site-packages/zim/datetimetz.py", line 251, in strftime
    string = string.decode(locale.getlocale()[1]) # decode local specific output to unicode
TypeError: decode() argument 1 must be string, not None
INFO: Open page: <FileStorePage: researchmethods:test2> (<FileStorePage: researchmethods:test2>
)
[/code]

the version of zim is 0.65. Is this something to do with Python? My python is version 3.5.1-2

Arch linux

I hope you can help!

Cheers,

David

Question information

Language:
English Edit question
Status:
Solved
For:
Zim Edit question
Assignee:
No assignee Edit question
Solved by:
Jaap Karssenberg
Solved:
2016-03-10
Last query:
2016-03-10
Last reply:
2016-03-10

David,

Looks like something goes wrong with the locale settings. Is your computer
interface configured for English, or another language?

Btw. zim uses python 2, probably you it installed in parallel to python 3,
else zim would not run at all.

Regards,

Jaap

On Wed, Mar 9, 2016 at 12:02 PM, david <<email address hidden>
> wrote:

> New question #288330 on Zim:
> https://answers.launchpad.net/zim/+question/288330
>
> Hi,
>
> I'm new to Zim yesterday, and the automatic date is not working for me. It
> is returning the following when I run verbose:
>
> [code]
> ERROR: Error in strftime "%A %d %B %Y"
> Traceback (most recent call last):
> File "/usr/lib/python2.7/site-packages/zim/templates/functions.py", line
> 47, in template_strf
> time
> string = datetime.strftime(format, datetime.now())
> File "/usr/lib/python2.7/site-packages/zim/datetimetz.py", line 251, in
> strftime
> string = string.decode(locale.getlocale()[1]) # decode local specific
> output to unicode
> TypeError: decode() argument 1 must be string, not None
> INFO: Open page: <FileStorePage: researchmethods:test2> (<FileStorePage:
> researchmethods:test2>
> )
> [/code]
>
> the version of zim is 0.65. Is this something to do with Python? My python
> is version 3.5.1-2
>
> Arch linux
>
> I hope you can help!
>
> Cheers,
>
> David
>
> --
> You received this question notification because you are an answer
> contact for Zim.
>

david (dwlazlo) said : #2

Thanks Jaap Karssenberg, that solved my question.

david (dwlazlo) said : #3

Hi Jaap,

Thankyou! YEes this solved the problem. A few weeks ago I had a locale issue that I thought I had solved, but apparently not :)

Thanks for your quick reply, and thanks for the software!

David