Howdy, Stranger!

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

Supported by

[open] Error using the legacy backend

edited March 2014 in OpenSesame

Hello,

First of all, I'm quite new to both OpenSesame and these forums so my apologies if I've asked this in the wrong place or I don't provide required information. I'm creating an experiment in which people have to sort objects on the screen into certain bins based on rules. For various reasons, I’ve written the entire thing as an inline script. I was experiencing a lot of lag when drawing the canvases, about 2 or 3 seconds just to draw 4 canvases with 5 ~2kb png images and a few lines of text. Switching to the legacy back-end seemed to fix this (though I have no experience with pygame). Now I am getting an error about 1/4 of the time I run the script, which is odd. Here is the traceback:

Traceback (most recent call last):

File "dist\libopensesame\inline_script.py", line 150, in run
File "<string>", line 299, in <module>
File "<string>", line 182, in runTrial
File "<string>", line 38, in drawCanvas
File "dist\openexp\_canvas\legacy.py", line 849, in image
TypeError: unsupported operand type(s) for -=: 'tuple' and 'int'
Traceback (most recent call last):
File "dist\libqtopensesame\qtopensesame.py", line 1393, in run_experiment
File "dist\libopensesame\experiment.py", line 287, in run
File "dist\libopensesame\sequence.py", line 55, in run
File "dist\libopensesame\inline_script.py", line 152, in run
inline_error: Error: Inline script error
In: main (run phase)
File "dist\openexp\_canvas\legacy.py", line 849, in image

Python traceback:
TypeError: unsupported operand type(s) for -=: 'tuple' and 'int'

First of all, is there some way I can actually view the offending line? I can’t seem to find legacy.py and I don’t know how to access the code that’s been “translated” (if that’s how it works) into pygame.
In any case, it seems to be taking issue with the function drawCanvas which I define in the script as,

def drawCanvas(canvas, imageList, textList):  #imageList and textList are lists of triples, (path,x,y) 
    for image in imageList:
        canvas.image(image[0],x=image[1],y=image[2])
    for string in textList:
        canvas.text(string[0],x=string[1],y=string[2],html=True)

If anyone knows why this would result in the error (mysteriously, only about 1/4 of the time) that’d be great but what I would really like to know is how to look at the pygame code as it appears at runtime. Alternatively, if there is some likely reason I was getting lag in Expyriment that would be useful information – perhaps I could sidestep this issue by switching back. Please let me know if more information is required.

Thanks!

Comments

  • edited March 2014

    Hi Noah,

    The following lines from your output tell you where in your inline script the errors come from:

    File "<string>", line 299, in <module>
    File "<string>", line 182, in runTrial
    File "<string>", line 38, in drawCanvas
    

    The problem seems to occur in the following line from your code snippet:

    canvas.image(image[0],x=image[1],y=image[2])
    

    I suspect either image[1] or image[2] is not an integer (as it should be), but a tuple (which it seems to be for some reason). You could try printing both to the Debug Window to check what they actually are, by adding the following line to your script, directly above the line in which you draw the image:

    print("x=%s, y=%s"  % (image[1], image[2])
    

    If this shows something else then x and y being two integers (as I suspect), then this will most likely pinpoint your problem.

    Just to explain the running of the PyGame code: based on your inline script and the canvas back-end, classes will be used from the scripts in this module. In your case, the method that's being used to draw an image, is this one.

    The xpyriment back-end may be slower on your setup, due to its blocking flip: it waits for the start of the vertical refresh, before continuing code execution. The same goes for the psycho back-end, although the latter uses different (GPU rather than CPU based) drawing methods. Although I have the same experience with xpyriment being generally slower than the other back-ends, this seems to be very platform and computer dependent.

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