Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EOF error with cpickle.Unpickler in common.py #335

Open
hiyamgh opened this issue May 20, 2020 · 2 comments
Open

EOF error with cpickle.Unpickler in common.py #335

hiyamgh opened this issue May 20, 2020 · 2 comments

Comments

@hiyamgh
Copy link

hiyamgh commented May 20, 2020

I am trying to run the very basic example found in the README file.

I reached the following line:

./ocropus-rpred -Q 4 -m models/fraktur.pyrnn.gz 'book/0001/010001.bin.png'

But it gives me the following error:

INFO:
INFO:  ########## ./ocropus-rpred -Q 4 -m models/fraktur.pyrnn.gz book/0001/01
INFO:
INFO:  #inputs: 1
# loading object .\.\models/fraktur.pyrnn.gz
Traceback (most recent call last):
  File "./ocropus-rpred", line 120, in <module>
    network = ocrolib.load_object(args.model,verbose=1)
  File "C:\Users\96171\Desktop\ocropy\ocrolib\common.py", line 445, in load_object
    return unpickler.load()
EOFError

The error is appearing in the following function from common.py:

def load_object(fname,zip=0,nofind=0,verbose=0):
    """Loads an object from disk. By default, this handles zipped files
    and searches in the usual places for OCRopus. It also handles some
    class names that have changed."""
    if not nofind:
        fname = ocropus_find_file(fname)
    if verbose:
        print("# loading object", fname)
    if zip==0 and fname.endswith(".gz"):
        zip = 1
    if zip>0:
        # with gzip.GzipFile(fname,"rb") as stream:
        with os.popen("gunzip < '%s'"%fname,"rb") as stream:
            unpickler = cPickle.Unpickler(stream)
            unpickler.find_global = unpickle_find_global
            return unpickler.load()
    else:
        with open(fname,"rb") as stream:
            unpickler = cPickle.Unpickler(stream)
            unpickler.find_global = unpickle_find_global
            return unpickler.load()
@kba
Copy link
Collaborator

kba commented May 22, 2020

Assuming models/fraktur.pyrnn.gz is http://tmbdev.net/ocropy/fraktur.pyrnn.gz - could it be corrupt?

sha256sum models/fraktur.pyrnn.gzz

should be 0b79c3486c9060168b9bb6314f04eb7fd541b30a48c21033ad8fc6906cdf9cf2.

@lxc1851588
Copy link

Seems it isn't corrupted. I met the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants