| Reference | Downloads | Github

Psychopy tutorial missing code

I’m new to Psychopy, and working through the JND tutorial in the manual. The tutorial is great, except that some lines of code seem to be missing. For example, on p. 82, the example code is

import time, numpy, random
try:#try to get a previous parameters file 
expInfo = fromFile('lastParams.pickle') 
except:#if not there then use a default set

Even without any Python or PsychoPy experience, it seems to me that something should come after the “except” line. Furthermore, the next line of text says “The last line adds the current date to whichever method was used.” , which clearly doesn’t match the code snippet.
I have run into this a few times so far, and I’m not done with the tutorial yet. I can grab the missing code bits from the full code page, of course, but my guess is this is a problem with formatting the pdf and could be fixed pretty easily.

Ah, thanks for pointing that out. I can explain why this has happened: the document building script is instructed to fetch particular line numbers from the full script but an automated-update, to help make PsychoPy Python3 compatible, added an extra line near the top of the script so everything got shifted by one. I’ll fix the pdf/html tomorrow.

I figured it was something like that, since the code snippets seems to be offset.

thanks for being so responsive!

That’s all fixed (and I’ve slightly improved the text)

Looks good! Thanks again!

The new version cuts off lines 1 and 2.