Error when saving data as text (saveAsText)

Hi, I hope I am not missing something obvious here, but I could not find an answer on the forum or on the internet. When I try to save data with the saveAsText function, I get an error that seems to relate to the python replace method. The code snippet and the error message is pasted below.

#Looping through staircases
for thisStair in stairs:
       # The name of the file I am trying to save
       filename = "%s start%.2f %s" %(thisStair.extraInfo['observer'], thisStair.extraInfo['thisStart'], dateStr)
        # This gives me an error (see below)

The error message:

File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\data\”, line 504, in saveAsText
strInfo = strInfo.replace(strInfo, ': ', ‘:\n’)
TypeError: ‘str’ object cannot be interpreted as an integer

When I search for the error online, I find that the replace method requires an integer as the third argument (namely the count). I am pretty new to python so I wonder whether I’m missing something here, or if there indeed is a bug in the staircase code. I truly appreciate any help or insight in this matter!

I think you may need to convert dateStr, perhaps try replacing it with Int(dateStr).