Field Researcher
Original Poster
#1 Old 10th Sep 2014 at 9:45 PM Last edited by justJones : 7th May 2018 at 12:10 AM.
Default Script Modding: How to Access The Sims 4 Python Files
1. Download Python 3.3.5 from here: https://www.python.org/download/releases/3.3.5

2. Install Python, and be sure to check “Add python.exe to path” when asked what specific features you want to install.

3. Download TheHologramMan’s edited version of unpyc3 from here: http://modthesims.info/showthread.p...727#post4503727 you must download the modified version, not the original, otherwise you’ll just get a bunch of errors!

4. Place unpyc3.exe in the same install directory as Python.

5. Download darkkitten30’s Python decompiler batch file. Follow the instructions on the page on how to set it up. http://modthesims.info/t/532644

6. Ensure you have the directories in the decompiler batch file set correctly, then run the program. You may get errors with some files, but if you followed the above steps properly, the majority of the files should decompile successfully. The files that don’t decompile cannot be modded, but as far as I know there’s nothing particularly interesting in them.

7. Uncompress the resulting zip files, and you’re ready to enter the world of script modding.
11 users say thanks for this. (Who?)
Advertisement
Mad Poster
#2 Old 10th Sep 2014 at 10:05 PM
Thank-you, very informative!

