Skip to main content

Work with RAR archive files through unrar library using ctypes.

Documentation: http://python-unrar.readthedocs.org

Install UnRAR library

You can download UnRAR library sources (and/or binaries) from:

http://www.rarlab.com/rar_add.htm

and compile (you may need to rename the makefile that you want to use according to your OS) and install it from there:

$ make lib

$ make install-lib

For Windows you can also download the already compiled library (http://www.rarlab.com/rar/UnRARDLL.exe).

If you prefer not to install the library, you should make it “findable” by adding the library file to a directory where libraries are searched (or change required environment variable).

As an alternative, you can also set an UNRAR_LIB_PATH variable in your environment pointing to the library path and python-unrar will try to load the UnRAR library from there.

Install python-unrar

To install python-unrar:

$ pip install unrar

Changes

v0.3
  • Added open/read methods to RarFile, extracting data into memory.

  • Added support for callbacks on unrar events.

v0.2
  • Added Python 3 support and fixed some unicode issues.

Examples

>>> from unrar import rarfile
>>> rar = rarfile.RarFile('sample.rar')
>>> rar.namelist()
[u'test_file.txt']
>>> rar.printdir()
File Name                                             Modified             Size
test_file.txt                                  2013-04-14 08:20:28           17
>>> rar.testrar()
>>> info = rar.infolist()[0]
>>> info.filename
u'test_file.txt'
>>> info.file_size
17L
>>> info.date_time
(2013L, 4L, 14L, 8L, 20L, 28L)
>>> rar.read('test_file.txt')
'This is for test.'
>>> rar.extractall()

Metadata

Release files for unrar 0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for unrar 0.3
File Size Uploaded Provenance Actions
unrar-0.3.tar.gz 33.9 kB Without provenance Details for unrar-0.3.tar.gz

Release files / unrar-0.3.tar.gz

Download URL unrar-0.3.tar.gz
Size 33.9 kB
Tags Source
SHA-256 checksum
How to use checksums
867ef0bd196c54daadf480adae7942dda8d3d95a8e440c9c43cc509af36d950d
BLAKE2b-256 checksum
How to use checksums
bccb2e9dcc0632ea96c3618b47d30ec1d8bcb55e0f45137690c9f2dae4ece762
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for unrar 0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3 This release

1 release file No provenance

0.2

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page