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

_pickle.UnpicklingError: the STRING opcode argument must be quoted #26

Open
mohamedwahba129 opened this issue Apr 23, 2022 · 3 comments

Comments

@mohamedwahba129
Copy link

def load_binary_pickle( filepath ):
with open(filepath, 'rb') as f:
data = pickle.load(f, encoding="latin1")
return data

@shreyaschincholkar
Copy link

shreyaschincholkar commented May 9, 2022

Hi @mohamedwahba129 were you able to fix this issue?
I am facing a similar issue in "flame-fitting\fitting\util.py" line 48

def load_binary_pickle( filepath ):
    with open(filepath, 'rb') as f:
        data = pickle.load(f, encoding="latin1")
    return data

This error:

 data = pickle.load(f, encoding="latin1")
_pickle.UnpicklingError: invalid load key, '\x0a'.

@199ChenNuo
Copy link

Hi, I met the same problem. I'm using Windows, and I think this problem may be caused by different encodings between OS.

I processed the original ./models/flame_static_embedding.pkl, replaced the file path in fit_lmk3d.py in line 137 and this problem is solved.
The processing code is:

original = "./models/flame_static_embedding.pkl"
destination = "./models/processed_embeeding.pkl"

content = ''
outsize = 0
with open(original, 'rb') as infile:
  content = infile.read()
with open(destination, 'wb') as output:
  for line in content.splitlines():
    outsize += len(line) + 1
    output.write(line + str.encode('\n'))

print("Done. Saved %s bytes." % (len(content)-outsize))

@443421190
Copy link

_pickle.UnpicklingError: the STRING opcode argument must be quoted

How

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

4 participants