♥ }i{ Monarch of the Receptacle Refugees }i{ ♥
Lab Assistant
#3 Old 10th Sep 2014 at 11:46 PM
There are many links to unpyc3 in that thread - which one is the modified version? Also, in what format do I place it in the python directory? The links lead to a webpage with text on it.
Field Researcher
Original Poster
#4 Old 11th Sep 2014 at 1:22 AM
Quote: Originally posted by cwurts00
There are many links to unpyc3 in that thread - which one is the modified version? Also, in what format do I place it in the python directory? The links lead to a webpage with text on it.


This one: https://raw.githubusercontent.com/f...aster/unpyc3.py

Just place the raw .py file in the directory you install Python.
Lab Assistant
#5 Old 11th Sep 2014 at 2:19 AM
I followed the instructions above, and the three zip files appeared in C:\temp, but when these files are extracted, none of them can be read. I've tried editing them in IDLE, and I just get a blank space.
Test Subject
#6 Old 11th Sep 2014 at 4:53 AM
All these steps are already detailed in other threads, such as the one I made on the tutorials forum, which is where stuff like this belongs in the first place.
Lab Assistant
#7 Old 11th Sep 2014 at 6:17 AM
I now realize that the decompiled files are available on another thread, anyway.
Test Subject
#8 Old 15th Sep 2014 at 12:57 AM
Quote: Originally posted by Zerbu
1. Download Python 3.3.5 from here: https://www.python.org/download/releases/3.3.5

2. Install Python, and be sure to check “Add python.exe to path” when asked what specific features you want to install.

3. Download TheHologramMan’s edited version of unpyc3 from here: http://modthesims.info/showthread.p...727#post4503727 you must download the modified version, not the original, otherwise you’ll just get a bunch of errors!

4. Place unpyc3.exe in the same install directory as Python.

5. Download darkkitten30’s Python decompiler batch file. Follow the instructions on the page on how to set it up. http://modthesims.info/t/532644

6. Ensure you have the directories in the decompiler batch file set correctly, then run the program. You may get errors with some files, but if you followed the above steps properly, the majority of the files should decompile successfully. The files that don’t decompile cannot be modded, but as far as I know there’s nothing particularly interesting in them.

7. Uncompress the resulting zip files, and you’re ready to enter the world of script modding.




Can you tell exactly how to download his edited version of unpyc3.exe? I mean do I copy and paste it? how do i download that? it just goes to a webpage with a bunch of text
Test Subject
#9 Old 15th Sep 2014 at 12:59 AM
"""
Decompiler for Python3.3.
Decompile a module or a function using the decompile() function

>>> from unpyc3 import decompile
>>> def foo(x, y, z=3, *args):
... global g
... for i, j in zip(x, y):
... if z == i + j or args[i] == j:
... g = i, j
... return
...
>>> print(decompile(foo))

def foo(x, y, z=3, *args):
global g
for i, j in zip(x, y):
if z == i + j or args[i] == j:
g = i, j
return
>>>
"""

^Stuff like that is all I'm seeing
Pettifogging Legalist!
retired moderator
#10 Old 15th Sep 2014 at 1:15 AM
I'm moving this to Tutorials since it's really step-by-step instructions .. Zerbu, let me know if you've got objections =)

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Test Subject
#11 Old 1st Oct 2014 at 9:07 PM
Quote: Originally posted by yolanda8604
"""
Decompiler for Python3.3.
Decompile a module or a function using the decompile() function

>>> from unpyc3 import decompile
>>> def foo(x, y, z=3, *args):
... global g
... for i, j in zip(x, y):
... if z == i + j or args[i] == j:
... g = i, j
... return
...
>>> print(decompile(foo))

def foo(x, y, z=3, *args):
global g
for i, j in zip(x, y):
if z == i + j or args[i] == j:
g = i, j
return
>>>
"""

^Stuff like that is all I'm seeing


Did you ever get an answer? I have the same problem.
Test Subject
#12 Old 3rd Oct 2014 at 6:49 PM
Quote: Originally posted by breeluv
Did you ever get an answer? I have the same problem.


Guys, if you see that it means your browser is opening the file and displaying the text (like it does with HTML or text files). What you'll want to do is right-click the link to the file and select "Save as..." or "Save target as..." depending on your browser.
Test Subject
#13 Old 28th Jan 2015 at 7:49 PM
Quote: Originally posted by Zerbu
This one: https://raw.githubusercontent.com/f...aster/unpyc3.py

Just place the raw .py file in the directory you install Python.


How Can I download this? I don't get it
Pettifogging Legalist!
retired moderator
#14 Old 28th Jan 2015 at 7:56 PM
Have you tried reading the post directly above yours?

(Also, no offense, but if downloading a text file is already a challenge for you, I imagine you will find script modding a little .. unrewarding. Maybe try something more approachable first.)

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Test Subject
#15 Old 4th Mar 2015 at 5:40 PM
Just in case anyone wanted to do this for the Mac version of the game, EA used Python 2.7.9. At least that's the only version I could open without any error messages.

I'd love to delve into the Mac files but I just don't understand enough about Python to even attempt it.
Test Subject
#16 Old 10th May 2015 at 7:48 PM Last edited by federa : 10th May 2015 at 11:19 PM.
I'm experiencing this error: AttributeError: 'SuiteDecompiler' object has no attribute '<69>'
My resulted .py files all only have a single line " *** Warning: file has wrong magic number *** "

What am I doing wrong? I am using TheHologramMan’s edited version of unpyc3...

Edit: OK, it turns out to be a Python version problem... I installed the newest 3.4, which seemed not to work. Now I'm mortified; I wasted a whole morning trying to figure this out...
Test Subject
#17 Old 17th Jul 2015 at 5:27 AM
A good note to be made here is that you need to run the batch file as an administrator...
Test Subject
#18 Old 25th Mar 2017 at 10:05 PM
I'm currently taking on online course to teach myself Python, but the Python version I have installed is 2.7. What would be the best way for me to go about this?
Icy Spicy
#19 Old 28th Mar 2017 at 10:56 PM
Quote: Originally posted by bootoons
I'm currently taking on online course to teach myself Python, but the Python version I have installed is 2.7. What would be the best way for me to go about this?


I think Python 3.3 is the version being currently used for sims 4 modding (if thats what you are interested in! ). Python 2.x is legacy but 3.x is the current one in development.

Link for Python 3.3
Test Subject
#20 Old 16th Apr 2020 at 11:24 AM
Hi guys!

May thanks for the informative post. I followed the given instructions, and at the end saw lots of files being generated. However, they are all PYC files and not the Python code. I also saw the core_src, base_src, and simulation_src, but the zips are all empty, with only folders and not a single Python file :-/ In addition, this error showed up often during the process: "\tmp\key: The system cannot find the file specified".

Could somebody tell me what I did wrong, please?
Field Researcher
#21 Old 16th Apr 2020 at 3:25 PM
Quote: Originally posted by huong.le
Hi guys!

May thanks for the informative post. I followed the given instructions, and at the end saw lots of files being generated. However, they are all PYC files and not the Python code. I also saw the core_src, base_src, and simulation_src, but the zips are all empty, with only folders and not a single Python file :-/ In addition, this error showed up often during the process: "\tmp\key: The system cannot find the file specified".

Could somebody tell me what I did wrong, please?

This tutorial is really outdated. Follow this instead: http://sims4studio.com/thread/15145...ython-scripting

Creator Musings is a Sims 4 modder, poser/animator, and CC creator hangout server (though everyone is allowed) with a tutorial/resource directory, help channels, and mod/cc/sims 4 news channels!
My Discord | Twitter | Tumblr | Patreon
Test Subject
#22 Old 16th Apr 2020 at 6:49 PM
It worked!!!
Quote: Originally posted by MizoreYukii
This tutorial is really outdated. Follow this instead: http://sims4studio.com/thread/15145...ython-scripting


Oh my god thanks a lot for the link! It worked like a charm for me! <3 <3 <3
Back to top