PyMemoryEditor

raw JSON →
1.6.0 verified Fri May 01 auth: no python

PyMemoryEditor is a multi-platform Python library developed with ctypes for reading, writing, and searching process memory. It provides a simple and friendly API for memory manipulation, supporting Python 3.6+. The current version is 1.6.0, released with moderate cadence, targeting Windows, Linux, and macOS.

pip install pymemoryeditor
error PermissionError: [Errno 13] Permission denied
cause Insufficient privileges to open the target process.
fix
Run the Python script as administrator (Windows) or with sudo (Linux/macOS).
error ProcessLookupError: [Errno 3] No such process
cause The specified process name or PID does not exist.
fix
Verify the process is running and the name is exact (case-sensitive on Linux). Use tasklist (Windows) or ps (Linux) to list processes.
error OSError: exception: access violation writing 0x...
cause Attempting to write to an invalid or protected memory address.
fix
Ensure the address is valid and writable. Use a memory scanner to confirm the address belongs to the target process.
gotcha Permissions: Opening a process may require administrator/root privileges, especially for system processes. Without proper permissions, OpenProcess may fail silently or raise an exception.
fix Run your script as administrator (Windows) or with sudo (Linux/macOS).
deprecated Python 3.6 support: As of version 1.6.0, Python 3.6 is still supported but may be dropped in future releases. Users on older Python versions should upgrade.
fix Upgrade to Python 3.7 or later.
gotcha Memory address architecture: Use 64-bit addresses (e.g., 0x7FFFFFFFFFFFFFFF) on 64-bit processes. Using 32-bit addresses may lead to AccessViolation.
fix Ensure your address size matches the target process bitness.
gotcha Platform-specific: The library uses ctypes and platform-specific APIs (e.g., Windows kernel32, Linux ptrace). Some features may not work identically across all platforms.
fix Test on your target platform. For Linux, ensure ptrace is enabled (e.g., ptrace_scope=0).

Open a process by name and read/write memory.

from pymemoryeditor import OpenProcess

# Attach to a process by name (e.g., 'notepad.exe')
with OpenProcess(process_name='notepad.exe') as proc:
    # Read an integer at a specific address
    address = 0x7FF... # Replace with actual address
    value = proc.read_int(address)
    print(f"Read value: {value}")
    # Write a new value
    proc.write_int(address, 42)
    print("Written 42 to address")