A python CFFI wrapper for LibreOfficeKit. Tested in cpython2, cpython3, and pypy.
Requirements
An installation of LibreOffice >= 4.3.0 is required on the same machine.
If you are using cpython you need libffi-dev in order to compile CFFI.
Installation
pip install pylokit
Examples
A basic conversion from a rtf file to a doc:
from pylokit import Office
import os
lo_path = "/path/to/libreoffice/program/dir"
with Office(lo_path) as lo:
with lo.documentLoad("myfile.rtf") as doc:
doc.saveAs("myfile.doc")
os._exit(0)
Same conversion passing an explicit format and filter options:
from pylokit import Office
import os
lo_path = "/path/to/libreoffice/program/dir"
with Office(lo_path) as lo:
with lo.documentLoad("myfile.rtf") as doc:
doc.saveAs("myfile.doc", fmt="docx", options="skipImages")
os._exit(0)
The usage of a context manager is needed to properly handle LibreOfficeKit file locking. The use of _exit() instead of default exit() is required because in some circumstances LibreOffice segfaults on process exit.
Acknowledgements
Project inspired by Olly Betts’ lloconv.
Metadata
Release files for pylokit 0.8.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pylokit-0.8.1.tar.gz | 11.1 kB | Without provenance | Details for pylokit-0.8.1.tar.gz |
Release files / pylokit-0.8.1.tar.gz
| Download URL | pylokit-0.8.1.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
11346e35cfaf661bf2865a2c0e02f12fd5fbfd07e2b1bff7e7ccbff32e749379
|
|
BLAKE2b-256 checksum How to use checksums |
a205b0e1db3fc82d9dd4fa7701adde4b8ba83b71a72a01668b168b98ab5e7ad4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pylokit 0.8.1
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.