Skip to content

Tool for editing PYC files and Python bytecode in runtime

License

Notifications You must be signed in to change notification settings

moff4/PycEditor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PycEditor

Build Status

Tool for editing .pyc files and Python bytecode in runtime.

Example:

"Some code":

def f():
    print('Hello World')

Editing this "some code"

import random
import pyceditor
pyc = pyceditor.PycFile.load_from_pycode(f.__code__)
x = random.randint(15, 10**4)
pyc.code.co_consts = (None, 'Hi! Random number: %d' % x)
eval(pyc.pycode)
# prints random number

Buy Me A Coffee

About

Tool for editing PYC files and Python bytecode in runtime

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages