Howdy, Stranger!

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

Supported by

'int' object has no attribute error: why am I getting it now?

Hi all,

I am trying to modify an experiment in OpenSesame that was working fine. In the process of modifying the experiment, I started getting different version of the same error, 'int' object has no attribute 'X'. For example:

Error while executing inline script

item-stack: experiment[run].Set_Stage_ACQ1[run]
exception type: AttributeError
exception message: 'int' object has no attribute 'Stage'
item: Set_Stage_ACQ1
time: Sat Sep 29 17:18:52 2018
phase: run

File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\", line 96, in run
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\", line 124, in _exec
exec(bytecode, self._globals)
Inline script, line 1, in
AttributeError: 'int' object has no attribute 'Stage'

Here is the inline script code causing the error (in the run tab):

var.Stage = "ACQ1"
var.Stage_Trial = 0

Earlier in the experiment, the following inline script causes no error:

var.Stage = "PRACQ"
var.Stage_Trial = 0

Also, in the original experiment neither inline script causes an error.

I get the error with both the psychopy and expyriment backends.

I have attached the original experiment that works (fear_conditioning_FINAL) and the new one that is having the errors (counter_conditioning_Test1.3)--again, both have the same inline script.

System information:
System: Windows-10-10.0.16299
Architecture: win64
OpenSesame 3.2.5

Thanks for any advice you have! I greatly appreciate this community and OpenSesame!

-- Tom


  • Hi Tom,

    I have a hard time reproducing the error. Just from reading the code, there shouldn't be a problem.
    Could you provide a minimal example that leads to the same problem? I.e. remove as much as possible from your experiment without making the error disappear.



    Buy Me A Coffee

  • Thanks for the reply, Eduard. I removed the unnecessary items before the sequence in which the error occurs, and I now get a different error. When I removed fewer items, I got the same error (below), but with a different stimulus from the file pool. In both cases, I can see the stimulus that failed to load in the file pool. I have attached the file.


    The experiment did not finish normally for the following reason:

    Unexpected error

    item-stack: experiment[run].PRACQ[run].PRACQ_sequ[prepare].CS[prepare]
    exception type: IOError
    exception message: Found file 'c:\users\armstrtr\appdata\local\temp\tmp23ra3q.opensesame_pool\face1.jpg' [= c:\users\armstrtr\appdata\local\temp\tmp23ra3q.opensesame_pool\face1.jpg], failed to load as an image
    time: Tue Oct 02 08:54:03 2018
    Traceback (also in debug window)

    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libqtopensesame\misc\", line 157, in run
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\", line 456, in run
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\", line 103, in execute
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\", line 122, in run
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\", line 51, in run
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\", line 122, in run
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\", line 347, in run
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\", line 102, in execute
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\", line 142, in prepare
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\", line 124, in prepare
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\", line 142, in prepare
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\", line 149, in prepare
    temp_name, element.element_name
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\openexp_canvas\", line 354, in exit
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\openexp_canvas\", line 775, in prepare
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\openexp_canvas_image\", line 33, in prepare
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\psychopy\visual\", line 97, in init
    self.setImage(image, log=False)
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\psychopy\visual\", line 289, in setImage
    setAttribute(self, 'image', value, log)
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\psychopy\tools\", line 137, in setAttribute
    setattr(self, attrib, value)
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\psychopy\tools\", line 27, in set
    newValue = self.func(obj, value)
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\psychopy\visual\", line 276, in image
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\psychopy\visual\", line 803, in _createTexture
    raise IOError, msg % (tex, os.path.abspath(tex))
    IOError: Found file 'c:\users\armstrtr\appdata\local\temp\tmp23ra3q.opensesame_pool\face1.jpg' [= c:\users\armstrtr\appdata\local\temp\tmp23ra3q.opensesame_pool\face1.jpg], failed to load as an image

  • I decided to go back and start from scratch with the original experiment file that I was modifying, and now things are working fine. Thanks for trying to look into this Edward. No need to bother with it anymore, unless it might reveal a bug worth fixing....

  • edited October 2018
    Hi Tom,

    I haven't looked at the experiment, but based on the (first) error message, it seems like a clear case of 'shadowing'.

    That is, somewhere in the experiment, an integer is assigned to `var` (e.g. `var = 10`), so that `var` is no longer the original `var` object, and hence has no properties. Does that make sense?


    Buy Me A Coffee

  • Thanks, Sebastiaan. That makes perfect sense and explains other errors that were occurring!

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 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