Skip to main content

giofile

Opens a Gio.File as a Python file object

def open(file, mode="r", buffering=-1, encoding=None, errors=None,
         newline=None, cancellable=None):
    """
    Like io.open() but takes a Gio.File instead of a filename.

    The only modes supported are r/rw/rb/r+b
    Takes a cancellable kwarg for passing a Gio.Cancellable().
    Cancelling it will abort any ongoing blocking operation.

    Returns a io.IOBase instance.
    """
https://travis-ci.org/lazka/giofile.svg?branch=master

Installation

pip install giofile

Example

import mutagen
import giofile
from gi.repository import Gio

gio_file = Gio.File.new_for_uri(
    "http://people.xiph.org/~giles/2012/opus/ehren-paper_lights-96.opus")

cancellable = Gio.Cancellable.new()
with giofile.open(gio_file, "rb", cancellable=cancellable) as gfile:
    print(mutagen.File(gfile).pprint())
$ python example.py
Ogg Opus, 228.11 seconds (audio/ogg)
ENCODER=opusenc from opus-tools 0.1.5
artist=Ehren Starks
title=Paper Lights
album=Lines Build Walls
date=2005-09-05
copyright=Copyright 2005 Ehren Starks
license=http://creativecommons.org/licenses/by-nc-sa/1.0/
organization=magnatune.com

Metadata

Release files for giofile 0.2.0

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

Source distribution (sdist)

Source distribution for giofile 0.2.0
File Size Uploaded Provenance Actions
giofile-0.2.0.tar.gz 5.2 kB Without provenance Details for giofile-0.2.0.tar.gz

Release files / giofile-0.2.0.tar.gz

Download URL giofile-0.2.0.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2e00d57cb3f81a1fd97bca7b6f1696cdc6ec5a409276aea7c27283c4e3e34b77
BLAKE2b-256 checksum
How to use checksums
88d034dbabf17c9d697578db890acddb7cdf0e76a2591e96462efb179171a3c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for giofile 0.2.0

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.2.0 This release

1 release file No provenance

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