Skip to content

Commit

Permalink
BF: Builder can't open conds file when non-ASCII characters in path i…
Browse files Browse the repository at this point in the history
…n Py2

this is copying from commit 32204a2
  • Loading branch information
peircej committed Dec 7, 2017
1 parent 57eed7a commit c555ca2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions psychopy/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2662,12 +2662,12 @@ def pandasToDictList(dataframe):
with open(fileName, 'rU') as fileUniv:
# use pandas reader, which can handle commas in fields, etc
trialsArr = pandas.read_csv(fileUniv, encoding='utf-8')
logging.debug("Read csv file with pandas: {}".format(fileName))
logging.debug(u"Read csv file with pandas: {}".format(fileName))
trialList, fieldNames = pandasToDictList(trialsArr)

elif fileName.endswith(('.xlsx','.xls')) and haveXlrd:
trialsArr = pandas.read_excel(fileName)
logging.debug("Read excel file with pandas: {}".format(fileName))
logging.debug(u"Read excel file with pandas: {}".format(fileName))
trialList, fieldNames = pandasToDictList(trialsArr)

elif fileName.endswith('.xlsx'):
Expand All @@ -2679,7 +2679,7 @@ def pandasToDictList(dataframe):
else:
wb = load_workbook(filename=fileName, data_only=True)
ws = wb.worksheets[0]
logging.debug("Read excel file with openpyxl: {}".format(fileName))
logging.debug(u"Read excel file with openpyxl: {}".format(fileName))
try:
# in new openpyxl (2.3.4+) get_highest_xx is deprecated
nCols = ws.max_column
Expand Down Expand Up @@ -2750,7 +2750,7 @@ def pandasToDictList(dataframe):
for ii in selection:
trialList.append(allConds[int(round(ii))])

logging.exp('Imported %s as conditions, %d conditions, %d params' %
logging.exp(u'Imported %s as conditions, %d conditions, %d params' %
(fileName, len(trialList), len(fieldNames)))
if returnFieldNames:
return (trialList, fieldNames)
Expand Down

0 comments on commit c555ca2

Please sign in to comment.