# ERROR: LoadError: EOFError: read end of file

**URL:** https://discourse.julialang.org/t/error-loaderror-eoferror-read-end-of-file/106472
**Category:** New to Julia
**Tags:** question, package
**Created:** [November 20, 2023, 4:23pm UTC](https://discourse.julialang.org/t/error-loaderror-eoferror-read-end-of-file/106472 "2023-11-20T16:23:18Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![fathanbk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fathanbk/32/204067_2.png) [@fathanbk](https://discourse.julialang.org/u/fathanbk)
#### Post date: [November 20, 2023, 4:23pm UTC](https://discourse.julialang.org/t/error-loaderror-eoferror-read-end-of-file/106472/1 "2023-11-20T16:23:18Z")

</div>

I started to learn julia but i got this error when I’m trying to deserialize my file.mat

 ![image](https://global.discourse-cdn.com/julialang/original/3X/2/9/296fd0fb5fd6a7bafe070f9383a27b8172928333.png)

---

<div class="post-metadata">

### Author: ![BioTurboNick](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bioturbonick/32/6380_2.png) [@BioTurboNick](https://discourse.julialang.org/u/BioTurboNick)
#### Post date: [November 20, 2023, 4:34pm UTC](https://discourse.julialang.org/t/error-loaderror-eoferror-read-end-of-file/106472/2 "2023-11-20T16:34:31Z")

</div>

Hi,

So `Serialization` isn’t meant for reading arbitrary files, like a MATLAB file. (I’m guessing, based on the extension?).

Probably what’s happening is that it’s not seeing what it expects, gets to the end of the file, and gives up.

What you probably want to use is this: [GitHub - JuliaIO/MAT.jl: Julia module for reading MATLAB files](https://github.com/JuliaIO/MAT.jl)

---

<div class="post-metadata">

### Author: ![fathanbk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fathanbk/32/204067_2.png) [@fathanbk](https://discourse.julialang.org/u/fathanbk)
#### Post date: [November 20, 2023, 4:54pm UTC](https://discourse.julialang.org/t/error-loaderror-eoferror-read-end-of-file/106472/3 "2023-11-20T16:54:48Z")

</div>

I tried this package, and here is the following error I got

 ![image](https://global.discourse-cdn.com/julialang/original/3X/1/2/12cc1c652ad4ce7b471a9121edec1aee0ef5a6ba.png)

---

<div class="post-metadata">

### Author: ![BioTurboNick](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bioturbonick/32/6380_2.png) [@BioTurboNick](https://discourse.julialang.org/u/BioTurboNick)
#### Post date: [November 20, 2023, 4:59pm UTC](https://discourse.julialang.org/t/error-loaderror-eoferror-read-end-of-file/106472/4 "2023-11-20T16:59:51Z")

</div>

Okay, so it’s not a MATLAB file. What is it? How was `dataset.mat` generated?

---

<div class="post-metadata">

### Author: ![fathanbk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fathanbk/32/204067_2.png) [@fathanbk](https://discourse.julialang.org/u/fathanbk)
#### Post date: [November 20, 2023, 5:04pm UTC](https://discourse.julialang.org/t/error-loaderror-eoferror-read-end-of-file/106472/5 "2023-11-20T17:04:02Z")

</div>

I don’t really know how it was generated since It was provided by my lecturer and he asked me to use deserialize instead of matread

---

<div class="post-metadata">

### Author: ![BioTurboNick](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bioturbonick/32/6380_2.png) [@BioTurboNick](https://discourse.julialang.org/u/BioTurboNick)
#### Post date: [November 20, 2023, 5:11pm UTC](https://discourse.julialang.org/t/error-loaderror-eoferror-read-end-of-file/106472/6 "2023-11-20T17:11:48Z")

</div>

Hmm, there’s not a lot for us to go on here. I think you may need clarification from your lecturer?

---

<div class="post-metadata">

### Author: ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)
#### Post date: [November 20, 2023, 5:16pm UTC](https://discourse.julialang.org/t/error-loaderror-eoferror-read-end-of-file/106472/7 "2023-11-20T17:16:44Z")

</div>

Note that a serialized file (with Serialization) is not really a relocatable/distributable file format. It works great for temporary files on your own machine, but not so great to share around. So it could be a Julia version/platform/package environment mismatch?

---

<div class="post-metadata">

### Author: ![fathanbk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fathanbk/32/204067_2.png) [@fathanbk](https://discourse.julialang.org/u/fathanbk)
#### Post date: [November 21, 2023, 3:51am UTC](https://discourse.julialang.org/t/error-loaderror-eoferror-read-end-of-file/106472/8 "2023-11-21T03:51:02Z")

</div>

Alright, I will do that in class

---

<div class="post-metadata">

### Author: ![fathanbk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fathanbk/32/204067_2.png) [@fathanbk](https://discourse.julialang.org/u/fathanbk)
#### Post date: [November 21, 2023, 3:52am UTC](https://discourse.julialang.org/t/error-loaderror-eoferror-read-end-of-file/106472/9 "2023-11-21T03:52:13Z")

</div>

yes, i agree with your statement

---

<div class="post-metadata">

### Author: ![fathanbk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fathanbk/32/204067_2.png) [@fathanbk](https://discourse.julialang.org/u/fathanbk)
#### Post date: [November 21, 2023, 3:53am UTC](https://discourse.julialang.org/t/error-loaderror-eoferror-read-end-of-file/106472/10 "2023-11-21T03:53:44Z")

</div>

Finally, I solved this problem by changing the dataset into smaller instances from 314 million to 78 million instances
