Lattyware / unrpa

A program to extract files from the RPA archive format.
http://www.lattyware.co.uk/projects/unrpa/
GNU General Public License v3.0
589 stars 74 forks source link

Recieve error "TypeError: must be str, not bytes." #11

Closed JeffreyARussell closed 6 years ago

JeffreyARussell commented 6 years ago

Using Python 3.6.5, unrpa 1.5.2, and Windows 10. When running unrpa with a specific archive, I get the following error: "TypeError: must be str, not bytes." Using the --continue-on-error flag resulted in nothing being retrieved from the archive besides an empty folder. Full traceback is below. Thanks for the help.

Traceback (most recent call last): File "unrpa", line 61, in extract_files raw_file = self.extract_file(path, data, file_number, total_files) File "unrpa", line 85, in extract_file raw_file = start + f.read(dlen - len(start)) TypeError: must be str, not bytes:

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "unrpa", line 187, in extractor.extract_files() File "unrpa", line 72, in extract_files "use the --continue-on-error flag.") from e Exception: There was an error while trying to extract a file. See the nested exception for more. If you wish to try and extract as much from the archive as possible, please use the --continue-on-error flag.

Lattyware commented 6 years ago

My first guess would be to try a quick change to line 142:

        return [(offset ^ key, dlen ^ key, b"") for offset, dlen in entry]

To make the third item an empty byte string rather than an empty string (adding the b being the only change). I can't reproduce this issue with any of the test archives I have, so I can't say if this will solve the issue - but it looks likely to me to be the bug.

Please let me know if that solves the issue so I can fix that up officially and create a new version, if it doesn't, is it possible to share (privately if copyright is an issue) an example archive that I can reproduce this issue with? That would speed up testing on this.

JeffreyARussell commented 6 years ago

This worked; I was able to open the archive successfully. If you want I can still send it to you for testing. Thank you!

Lattyware commented 6 years ago

Yeah, if you could drop it to me at gareth@lattyware.co.uk - it'd be useful to have a test case.

I'll push that fix through and get a new version out, in any case.