psychopy.org | Reference | Downloads | Github

Self Paced Reading Task in Hindi

OS: Windows 10
PsychoPy version: 2020.2.4
Standard Standalone? (y/n): y
What are you trying to achieve?: I am trying to create a self-paced reading task in Hindi.

What did you try to make it work?: The experiment is working smoothly with English words, but it fails when it sees a Hindi word. I tried to make sure the CSV file is encoded using UTF-8 BOM following this post still it did not work.

reading_demo.psyexp

<?xml version="1.0" ?>
<PsychoPy2experiment encoding="utf-8" version="2020.2.4">
  <Settings>
    <Param name="Audio latency priority" updates="None" val="use prefs" valType="str"/>
    <Param name="Audio lib" updates="None" val="use prefs" valType="str"/>
    <Param name="Completed URL" updates="None" val="" valType="str"/>
    <Param name="Data file delimiter" updates="None" val="auto" valType="str"/>
    <Param name="Data filename" updates="None" val="u'data/%s_%s_%s' % (expInfo['participant'], expName, expInfo['date'])" valType="code"/>
    <Param name="Enable Escape" updates="None" val="True" valType="bool"/>
    <Param name="Experiment info" updates="None" val="{'participant':'', 'session':'001'}" valType="code"/>
    <Param name="Force stereo" updates="None" val="True" valType="bool"/>
    <Param name="Full-screen window" updates="None" val="True" valType="bool"/>
    <Param name="HTML path" updates="None" val="" valType="str"/>
    <Param name="Incomplete URL" updates="None" val="" valType="str"/>
    <Param name="Monitor" updates="None" val="testMonitor" valType="str"/>
    <Param name="Resources" updates="None" val="[]" valType="fileList"/>
    <Param name="Save csv file" updates="None" val="False" valType="bool"/>
    <Param name="Save excel file" updates="None" val="False" valType="bool"/>
    <Param name="Save log file" updates="None" val="True" valType="bool"/>
    <Param name="Save psydat file" updates="None" val="True" valType="bool"/>
    <Param name="Save wide csv file" updates="None" val="True" valType="bool"/>
    <Param name="Screen" updates="None" val="1" valType="num"/>
    <Param name="Show info dlg" updates="None" val="True" valType="bool"/>
    <Param name="Show mouse" updates="None" val="False" valType="bool"/>
    <Param name="Units" updates="None" val="height" valType="str"/>
    <Param name="Use version" updates="None" val="" valType="str"/>
    <Param name="Window size (pixels)" updates="None" val="(1024, 768)" valType="code"/>
    <Param name="blendMode" updates="None" val="avg" valType="str"/>
    <Param name="color" updates="None" val="$[0,0,0]" valType="str"/>
    <Param name="colorSpace" updates="None" val="rgb" valType="str"/>
    <Param name="expName" updates="None" val="reading_demo" valType="str"/>
    <Param name="exportHTML" updates="None" val="on Sync" valType="str"/>
    <Param name="logging level" updates="None" val="exp" valType="code"/>
  </Settings>
  <Routines>
    <Routine name="trial">
      <TextComponent name="text">
        <Param name="color" updates="constant" val="white" valType="str"/>
        <Param name="colorSpace" updates="constant" val="rgb" valType="str"/>
        <Param name="disabled" updates="None" val="False" valType="bool"/>
        <Param name="durationEstim" updates="None" val="" valType="code"/>
        <Param name="flip" updates="constant" val="" valType="str"/>
        <Param name="font" updates="constant" val="Arial" valType="str"/>
        <Param name="languageStyle" updates="None" val="LTR" valType="str"/>
        <Param name="letterHeight" updates="constant" val="0.1" valType="code"/>
        <Param name="name" updates="None" val="text" valType="code"/>
        <Param name="opacity" updates="constant" val="1" valType="code"/>
        <Param name="ori" updates="constant" val="0" valType="code"/>
        <Param name="pos" updates="constant" val="(0, 0)" valType="code"/>
        <Param name="saveStartStop" updates="None" val="True" valType="bool"/>
        <Param name="startEstim" updates="None" val="" valType="code"/>
        <Param name="startType" updates="None" val="time (s)" valType="str"/>
        <Param name="startVal" updates="None" val="0.0" valType="code"/>
        <Param name="stopType" updates="None" val="duration (s)" valType="str"/>
        <Param name="stopVal" updates="constant" val="" valType="code"/>
        <Param name="syncScreenRefresh" updates="None" val="True" valType="bool"/>
        <Param name="text" updates="set every repeat" val="$S1" valType="extendedStr"/>
        <Param name="units" updates="None" val="from exp settings" valType="str"/>
        <Param name="wrapWidth" updates="constant" val="" valType="code"/>
      </TextComponent>
      <KeyboardComponent name="key_resp">
        <Param name="allowedKeys" updates="constant" val="'y','n','left','right','space'" valType="code"/>
        <Param name="correctAns" updates="constant" val="" valType="str"/>
        <Param name="disabled" updates="None" val="False" valType="bool"/>
        <Param name="discard previous" updates="constant" val="False" valType="bool"/>
        <Param name="durationEstim" updates="None" val="" valType="code"/>
        <Param name="forceEndRoutine" updates="constant" val="True" valType="bool"/>
        <Param name="name" updates="None" val="key_resp" valType="code"/>
        <Param name="saveStartStop" updates="None" val="True" valType="bool"/>
        <Param name="startEstim" updates="None" val="" valType="code"/>
        <Param name="startType" updates="None" val="time (s)" valType="str"/>
        <Param name="startVal" updates="None" val="0.0" valType="code"/>
        <Param name="stopType" updates="None" val="duration (s)" valType="str"/>
        <Param name="stopVal" updates="constant" val="" valType="code"/>
        <Param name="store" updates="constant" val="last key" valType="str"/>
        <Param name="storeCorrect" updates="constant" val="False" valType="bool"/>
        <Param name="syncScreenRefresh" updates="constant" val="True" valType="bool"/>
      </KeyboardComponent>
    </Routine>
  </Routines>
  <Flow>
    <LoopInitiator loopType="TrialHandler" name="trials">
      <Param name="Selected rows" updates="None" val="" valType="str"/>
      <Param name="conditions" updates="None" val="[OrderedDict([('S1', 'जाम')]), OrderedDict([('S1', 'Hello')])]" valType="str"/>
      <Param name="conditionsFile" updates="None" val="..\stimulus.csv" valType="str"/>
      <Param name="endPoints" updates="None" val="[0, 1]" valType="num"/>
      <Param name="isTrials" updates="None" val="True" valType="bool"/>
      <Param name="loopType" updates="None" val="sequential" valType="str"/>
      <Param name="nReps" updates="None" val="1" valType="code"/>
      <Param name="name" updates="None" val="trials" valType="code"/>
      <Param name="random seed" updates="None" val="" valType="code"/>
    </LoopInitiator>
    <Routine name="trial"/>
    <LoopTerminator name="trials"/>
  </Flow>
