Trouble with making SAC file

Hi,
I’m trying to convert ascii files to SAC files with obspy (ver. 1.4.0), but I get an error that the ljust method does not exist. So basically wondering if this is a problem with my version of obspy or something else?

Traceback (most recent call last):
File “/Volumes/Transcend/SeismoGeodesy/20220918_Chishang/gcoreTdp2sac.py”, line 63, in
sac = SACTrace(data=data[‘de’].values, **header)
File “/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/obspy/io/sac/sactrace.py”, line 901, in init
hf, hi, hs = _io.dict_to_header_arrays(header)
File “/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/obspy/io/sac/arrayio.py”, line 521, in dict_to_header_arrays
hs[HD.STRHDRS.index(hdr)] = value.ljust(8)
AttributeError: ‘UTCDateTime’ object has no attribute ‘ljust’

The header of SAC file as following:
header = {‘kstnm’: ‘TTCS’, ‘knetwk’: ‘TW’, ‘khole’: ‘00’, ‘ko’: UTCDateTime(2022, 9, 17, 13, 41, 19), ‘kevnm’: ‘20220918064415A’, ‘o’: -600.0, ‘mag’: 6.534, ‘ievtyp’: ‘ieq2’, ‘iztype’: ‘io’, ‘imagsrc’: ‘ievloc’, ‘imagtyp’: ‘imw’, ‘stla’: 23.12491, ‘stlo’: 121.21513, ‘evla’: 23.084, ‘evlo’: 121.1608, ‘evdp’: 8.61, ‘dist’: 7.176623786049101, ‘az’: 50.84329970592227, ‘baz’: 230.86461926981752, ‘gcarc’: 0.06454092828344238, ‘nzyear’: 2022, ‘nzjday’: 260, ‘nzhour’: 13, ‘nzmin’: 31, ‘nzsec’: 19, ‘delta’: 1.0, ‘kcmpnm’: ‘LYE’}

Please take some time to format your code blocks appropriately.
Your issue can be reproduced with this minimal example:

from obspy import UTCDateTime
from obspy.io.sac import SACTrace
ko = UTCDateTime()
SACTrace(ko=ko)

I do not know much about SAC internals, but apparently SACTrace expects ko to be a string.

From the SAC manual:

O 	F 	Event origin time (seconds relative to reference time.)
KO 	A 	Event origin time identification.