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

Reading a binary file throws an error as reading from unicode is not handled. #3

Open
jayend-manika opened this issue Feb 25, 2017 · 5 comments

Comments

@jayend-manika
Copy link

When requested to read from a binary, which has unicode, it results in ERROR: UnicodeError: invalid character index.

To reproduce, load the test file from Google https://drive.google.com/file/d/0B7XkCwpI5KDYNlNUTTlSS21pQmM/edit?usp=sharing

@sambitdash
Copy link
Contributor

encoding attribute is there in the python version. That may not be exposed. Need to check.

@Paethon
Copy link

Paethon commented Jun 7, 2018

I think there is a different reason for this. The original google-files seem to have a slightly different format and the parser for the binary file reads one byte too far.

Removing the read(f, UInt8) # new line here solves the issue (but presumably, the files created with this package can't be loaded in this case anymore)

I solved it by including the additional loading option :google to the existing :text and :binary where this read is removed.

@Paethon
Copy link

Paethon commented Sep 18, 2018

PR #8 fixes this

@alabrashJr
Copy link

I think there is a different reason for this. The original google-files seem to have a slightly different format and the parser for the binary file reads one byte too far.

Removing the read(f, UInt8) # new line here solves the issue (but presumably, the files created with this package can't be loaded in this case anymore)

I solved it by including the additional loading option :google to the existing :text and :binary where this read is removed.

would you please write the code of what you are saying I got confused honestly ,

@alabrashJr
Copy link

so I did the implementation by my self, and I sharing it with you,

https://gist.github.com/alabrashJr/d71cf74bc9713bb0a5bb12ccd331a405

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