# ERROR: MethodError: no method matching iterate(::Nothing)

**URL:** https://discourse.julialang.org/t/error-methoderror-no-method-matching-iterate-nothing/16034
**Category:** General Usage
**Created:** [October 8, 2018, 5:45pm UTC](https://discourse.julialang.org/t/error-methoderror-no-method-matching-iterate-nothing/16034 "2018-10-08T17:45:49Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![scelles](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scelles/32/220408_2.png) [@scelles](https://discourse.julialang.org/u/scelles)
#### Post date: [October 8, 2018, 5:45pm UTC](https://discourse.julialang.org/t/error-methoderror-no-method-matching-iterate-nothing/16034/1 "2018-10-08T17:45:49Z")

</div>

Hello,

I’m trying [Introducing Julia/Working with text files - Wikibooks, open books for an open world](https://en.wikibooks.org/wiki/Introducing_Julia/Working_with_text_files) with Julia 0.7

```julia
totaltime, totallines = open("sherlock-holmes.txt") do f
    linecounter = 0
    timetaken = @elapsed for l in eachline(f)
        linecounter += 1
    end
    (timetaken, linecounter)
end

```

but it raises

```julia
0.00626776313052
ERROR: MethodError: no method matching iterate(::Nothing)
Closest candidates are:
  iterate(::Core.SimpleVector) at essentials.jl:578
  iterate(::Core.SimpleVector, ::Any) at essentials.jl:578
  iterate(::ExponentialBackOff) at error.jl:171
  ...
Stacktrace:
 [1] indexed_iterate(::Nothing, ::Int64) at ./tuple.jl:63
 [2] top-level scope at none:0

```

Any idea was is wrong?

Maybe this document should be updated?

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [October 9, 2018, 7:32am UTC](https://discourse.julialang.org/t/error-methoderror-no-method-matching-iterate-nothing/16034/2 "2018-10-09T07:32:00Z")

</div>

The code works for me on 1.0 (on a different file, of course).
