Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Quick Reply
Search this Thread
Test Subject
Original Poster
#1 Old 23rd Mar 2017 at 2:42 PM
Issue with PYO, causes memory leak and crash
My first post here, hi!

I'm trying to get into script modding, the first thing I normally do to learn is to find an existing mod de-compile it, check out how it works then re-compile it to prove the tool-chain I have works fully with a real example, hello world is often not representative of how you really do things.

I'm using Python 3.3.5 as prescribed and compiling as explained using python -O -m [FILE.PY], then taking the output from __pyCache__ renaming to match the original, then adding it back over the original in the ts4script archive.

I'm seeing 3 separate areas of strangeness:
  1. When comparing the original PYO to the compiled PYO they are different, not completely but out by at least a couple 100 bytes, even though as far as I know they are both compiled using Python 3.3.5, the preamble of the file also seems different.
  2. When the file is loaded in game (immediately if I compile a constructor file __init__.py) it starts rapidly consuming memory until it runs out of ram (16GB) and then crashes the game.
  3. This might be unrelated, but I'm confused about the file paths in the PYO files, obviously the paths in the original file are not going to match as I'm compiling on my system, does this even matter? As far as I can tell the original paths don't match any folder structure on disk, perhaps a virtual file path structure for mods that I'm not following?

Any help or insight would be greatly appreciated, I have attempted to research the problem on my own for the last couple of days with no luck. It's the worst kind of bugs, the one with no error message!
Advertisement
Test Subject
Original Poster
#2 Old 1st Apr 2017 at 11:13 AM
After no replies and lots more tries with no success I'm putting this down to imperfections in the de-compiled code causing some kind of cycle in the game engine on load.

Just in case anyone is interested....
Lab Assistant
#3 Old 1st Apr 2017 at 7:18 PM
It does sound like you may be getting incomplete files from decompiling. Some modders include both the compiled version of the file and the uncompiled version. You might check some of those out and see if you run into the same issue. Here's a list someone made of modders who include the .py files: http://modthesims.info/showthread.p...168#post5138168

♫ Improvising into a corner ♫
♫ No rhyme or rhythm in this verse cause I'm in a corner ♫
Back to top