Howdy, Stranger!

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

Supported by

"list index out of range" when running exp, but can't find error in inline script

Hello,

I have an experiment file full of inline scripts that probably look like a pig's breakfast seeing as I'm not used to working with Python. When I check the inline scripts by copy-pasting their content into the console, everything works as it should. However, when I run the experiment using the Run command, I get the following error:

Starting experiment as ExperimentProcess-1
Expyriment  (Python 2.7.14) 
openexp.sampler._legacy.init_sound(): sampling freq = 48000, buffer size = 1024
experiment.run(): experiment started at Wed Apr 18 14:11:07 2018
experiment.run(): disabling garbage collection
Traceback (most recent call last):
  File "/usr/lib/python2.7/multiprocessing/queues.py", line 268, in _feed
    send(obj)
TypeError: expected string or Unicode object, NoneType found
experiment.end(): enabling garbage collection

Error while executing inline script

item-stack: experiment[prepare].construct_adaptation_reliable[prepare]
exception type: IndexError
exception message: list index out of range
item: construct_adaptation_reliable
time: Wed Apr 18 14:11:08 2018
phase: prepare

Traceback:
  File "/usr/lib/python2.7/dist-packages/libopensesame/inline_script.py", line 77, in prepare
    self.experiment.python_workspace._exec(self.cprepare)
  File "/usr/lib/python2.7/dist-packages/libopensesame/python_workspace.py", line 174, in _exec
    exec(bytecode, self._globals)
  Inline script, line 202, in <module>
IndexError: list index out of range

I consistently get this error when using Run, but never when going through the inline scripts line by line. I tried changing the offending lines, but that didn't work. I've no idea how to fix this error or what's causing it. I've attached the experimental file as well as a file containing the stimuli to be read in (you'll need to rename them to osexp and csv, because the interface didn't let me upload them otherwise); any help would be greatly appreciated.

Specs:

  • OpenSesame 3.2.4b1
  • Python 2.7.14
  • Ubuntu 17.10

I couldn't replicate this error on Windows as the experiment throws another error (Python crashed. This shouldn't happen etc.)

Comments

  • edited April 2018

    Please ignore, I think I'm getting there. While I'm still not sure why the problem didn't crop up when manually going through the code, I'm now literally copy-paste every line of the inline script and using the print() command to see where things go awry.

    Edit: I've solved the problem. It's a bit too specific to be of any use to anyone else, I think, but in essence the error occurred because elsewhere, the script sometimes did and sometimes didn't create an empty array. Whenever an empty array was created, this resulted in the "list index out of range" error several lines below. I still don't know why this never happened in the 10+ times I went to the script manually, but I eventually found the problem by building up the script line by line and checking the result of each line using "print(newly_created_variable)". HTH

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