Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[solved] error: coercing to Unicode: need string or buffer, int found

edited August 2013 in OpenSesame

I am getting this error message...I have no idea what is going on with this experiment. Anyone know what this could be?

An unexpected error occurred, which was not caught by OpenSesame. This should not happen! Message:
coercing to Unicode: need string or buffer, int found

Thanks

Comments

  • edited May 2013

    Hi Elizabeth,

    Could you please post the full error message? You can find this in the debug window.

    Cheers,
    Sebastiaan

  • edited August 2013

    I get the same error message, so I figured I'll post it here and try to revive this thread.

    Any help would be greatly appreciated because I'm basically stuck.

    Here's the output from the debug window:


    Python 2.7.3
    Type "help()", "copyright()", "credits()" or "license()" for more information.
    Type "modules()" for details about installed modules and version information.
    Use the "print [msg]" statement in inline_script items to print to this debug window.
    \>\>\> 
    Expyriment 0.6.3 (Revision 7f0fe8984130; Python 2.7.3) 
    openexp.sampler._legacy.init_sound(): sampling freq = 48000, buffer size = 512
    openexp.sampler._legacy.init_sound(): mixer already initialized, closing
    experiment.init_log(): using '/home/twoflower/subject-0.csv' as logfile (utf-8)
    experiment.run(): experiment started at Thu Aug 22 12:11:07 2013
    Traceback (most recent call last):
      File "/usr/lib/pymodules/python2.7/libqtopensesame/qtopensesame.py", line 1387, in run_experiment
        exp.run()
      File "/usr/lib/pymodules/python2.7/libopensesame/experiment.py", line 281, in run
        self.items[self.start].run()
      File "/usr/lib/pymodules/python2.7/libopensesame/sequence.py", line 55, in run
        self.experiment.items[item].run()
      File "/usr/lib/pymodules/python2.7/libopensesame/loop.py", line 147, in run
        _item.run()
      File "/usr/lib/pymodules/python2.7/libopensesame/sequence.py", line 55, in run
        self.experiment.items[item].run()
      File "/usr/lib/pymodules/python2.7/libopensesame/loop.py", line 146, in run
        _item.prepare()
      File "/usr/lib/pymodules/python2.7/libopensesame/sequence.py", line 107, in prepare
        self.experiment.items[_item].prepare()
      File "/usr/lib/pymodules/python2.7/libopensesame/sketchpad.py", line 207, in prepare
        _item["x"], _item["y"])
      File "/usr/lib/pymodules/python2.7/openexp/_canvas/legacy.py", line 738, in text
        color=color, html=html)
      File "/usr/lib/pymodules/python2.7/libopensesame/html.py", line 201, in render
        _y += dy
    TypeError: coercing to Unicode: need string or buffer, int found
    \>\>\>  
    
  • edited August 2013

    Hi,

    This error is most likely due to the use of a non-numeric value to specify the Y coordinate of your text.

    For example, the following line of script (in a sketchpad item) corresponds to drawing 'Some text' on the center of the screen:

    draw textline 0 0 "Some text"
    

    The second 0 corresponds to the Y coordinate of the text. If you replace this by something that is not numeric, you will get an error. For example, the following script will trigger an error:

    draw textline 0 this_should_be_numeric "Some text"
    

    This will also happen if specify the Y coordinate through a variable that has a non-numeric value. For example, the script below will work fine if [my_var] is '0', but will give an exception if [my_var] is 'this_should_be_numeric'.

    draw textline 0 [my_var] "Some text"
    

    Does this solve your problem?

    Cheers!
    Sebastiaan

  • edited 12:20AM

    Yes, that's exactly what happened. Apparently, I accidentally deleted the Y coordinate and the next variable was non-numerical.

    Thank you so much!

  • Hi there, I thought I would try to revive this thread because I am getting the same error message but I can not find a place in my program where there is a necessary integer that is missing. Here is an image of the debug window:

  • edited December 2017

    Hi,

    What exactly are you trying to do? Could you also upload your experiment? The error message means that some of your variables are of type integer even though they are supposed to be string or unicode. But if you don't provide your code, it is difficult to point to the correct location.

    Eduard

    Btw: maybe this discussion will help.

    Buy Me A Coffee

  • Hi I'm not sure how to upload my experiment because the file is too large even when compressed, though I'd be glad to send it directly if that's possible - I am trying to create a facial recognition test where there are 4 races and 2 genders within each represented. I have three sub loops - one for previously viewed faces the participant needs to identify, then sub loops for each of the 8 race/gender groupings, and one further loop within each of these sub loops that randomizes the position of the images on the sketchpad. I have been able to get a version of the program with just two race/gender sub loops to run but once the program runs one of these sub loops, it will not return to the largest loop and instead just continues to cycle through the sub loop, or more recently it will just end the experiment after a single trial and present this error message. Don't know if this info is helpful without the code - do you have any idea of how I might post it?

  • edited December 2017

    Ok, here is the debug window:

    Python 2.7.12

    • Type "help()", "copyright()", "credits()" or "license()" for more information.
    • Use the "print([msg])" function in inline_script items to print to this debug window.
    • Inspect inline_script variables when an experiment is finished.

    Expyriment 0.8.0 (Python 2.7.12)
    openexp.sampler._legacy.init_sound(): sampling freq = 48000, buffer size = 1024
    experiment.run(): experiment started at Sun Dec 17 12:08:19 2017
    experiment.run(): disabling garbage collection
    experiment
    experiment.end(): enabling garbage collection

    Unexpected error

    item-stack: experiment[run].Phase_3_2[run].P3_oldpics_2[run].newpics[run].LF_loop[run].LF_pos[run].xy_pos_LF[run].LF_trial[prepare].new_sketchpad_1[prepare]
    exception type: TypeError
    exception message: coercing to Unicode: need string or buffer, int found
    time: Sun Dec 17 12:08:27 2017

    Traceback:
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libqtopensesame/runners/inprocess_runner.py", line 38, in execute
    self.experiment.run()
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/experiment.py", line 411, in run
    self.items.execute(self.var.start)
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/item_store.py", line 91, in execute
    self.run(name)
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/item_store.py", line 106, in run
    self[name].run()
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/sequence.py", line 51, in run
    self.experiment.items.run(_item)
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/item_store.py", line 106, in run
    self[name].run()
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/sequence.py", line 51, in run
    self.experiment.items.run(_item)
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/item_store.py", line 106, in run
    self[name].run()
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/loop.py", line 338, in run
    self.experiment.items.execute(self._item)
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/item_store.py", line 91, in execute
    self.run(name)
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/item_store.py", line 106, in run
    self[name].run()
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/sequence.py", line 51, in run
    self.experiment.items.run(_item)
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/item_store.py", line 106, in run
    self[name].run()
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/loop.py", line 338, in run
    self.experiment.items.execute(self._item)
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/item_store.py", line 91, in execute
    self.run(name)
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/item_store.py", line 106, in run
    self[name].run()
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/sequence.py", line 51, in run
    self.experiment.items.run(_item)
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/item_store.py", line 106, in run
    self[name].run()
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/loop.py", line 338, in run
    self.experiment.items.execute(self._item)
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/item_store.py", line 90, in execute
    self.prepare(name)
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/item_store.py", line 122, in prepare
    self[name].prepare()
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/sequence.py", line 124, in prepare
    self.experiment.items.prepare(_item)
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/item_store.py", line 122, in prepare
    self[name].prepare()
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/sketchpad.py", line 118, in prepare
    self.canvas.prepare()
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/openexp/_canvas/xpyriment.py", line 97, in prepare
    stim.plot(self._canvas)
    File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/expyriment/stimuli/_visual.py", line 754, in plot
    rect.center = [self.position[0] + stimulus_surface_size[0] / 2,
    TypeError: coercing to Unicode: need string or buffer, int found

    With regards to the linked forum post, I am unsure which variable it might be helpful to define in inline code outside of the loops, but also wouldn't defining a variable with an integer be the opposite of what the error is indicating needs to be done? There are no if statements in my code either, except the ones directing the main loop into the race/gender sub loops, and some reason I don't thing that those statements are the issue, though maybe the fact that the program can only run through trials of a single sub loop before breaking indicates that the if statements are where the problem is.

  • Hi,

    Yes the problem is located somewhere in a sketchpad. You can upload your experiment anywhere, Googledocs, filedropper, etc. Perhaps, you can also simplify your experiment, i.e. remove some images from the filepool.

    The stracktrace alone is not really enough to find out what is going on.

    E

    Buy Me A Coffee

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games