If this template helps then use it. If not then just delete and start from scratch.
OS (e.g. Win10): Win 10 64-bit
PsychoPy version (e.g. 1.84.x): 3.0.7
Standard Standalone? (y/n) y If not then what?:
What are you trying to achieve?: I need the Experiment Settings set up in the Builder to match the Builder View Output Experiment Settings ![BuilderOrderExptSettings|359x257] (upload://cZEesTHxWJTm7Vi7Wc9NJd1Pbsz.jpeg) and the Coder View Output Experiment Settings and I need them to have the same variables.
What did you try to make it work?: I made sure the Builder and Coder had the same programming code. However, the Builder needs to use the “insert python commands into the experiment” Module.
In the Module for “Begin Routine”, I added import uuid which is also in the Coder View before the code for the experiment settings. The Module code for the “Each Frame” is:
# Store info about the experiment session
psychopyVersion = '3.0.7'
expName = 'questionnaires' # from the Builder filename that created this script
expInfo = {'Experiment': 'HHL', 'Participant': str(uuid.uuid4()), 'Date_of_Birth': '', 'Sex': '', 'Hours_of_Sleep': '', 'Session': '001'}
dlg = gui.DlgFromDict(dictionary=expInfo, title=expName)
if dlg.OK == False:
core.quit() # user pressed cancel
expInfo['date'] = data.getDateStr() # add a simple timestamp
expInfo['expName'] = expName
expInfo['psychopyVersion'] = psychopyVersion
# Data file name stem = absolute path + name; later add .psyexp, .csv, .log, etc
filename = _thisDir + os.sep + u'data/%s/%s' % (expInfo['Experiment','Participant'])
# An ExperimentHandler isn't essential but helps with data saving
thisExp = data.ExperimentHandler(name=expName, version='',
extraInfo=expInfo, runtimeInfo=None,
originPath='C:\\PsychoPyExperiments\\HHLExperiment\\B1GQ_B2MoCA.py',
savePickle=True, saveWideText=False,
dataFileName=filename)
# save a log file for detail verbose info
logFile = logging.LogFile(filename+'.log', level=logging.EXP)
logging.console.setLevel(logging.WARNING) # this outputs to the screen, not a file
endExpNow = False # flag for 'escape' or other condition => quit the exp
The program code from the Coder View is:
# Store info about the experiment session
psychopyVersion = '3.0.7'
expName = 'questionnaires' # from the Builder filename that created this script
expInfo = {'Experiment': 'HHL', 'Participant': str(uuid.uuid4()), 'Date_of_Birth': '', 'Sex': '', 'Hours_of_Sleep': '', 'Session': '001'}
dlg = gui.DlgFromDict(dictionary=expInfo, title=expName)
if dlg.OK == False:
core.quit() # user pressed cancel
expInfo['date'] = data.getDateStr() # add a simple timestamp
expInfo['expName'] = expName
expInfo['psychopyVersion'] = psychopyVersion
# Data file name stem = absolute path + name; later add .psyexp, .csv, .log, etc
filename = _thisDir + os.sep + u'data/%s/%s' % (expInfo['Experiment','Participant'])
# An ExperimentHandler isn't essential but helps with data saving
thisExp = data.ExperimentHandler(name=expName, version='',
extraInfo=expInfo, runtimeInfo=None,
originPath='C:\\PsychoPyExperiments\\HHLExperiment\\B1GQ_B2MoCA.py',
savePickle=True, saveWideText=False,
dataFileName=filename)
# save a log file for detail verbose info
logFile = logging.LogFile(filename+'.log', level=logging.EXP)
logging.console.setLevel(logging.WARNING) # this outputs to the screen, not a file
endExpNow = False # flag for 'escape' or other condition => quit the exp
What specifically went wrong when you tried that?: If I compile the program through the Builder, it deletes the uuid import and the code for it and deletes the Experiment variable. Before compiling, the Coder View has the correct information but not in the correct order.
Include pasted full error message if possible. “That didn’t work” is not enough information.
There is no error message. The compiler overwrites what I have in my coder when I run it.