Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

On-demand system call tracing for Python programs.

Project Description

Ptracer is a library providing on-demand system call tracing in Python programs.

Basic Usage

import traceback
import ptracer

def callback(syscall):
    print('{}({}) -> {}'.format(,
        ', '.join(repr(arg.value) for arg in syscall.args),
    print('Traceback: ')

with ptracer.context(callback):
    open('/dev/null', 'wb')


Ptracer allows elaborate syscall filtering via the filter argument:

flt = [
            lambda arg: arg.value & os.O_WRONLY
        result=lambda res: res.value > 0

with ptracer.context(callback, filter=flt):
    # traced code

In the above example, ptracer will invoke the callback only for successful attempts to open files in the “/tmp” directory for writing.


The documentation is available on

Release History

This version
History Node


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
(28.6 kB) Copy SHA256 Hash SHA256
Source None Nov 17, 2017

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers