TypeError: a bytes-like object is required, not ‘str’

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. MacOS):
PsychoPy version (e.g. 2024.1.5):
**Standard Standalone? (y)
**What are you trying to achieve?:**run experiment
here is my error code, can somebody help me?

Traceback (most recent call last):
File “/Users/chrisschafer/Documents/Bachelorthesis/TIM-Test/Experiment/Triad_3.5s_lastrun.py”, line 1481, in
run(
File “/Users/chrisschafer/Documents/Bachelorthesis/TIM-Test/Experiment/Triad_3.5s_lastrun.py”, line 355, in run
output.writerow ([‘ID_A’,‘ID_B’,‘ID_C’,‘IMG_A’,‘IMG_B’,‘IMG_C’,‘sim_AB’,‘sim_BC’,‘sim_AC’,‘difflevel’,‘Pair’])
TypeError: a bytes-like object is required, not ‘str’
################# Experiment ended with exit code 1 [pid:4043] #################

What did you try to make it work?: I tried to check the stimlists, tried older versions, don’t know which version is version “psychopy2”, the creator of this experiment told me to use this version but I don’t know which one to choose, 2022.2.3 or 2020.1.4 or what else there are too many :smiley:

What specifically went wrong when you tried that?:
Include pasted full error message if possible. “That didn’t work” is not enough information.

Where does this come from?

this are the variables in the csv data for the triads demographics, this is needed for the analysis in the end

Hello Chris

You need to be more specific. Where and when does your program read/write the string?

The error message tells you that you are treating a byte-like object as a string, which is not possible in Python. Google the error message to see approaches to solving the problem.

Best wishes Jens

1 Like