AlexM
AlexM

Reputation: 325

Python Error: Unexpected end of data while reading a .tar file

I'm trying to run TensorFlow's translate.py file, but after a few seconds already I keep getting this error:

tarfile.ReadError: unexpected end of data

I have no idea why this happens and I've tried several things, including downloading the needed data myself and comment the line in the code that do the downloading, but nothing worked.

Here is the site that I follow: https://www.tensorflow.org/tutorials/seq2seq

And just in case you need everything, here are the lines from the command to the error:

C:\Users\Mueller>python translate.py
Preparing WMT data in /tmp
Extracting tar file /tmp\training-giga-fren.tar
Traceback (most recent call last):
  File "translate.py", line 322, in <module>
    tf.app.run()
  File "C:\Users\Mueller\AppData\Local\Programs\Python\Python35\lib\site-package
s\tensorflow\python\platform\app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "translate.py", line 319, in main
    train()
  File "translate.py", line 173, in train
    FLAGS.data_dir, FLAGS.from_vocab_size, FLAGS.to_vocab_size)
  File "C:\Users\Mueller\data_utils.py", line 267, in prepare_wmt_data
    train_path = get_wmt_enfr_train_set(data_dir)
  File "C:\Users\Mueller\data_utils.py", line 83, in get_wmt_enfr_train_set
    corpus_tar.extractall(directory)
  File "C:\Users\Mueller\AppData\Local\Programs\Python\Python35\lib\tarfile.py",
 line 1996, in extractall
    numeric_owner=numeric_owner)
  File "C:\Users\Mueller\AppData\Local\Programs\Python\Python35\lib\tarfile.py",
 line 2038, in extract
    numeric_owner=numeric_owner)
  File "C:\Users\Mueller\AppData\Local\Programs\Python\Python35\lib\tarfile.py",
 line 2108, in _extract_member
    self.makefile(tarinfo, targetpath)
  File "C:\Users\Mueller\AppData\Local\Programs\Python\Python35\lib\tarfile.py",
 line 2156, in makefile
    copyfileobj(source, target, tarinfo.size, ReadError)
  File "C:\Users\Mueller\AppData\Local\Programs\Python\Python35\lib\tarfile.py",
 line 243, in copyfileobj
    raise exception("unexpected end of data")
tarfile.ReadError: unexpected end of data

Does anybody know what is happening here?

Upvotes: 2

Views: 7253

Answers (1)

Ryan D mello
Ryan D mello

Reputation: 87

If your machine is running behind a proxy server, its possible that the downloaded tar file maybe getting stripped/blocked by proxy server, resulting in corrupted downloaded file.

Upvotes: 4

Related Questions