Error : when use specific name as output file name in

Hi all,
When I try to write an MSEED file with the filename as its starting time it gave me the following error, But it is working when i give filename in words
tr.write(‘test’, format=‘MSEED’)

>> st=read(“LSA.IC.mseed”)

>> tr.write(str(tr.stats.starttime), format=‘MSEED’)
Traceback (most recent call last):

File “”, line 1, in
tr_hourly.write(str(tr.stats.starttime), format=‘MSEED’)

File “C:\ProgramData\Anaconda3\envs\obspy\lib\site-packages\obspy\core\”, line 990, in write
Stream([self]).write(filename, format, **kwargs)

File “C:\ProgramData\Anaconda3\envs\obspy\lib\site-packages\obspy\core\”, line 1462, in write
write_format(self, filename, **kwargs)

File “C:\ProgramData\Anaconda3\envs\obspy\lib\site-packages\obspy\io\mseed\”, line 846, in _write_mseed
f = open(filename, ‘wb’)

OSError: [Errno 22] Invalid argument: ‘2020-03-01T00:00:00.019500Z’

How could I write MSEED files with a timestamp as the filenames?

Hi Vivec,

I'm guessing the colon might not be allowed in a filename on Windows.
Try building filenames without dots and colons..

filename = tr.stats.starttime.strftime('%Y%m%d.mseed')


Windows platform does not permit colons in the file name, so no, under Windows you can’t use the timestamp directly in the filename. Pity, I know. You will have to somehow normalize the filename first.

Geoscience Australia Disclaimer: This e-mail (and files transmitted with it) is intended only for the person or entity to which it is addressed. If you are not the intended recipient, then you have received this e-mail by mistake and any use, dissemination, forwarding, printing or copying of this e-mail and its file attachments is prohibited. The security of emails transmitted cannot be guaranteed; by forwarding or replying to this email, you acknowledge and accept these risks.