Skip to main content

Opens a Gio.File as a Python file object

Project description

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 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.


pip install giofile


import mutagen
import giofile
from gi.repository import Gio

gio_file = Gio.File.new_for_uri(

cancellable =
with, "rb", cancellable=cancellable) as gfile:
$ python
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
copyright=Copyright 2005 Ehren Starks

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
giofile-0.2.0.tar.gz (5.2 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page