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

Traceback:
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\inline_script.py", line 96, in run
self.experiment.python_workspace._exec(self.crun)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\base_python_workspace.py", 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

Comments

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

    Thanks,

    Eduard

    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.

    Stopped

    The experiment did not finish normally for the following reason:

    Unexpected error
    Details

    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\process.py", line 157, in run
    exp.run()
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\experiment.py", line 456, in run
    self.items.execute(self.var.start)
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 103, in execute
    self.run(name)
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 122, in run
    self[name].run()
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\sequence.py", line 51, in run
    self.experiment.items.run(_item)
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 122, in run
    self[name].run()
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\loop.py", line 347, in run
    self.experiment.items.execute(self._item)
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 102, in execute
    self.prepare(name)
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 142, in prepare
    self[name].prepare()
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\sequence.py", line 124, in prepare
    self.experiment.items.prepare(_item)
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 142, in prepare
    self[name].prepare()
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\sketchpad.py", line 149, in prepare
    temp_name, element.element_name
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\openexp_canvas\canvas.py", line 354, in exit
    self.prepare()
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\openexp_canvas\canvas.py", line 775, in prepare
    element.prepare()
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\openexp_canvas_image\psycho.py", line 33, in prepare
    image=safe_decode(self.fname)
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\psychopy\visual\image.py", line 97, in init
    self.setImage(image, log=False)
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\psychopy\visual\image.py", line 289, in setImage
    setAttribute(self, 'image', value, log)
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\psychopy\tools\attributetools.py", line 137, in setAttribute
    setattr(self, attrib, value)
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\psychopy\tools\attributetools.py", line 27, in set
    newValue = self.func(obj, value)
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\psychopy\visual\image.py", line 276, in image
    forcePOW2=False)
    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\psychopy\visual\basevisual.py", 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?

    Cheers!
    Sebastiaan
  • 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 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