#1
16th Sep 2014 at 3:44 PM
Last edited by justJones : 6th May 2018 at
11:24 PM.
Posts: 155
Thanks: 7897 in 135 Posts
10 Achievements
How to decompile PYOs from mods and Sims 4 core content
I've had a few people ask me for the source code of my mods, and I figured it's time to write a little tutorial:
What you'll need:
-
Python 3.3.5
- TheHologramMan's
decompiler
- The source file (of course!)
How to decompile
- Once you've installed Python 3.3.5, put TheHologramMan's decompiler (unpyc3) into the main directory (C:\Python33 by default)
- Place the source file you'd like to decompile into your Python directory (it's easier that way)
- Open python.exe
- Type "from unpyc3 import decompile"
- Let's make a file now: f = open('blabla.py', 'w')
- Let's make a string with the decompiled source (replace "source.pyo" with the actual source file): output = str(decompile('source.pyo'))
- Now, let's write the string to the file: f.write(output)
- And now, let's close the file: f.close()
You should find the decompiled contents in your "blabla.py" file. I don't know about other mods, but this will definitely decompile any of my mods, and you're free to do this!