</PsychoPy2experiment>

stimulus.csv

S1
जाम
Hello

What specifically went wrong when you tried that?:
This was the error message that I received:

###### Running: C:\Users\athul\Desktop\experiment\reading_demo_lastrun.py ######
4945.3213     INFO     Loaded monitor calibration from ['2020_09_19 23:39']
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
2.3750     WARNING     We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use ['sounddevice', 'PTB', 'pyo', 'pygame'] (in that order).
10.7373     WARNING     User requested fullscreen with size [1024  768], but screen is actually [1920, 1080]. Using actual size
Traceback (most recent call last):
  File "C:\Users\athul\Desktop\experiment\reading_demo_lastrun.py", line 120, in <module>
    text.setText(S1)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\visual\text.py", line 373, in setText
    setAttribute(self, 'text', text, log)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\tools\attributetools.py", line 141, in setAttribute
    setattr(self, attrib, value)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\tools\attributetools.py", line 32, in __set__
    newValue = self.func(obj, value)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\visual\text.py", line 364, in text
    self._setTextShaders(text)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\visual\text.py", line 388, in _setTextShaders
    multiline=True, width=self._wrapWidthPix)  # width of the frame
  File "C:\Program Files\PsychoPy3\lib\site-packages\pyglet\text\__init__.py", line 453, in __init__
    multiline, dpi, batch, group)
  File "C:\Program Files\PsychoPy3\lib\site-packages\pyglet\text\__init__.py", line 275, in __init__
    dpi=dpi, batch=batch, group=group)
  File "C:\Program Files\PsychoPy3\lib\site-packages\pyglet\text\layout.py", line 810, in __init__
    self.document = document
  File "C:\Program Files\PsychoPy3\lib\site-packages\pyglet\text\layout.py", line 919, in _set_document
    self._init_document()
  File "C:\Program Files\PsychoPy3\lib\site-packages\pyglet\text\layout.py", line 1020, in _init_document
    self._update()
  File "C:\Program Files\PsychoPy3\lib\site-packages\pyglet\text\layout.py", line 956, in _update
    lines = self._get_lines()
  File "C:\Program Files\PsychoPy3\lib\site-packages\pyglet\text\layout.py", line 932, in _get_lines
    glyphs = self._get_glyphs()
  File "C:\Program Files\PsychoPy3\lib\site-packages\pyglet\text\layout.py", line 1059, in _get_glyphs
    glyphs.extend(font.get_glyphs(text[start:end]))
  File "C:\Program Files\PsychoPy3\lib\site-packages\pyglet\font\base.py", line 385, in get_glyphs
    self.glyphs[c] = glyph_renderer.render(c)
  File "C:\Program Files\PsychoPy3\lib\site-packages\pyglet\font\win32.py", line 431, in render
    ord(text), ord(text), byref(abc)):
TypeError: ord() expected a character, but string of length 2 found
##### Experiment ended. #####

Any tips on handling non-English languages would be helpful too. Cheers!