Howdy, Stranger!

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

Supported by

[solved] Prepare Phase

edited July 2015 in OpenSesame

Could someone please confirm (or otherwise) that the prepare phase of all Python inline scripts, in ones experiment, are run at the initial start up? (As opposed to being run sequentially, as you progress to the relevant item.)

I noticed that my SQLite connection was getting closed, even though I hadn't issued any close command until the final item's prepare phase. If I move the close into the run phase, then it works... I've been going mad trying to understand why it kept closing itself and the above would be a justifiable explanation :)

Thanks;
C

Comments

  • edited July 2015

    ...although, if that were the case, what is happening with variable assignment? If I declare a variable in the prepare phase, I can still use it in the run phase contextually; that is, it respects any dependencies said variable might have (e.g., a loop index), rather than overwriting the value.

    I would be interested in knowing how this works at a technical level. I'm a developer by profession and I'm finding a lot of "gotchas" are to do with my mental model vs. the compromises you've put in place to allow non-developers to use OpenSesame more intuitively. (Not that that's a complaint! I think it's a good design decision, in general, and am impressed that you went to the trouble of implementing it :) )

  • edited 12:20PM

    Could someone please confirm (or otherwise) that the prepare phase of all Python inline scripts, in ones experiment, are run at the initial start up? (As opposed to being run sequentially, as you progress to the relevant item.)

    Not exactly. The prepare phase of every item in a sequence, is executed at the start of that sequence. So say that you have a sequence s, with items i1 and i2, then it would go like this:

    • run s
      • prepare i1
      • prepare i2
      • run i1
      • run i2

    But this happens only at the sequence level; or, put differently, sequences don't have a prepare phase themselves, and everything that you see above would happen as part of a sequence run phase.

    Does that clear things up? You could visualize the flow of the experiment by having inline_script items print to the debug window in both the prepare and run phase.

    See also:

    ...although, if that were the case, what is happening with variable assignment? If I declare a variable in the prepare phase, I can still use it in the run phase contextually; that is, it respects any dependencies said variable might have (e.g., a loop index), rather than overwriting the value.

    I'm not sure what you mean here. Can you give an example?

    I'm a developer by profession and I'm finding a lot of "gotchas" are to do with my mental model vs. the compromises you've put in place to allow non-developers to use OpenSesame more intuitively.

    That's true, and one of the main challenges when designing OpenSesame.

    Cheers!
    Sebastiaan

  • edited 12:20PM

    Thanks, Sebastiaan

    That clears everything up and resolves my issue/misunderstanding with variable assignment persistence. I was thinking you must use a closure, or something like that, but Python doesn't really have proper closures. Scoping by sequence is a nice solution :)

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