Howdy, Stranger!

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

Supported by

Python error on previously working opensesame experiment when using Anaconda environment

OpenSesame version - 4.0.37

Operating system - Windows 11

Backend - legacy

I have an opensesame experiment I am using to run an eye tracking experiment which has previously worked on Windows (not sure if 10 or 11 sadly). I have had to change eye trackers (from my pilot study) from iMotions to Tobii and therefore have had to change my Opensesame experiment to include PyGaze.

I have created an Anaconda environment following the directions on the Opensesame site using Python 3.10 and Opensesame version 4.0.37.

I was previously using Opensesame version 3.3.14 and Python 3.12.


The python code I am having problems with is:

var.list_locations = ["upper_left", "upper_right", "lower_left", "lower_right"]

var.possible_grid_locations = var.list_locations.copy()


When I try to run the experiment now (on Windows 11, Python 3.10, Opensesame 4.0.37 through Anaconda environment) I get the following error message:

AttributeErrorr: 'str' object has no attribute 'copy'


I am not sure why it won't allow me to copy the list as I believe I have created a list and not a string. I would greatly appreciate if someone can help me figure out how to solve this problem.

Thanks.

Comments

  • edited July 14

    Hi @gel1428

    My first guess is that this issue is happening because even though you're assigning a list to var.list_locations, OpenSesame stores it as a string representation of that list. A couple suggestions to fix it:

    1) You could convert the string back into a list using ast.literal_eval, like this:

    import ast
    var.possible_grid_locations = ast.literal_eval(var.list_locations).copy()
    

    2) Or, you could just work with regular Python variables:

    list_locations = ["upper_left", "upper_right", "lower_left", "lower_right"]
    var.possible_grid_locations = list_locations.copy() # you can also assign it to var.list_location if needed
    

    Either way should work, depending on how you’re planning to use the variables.

    Hope this helps!

    Claire

  • Hi Claire,

    Thank you very much for that!

    Using both methods does fix the error. However, if I use solution one then the variables are not listed in the variable inspector and are not logged. What might be the reason for this?

    import ast
    var.possible_grid_locations = ast.literal_eval(var.list_locations).copy()
    

    Thanks!

  • Hi @gel1428

    Glad it's working now!

    When using solution one, make sure that you have a line right before it that defines var.list_locations. If you have already done that, check that your logger item is placed after your inline script and that you have either selected 'Log all variables' or entered your variable names manually.

    If you're still having issues, you could send me your experiment file so I can take a look.

    Cheers,

    Claire

  • Hi Claire,

    I managed to get the variables logged in the end but specifically mentioning them in the logger.

    Thanks for all the help!!

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