a-hurst / klibs

A simple Python framework for writing cognitive psychology experiments
7 stars 1 forks source link

unable to run TaskSwitching program #7

Closed abidi-wq closed 2 years ago

abidi-wq commented 2 years ago

Hello,

I'm trying to run the task switching program from a laptop running on windows 7. I installed python and klibs following the instructions, but when I try to run the experiment, I receive the following error :

C:\Users\user\AppData\Local\Programs\Python\Python38-32\TaskSwitching-master>kli bs run 24

*** Now Loading KLibs Environment *** No database file was present at 'ExpAssets\TaskSwitching.db'. You can (c)reate it, (s)upply a diffe rent path or (q)uit:

Thanks, Best regards

a-hurst commented 2 years ago

Hi @abidi-wq, thanks for the bug report! This is an expected message when you first run a project, you can just press "c" to create the database (which is where all the task data is collected for later export) and continue.

The tags and whatnot are from a bug that I've since fixed in the experimental branch: on macOS/Linux and Windows 10 terminals those color the text output to be all pretty but they don't work with Windows 7's CMD.exe. They won't affect the experiment runtime at all.

abidi-wq commented 2 years ago

Many thanks, the program works however, I have a second little problem: after answering all questions relating to the participant, I press enter to start the experiment but the program bug in the first trial and display the following message: "Python has stopped working. A problem caused the program to stop working correctly. WIndows will close the program and notify you if a solution is available." (I use python 3.8)

Thank you very much for your help!

a-hurst commented 2 years ago

Oh wow, I don't think I've ever had Python hard-crash for me on Windows before. Does it give you any more terminal output after that? Also, are you getting to the point where you see the stimuli and hear the background noise? The more info I have, the more I can narrow it down.

Also, I think the TaskSwitching paradigm was written back when we were using Python 2.7, but I remember updating it to be 3.x compatible so that shouldn't be a factor, especially if it's launching in the first place.

abidi-wq commented 2 years ago

Hello,

No, it display only one message ""Python has stopped working. A problem caused the program to stop working correctly. WIndows will close the program and notify you if a solution is available" and close the program.

I see the first stimulus (the two empty boxes with a circle in the middle) with a little sound (the sound last about 1 second).

I tried also to run the task with Python 2.7/ 3.6 and 3.7 but I still encounter the same problem

a-hurst commented 2 years ago

Hmmm, very strange. Can you try commenting out all calls to Mix_PlayChannel in the experiment.py file? I have a suspicion your crash has something to do with the audio playback/generation, if it works with those commented out I'll know I've isolated the problem.

abidi-wq commented 2 years ago

How can I do this please?

a-hurst commented 2 years ago

Just search through the file and add a # in front of every instance of Mix_PlayChannel you see, except for the very first one in the imports section of the file. Hopefully that fixes it and I can look into why the noise playback might cause crashes!

abidi-wq commented 2 years ago

It works (without the backgroud noise). many thanks

a-hurst commented 2 years ago

@abidi-wq Okay, I think I've figured it out and fixed it. Can you try downloading and running the latest version of TaskSwitching for me?

From the looks of it, there was a memory management bug that would cause the app to crash whenever it tried to free the memory associated with the random audio noise we generated. Somehow that never happened during testing or data collection, but Windows probably manages memory pretty differently than macOS so that might be why you're seeing it now. The latest version should have everything fixed.

abidi-wq commented 2 years ago

Many thanks! It works :)

a-hurst commented 2 years ago

Glad to hear it! Also, if you're looking to do a replication or extension of the task, please let us know how it goes!