Not wanting to belabour the point, but the issue as reported isn’t between experimental runs, but between different installations. Presumably, the order is constant between runs within each installation. If those installations have different versions of PsychoPy, then yes, the underlying code might differ (due to bug fixes or new features, etc), with the effect that variables might be being written in a different order, or even that entirely new variables are added.
So our strong recommendation is to never change PsychoPy versions during data collection for a given study, precisely because ongoing development can introduce unexpected changes, in either performance or output. Even if those changes improve performance, the inconsistency is undesirable. In your case, it sounds like you might have two different installations running in parallel, which is equivalent to changing version in series.
Not sure if you’re aware of this (I’ve never done it myself, and perhaps this is the approach you’re already taking), but the
.psydat files are basically freeze-dried representations of your experiment handler objects. So if you want consistent data output despite the differing versions used, (I think) you could iterate over all of the
.psydat files, import each into an
ExperimentHandler, and then call
.saveAsWideText() on it. This should give you the same ordering for the columns regardless of the version the task was run under, because the exporting is being run consistently from just one version of the PsychoPy library. This should work whether or not you force the output to be alphabetical (which is probably not a desirable arrangement to work with practically).
Again, maybe you’re already pursuing this approach, but if not, there is an example of the technique in the
csvFromPsyday.py file available under there
demos menu in the Coder view of the PsychoPy app. In essence, wrap this in a loop:
from psychopy.tools.filetools import fromFile
# read in the experiment session from the psydat file:
exp = fromFile('some_file.psydat')
# save it as csv:
Hopefully that works for you?
EDIT: Wait a moment, maybe that is bollocks, as the exported key order might still depend on the pickled representations of each individual dictionary, which might vary across the different
.psydat files. So I guess you might still need to force the alphabetical ordering.