# Psychopy tutorial missing code

**URL:** <https://discourse.psychopy.org/t/psychopy-tutorial-missing-code/2941>\
**Category:** Coding\
**Created:** [August 17, 2017, 2:39pm UTC](https://discourse.psychopy.org/t/psychopy-tutorial-missing-code/2941 "2017-08-17T14:39:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ToddHorowitz](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@ToddHorowitz](https://discourse.psychopy.org/u/ToddHorowitz)\
**Post date:** [August 17, 2017, 2:39pm UTC](https://discourse.psychopy.org/t/psychopy-tutorial-missing-code/2941/1 "2017-08-17T14:39:02Z")

</div>

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![jon](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jon/32/22_2.png) [@jon](https://discourse.psychopy.org/u/jon)\
**Post date:** [August 17, 2017, 6:56pm UTC](https://discourse.psychopy.org/t/psychopy-tutorial-missing-code/2941/2 "2017-08-17T18:56:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ToddHorowitz](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@ToddHorowitz](https://discourse.psychopy.org/u/ToddHorowitz)\
**Post date:** [August 18, 2017, 11:58am UTC](https://discourse.psychopy.org/t/psychopy-tutorial-missing-code/2941/3 "2017-08-18T11:58:49Z")

</div>

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

thanks for being so responsive!

---

<div class="post-metadata">

**Author:** ![jon](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jon/32/22_2.png) [@jon](https://discourse.psychopy.org/u/jon)\
**Post date:** [August 18, 2017, 3:43pm UTC](https://discourse.psychopy.org/t/psychopy-tutorial-missing-code/2941/4 "2017-08-18T15:43:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ToddHorowitz](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@ToddHorowitz](https://discourse.psychopy.org/u/ToddHorowitz)\
**Post date:** [August 18, 2017, 4:26pm UTC](https://discourse.psychopy.org/t/psychopy-tutorial-missing-code/2941/5 "2017-08-18T16:26:05Z")

</div>

Looks good! Thanks again!

---

<div class="post-metadata">

**Author:** ![ToddHorowitz](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@ToddHorowitz](https://discourse.psychopy.org/u/ToddHorowitz)\
**Post date:** [August 21, 2017, 8:52pm UTC](https://discourse.psychopy.org/t/psychopy-tutorial-missing-code/2941/6 "2017-08-21T20:52:25Z")

</div>

The new version cuts off lines 1 and 2.
