Skip to content

Commit

Permalink
Merge pull request #2126 from dvbridges/newLineFix
Browse files Browse the repository at this point in the history
BF: Replaces escaped newline chars in conditions file strings
  • Loading branch information
peircej committed Dec 6, 2018
2 parents 0d918fd + 810a1a8 commit ed6c7ea
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions psychopy/data/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ def pandasToDictList(dataframe):
"""
# convert the resulting dataframe to a numpy recarray
trialsArr = dataframe.to_records(index=False)
# Check for new line characters in strings, and replace escaped characters
for record in trialsArr:
for idx, element in enumerate(record):
if isinstance(element, str):
record[idx] = element.replace('\\n', '\n')
if trialsArr.shape == ():
# convert 0-D to 1-D with one element:
trialsArr = trialsArr[np.newaxis]
Expand Down

0 comments on commit ed6c7ea

Please sign in to comment.