Skip to main content

python-unrar

Work with RAR archive files through unrar library using ctypes.

Build Status

Install UnRAR library

python-unrar requires UnRAR library. You can download UnRAR library sources 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

(latest tested sources: http://www.rarlab.com/rar/unrarsrc-5.2.6.tar.gz)

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 UNRAR_LIB_PATH variable in your environment to the library path and python-unrar will try to load the UnRAR library from there.

Testing without installing

You can build from source with:

$ python setup.py build

And then run a Python shell with unrar available:

$ PYTHONPATH=`pwd`/build/lib python

Or you could also directly add the unrar directory from this repo to your PYTHONPATH. In any case you will still need to make the unrar library available as mentioned above.

Install python-unrar

To install python-unrar:

$ pip install unrar

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.extractall()
>>> rar.read('test_file.txt')
'This is for test.'

Docs

Check full documentation in http://python-unrar.readthedocs.org.

Metadata

Release files for unrar 0.4

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.4
File Size Uploaded
unrar-0.4.tar.gz 36.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for unrar 0.4
File Interpreter ABI Platform
unrar-0.4-py3-none-any.whl Python 3 none any Details

Total release size: 62.0 kB

Release files / unrar-0.4.tar.gz

Download URL unrar-0.4.tar.gz
Size 36.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b24447a5b93024be600ef8255668ba23a30f451176577b691559ea1359f7d164
BLAKE2b-256 checksum
How to use checksums
ead6b53a4216d73a10602f524cf728c3c272b2e1f524b62f46589303225564c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.3

Release files / unrar-0.4-py3-none-any.whl

Download URL unrar-0.4-py3-none-any.whl
Size 25.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0ce03e28bfa90415ee1a92c8d38cad8ea244427a59a8a39c0d42bac8727cfaa0
BLAKE2b-256 checksum
How to use checksums
bb0b53130ccd483e3db8c8a460cb579bdb21b458d5494d67a261e1a5b273fbb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.4 This release

2 release files

0.3

1 release file

0.2

0.1

2 release files

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