Tool Ren'Py UnRen for MacOS and Linux v0.8.2

5.00 star(s) 1 Vote

dikau

Member
Dec 16, 2019
315
271
Any one have any experience with this error? I've been getting it a lot lately, but only on certain games. If someone could point me in the right direction of what I'm doing wrong, I'd appreciate it! Thanks!


Code:
Please select > 1
  > Could not find platform independent libraries <prefix>
  > Python path configuration:
  >   PYTHONHOME = (not set)
  >   PYTHONPATH = (not set)
  >   program name = '/Users/jscolli2/Documents/Microsoft User Data/AutoRecovery/Games/SunshineLoveCH1 2.app/Contents/MacOS/python'
  >   isolated = 0
  >   environment = 1
  >   user site = 1
  >   import site = 1
  >   sys._base_executable = '/Users/jscolli2/Documents/Microsoft User Data/AutoRecovery/Games/SunshineLoveCH1 2.app/Contents/MacOS/python'
  >   sys.base_prefix = '/home/tom/ab/renpy-build/tmp/install.mac-arm64'
  >   sys.base_exec_prefix = '/home/tom/ab/renpy-build/tmp/install.mac-arm64'
  >   sys.platlibdir = 'lib'
  >   sys.executable = '/Users/jscolli2/Documents/Microsoft User Data/AutoRecovery/Games/SunshineLoveCH1 2.app/Contents/MacOS/python'
  >   sys.prefix = '/home/tom/ab/renpy-build/tmp/install.mac-arm64'
  >   sys.exec_prefix = '/home/tom/ab/renpy-build/tmp/install.mac-arm64'
  >   sys.path = [
  >     '/home/tom/ab/renpy-build/tmp/install.mac-arm64/lib/python39.zip',
  >     '/home/tom/ab/renpy-build/tmp/install.mac-arm64/lib/python3.9',
  >     '/home/tom/ab/renpy-build/tmp/install.mac-arm64/lib/lib-dynload',
  >   ]
  > Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
  > Python runtime state: core initialized
  > ModuleNotFoundError: No module named 'encodings'
  >
  > Current thread 0x00000001ec605b40 (most recent call first):
  > <no Python frame>
Please select > 1
  > Could not find platform independent libraries <prefix>
  > Python path configuration:
  >   PYTHONHOME = (not set)
  >   PYTHONPATH = (not set)
  >   program name = '/Users/jscolli2/Documents/Microsoft User Data/AutoRecovery/Games/SunshineLoveCH1 2.app/Contents/MacOS/python'
  >   isolated = 0
  >   environment = 1
  >   user site = 1
  >   import site = 1
  >   sys._base_executable = '/Users/jscolli2/Documents/Microsoft User Data/AutoRecovery/Games/SunshineLoveCH1 2.app/Contents/MacOS/python'
  >   sys.base_prefix = '/home/tom/ab/renpy-build/tmp/install.mac-arm64'
  >   sys.base_exec_prefix = '/home/tom/ab/renpy-build/tmp/install.mac-arm64'
  >   sys.platlibdir = 'lib'
  >   sys.executable = '/Users/jscolli2/Documents/Microsoft User Data/AutoRecovery/Games/SunshineLoveCH1 2.app/Contents/MacOS/python'
  >   sys.prefix = '/home/tom/ab/renpy-build/tmp/install.mac-arm64'
  >   sys.exec_prefix = '/home/tom/ab/renpy-build/tmp/install.mac-arm64'
  >   sys.path = [
  >     '/home/tom/ab/renpy-build/tmp/install.mac-arm64/lib/python39.zip',
  >     '/home/tom/ab/renpy-build/tmp/install.mac-arm64/lib/python3.9',
  >     '/home/tom/ab/renpy-build/tmp/install.mac-arm64/lib/lib-dynload',
  >   ]
  > Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
  > Python runtime state: core initialized
  > ModuleNotFoundError: No module named 'encodings'
  >
  > Current thread 0x00000001ec605b40 (most recent call first):
  > <no Python frame>
Curious, because I tested that game and every RPA uncompressed successfully.

Please make sure you use the latest version.
If you use the latest version, the reason that I can think that error can happen is if you use another Renpy(game) app and just copy all the content to it, If you did that, please make sure you use the same Renpy Version from the developer released version. Or maybe if you use the compressed version, maybe, the compressor did that.

EDIT:
Just for context, the game Sunshine Love chapter 1 is still using Renpy 7.4.6 that still using python 2... and your error is outputing the UnRen script running in python 3 context.
 
Last edited:

Madeddy

Active Member
Dec 17, 2017
809
463
Curious, because I tested that game
I overlooked the game name in all this lines up there, eve if i looked at the line in question.

... the game Sunshine Love chapter 1 is still using Renpy 7.4.6 that still using python 2... and your error is outputing the UnRen script running in python 3 context.
Lol. No wonder and this explains it. The script does somehow not register its a python2 game and searches for a .../python3/encodings dir, which he cannot find if there is no py3 at all. :cool:
Does still not explain why it looks like a mac app on a windows system... o_O
 

toobad0912

Newbie
May 1, 2021
80
30
I overlooked the game name in all this lines up there, eve if i looked at the line in question.

Lol. No wonder and this explains it. The script does somehow not register its a python2 game and searches for a .../python3/encodings dir, which he cannot find if there is no py3 at all. :cool:
Does still not explain why it looks like a mac app on a windows system... o_O

Haha, it's a Mac running OS 13.3.1. A long time ago, I accidentally downloaded a game to one of the folders for my Microsoft Office software. And it just stuck! It's a nice out of the way place to keep stuff, but I can see how it would cause that confusion.

Thanks for the help on the Python version stuff. I will see if I can downgrade to Python2. Appreciate you both!
 

Madeddy

Active Member
Dec 17, 2017
809
463
Appreciate you both!
No problemo!

I will see if I can downgrade to Python2.
Ah, no. You misunderstand. This will do nothing for you.
Unren uses the modified python version in the game dir, which comes with the games renpy. Your error is from something else. Maybe dikau has more ideas for your case. I dont know mac stuff etc., just linux and win. Good luck!
 
  • Like
Reactions: toobad0912

inflact

New Member
Feb 21, 2023
1
0
I have renamed the file to "unren" and move it alongside its tools folder to /usr/bin. Works perfectly on Ubuntu. Thanks for sharing !
That's not what you're supposed to do and might give you some issues with system updates.

Correctly you would do it like this:
Bash:
sudo cp -R UnRen\ v0.8.2/ /usr/local/src/
cd /usr/loca/bin
sudo ln -s ../src/UnRen\ v0.8.2/UnRen.sh UnRen
Edit:

F me should've looked through the thread before making the changes.

But while trying this i noticed that the tool doesn't correctly resolve path if symlinked.

I fixed it and also updated all the dependencies. This might not work on MacOS though as I don't really know the quirks of that OS). Anyway's feel free to grab the attachment.
 
Last edited:

toobad0912

Newbie
May 1, 2021
80
30
No problemo!

Ah, no. You misunderstand. This will do nothing for you.
Unren uses the modified python version in the game dir, which comes with the games renpy. Your error is from something else. Maybe dikau has more ideas for your case. I dont know mac stuff etc., just linux and win. Good luck!
I don't suppose anyone as stumbled on the fix for this issue. It doesn't happen with every game... but it happens more often than not.
 
Last edited:

Rixity

New Member
Aug 24, 2020
8
0
I'm using dikau UnRen for Mac but every time it tries to decompiles the rpyc files it ends up failing and giving the error code:
Code:
Output file already exists. Pass --clobber to overwrite.
When I check my game folder I will have all the rpy files and images but they will also be corrupted with text like: \ü[£åñ|

Any fix for this?
 

dikau

Member
Dec 16, 2019
315
271
I'm using dikau UnRen for Mac but every time it tries to decompiles the rpyc files it ends up failing and giving the error code:
Code:
Output file already exists. Pass --clobber to overwrite.
When I check my game folder I will have all the rpy files and images but they will also be corrupted with text like: \ü[£åñ|

Any fix for this?
I was against adding an option to overwrite existing RPY files because there's a chance it will messes the game, e.g. developer just updated his scripts and just add single RPY files for quick updates (though if I think about it now, it will be very slim)... etc.

So, anyway, I updated the script to add option to overwrite existing RPY files using --clobber parameter (option 0). Just make sure you have a backup when doing this. I also found a little bug on the script because of this problem, and it fixed now... thanks.
 
Last edited:
  • Like
Reactions: Rixity

Rixity

New Member
Aug 24, 2020
8
0
I was against adding an option to overwrite existing RPY files because there's a chance it will messes the game, e.g. developer just updated his scripts and just add single RPY files for quick updates (though if I think about it now, it will be very slim)... etc.

So, anyway, I updated the script to add option to overwrite existing RPY files using --clobber parameter (option 0). Just make sure you have a backup when doing this. I also found a little bug on the script because of this problem, and it fixed now... thanks.
I get another issue now. After selecting option 9, then option 0 I get the error:
Code:
Decompiling ./animations.rpyc to ./animations.rpy...
Error while decompiling ./animations.rpyc:
Traceback (most recent call last):
  File "/Users/user/Downloads/game.app/Contents/Resources/autorun/unrpyc.py", line 266, in worker
    tag_outside_block=args.tag_outside_block, init_offset=args.init_offset, try_harder=args.try_harder)
  File "/Users/user/Downloads/game.app/Contents/Resources/autorun/unrpyc.py", line 225, in decompile_rpyc
    ast = read_ast_from_file(in_file)
  File "/Users/user/Downloads/game.app/Contents/Resources/autorun/unrpyc.py", line 172, in read_ast_from_file
    if slot != 1:
UnboundLocalError: local variable 'slot' referenced before assignment
This is an example of one of them and the error shows up for every other file in terminal.
The .rpy files also are still corrupted with text like: \ü[£åñ|
Any solutions?
 

dikau

Member
Dec 16, 2019
315
271
I get another issue now. After selecting option 9, then option 0 I get the error:
Code:
Decompiling ./animations.rpyc to ./animations.rpy...
Error while decompiling ./animations.rpyc:
Traceback (most recent call last):
  File "/Users/user/Downloads/game.app/Contents/Resources/autorun/unrpyc.py", line 266, in worker
    tag_outside_block=args.tag_outside_block, init_offset=args.init_offset, try_harder=args.try_harder)
  File "/Users/user/Downloads/game.app/Contents/Resources/autorun/unrpyc.py", line 225, in decompile_rpyc
    ast = read_ast_from_file(in_file)
  File "/Users/user/Downloads/game.app/Contents/Resources/autorun/unrpyc.py", line 172, in read_ast_from_file
    if slot != 1:
UnboundLocalError: local variable 'slot' referenced before assignment
This is an example of one of them and the error shows up for every other file in terminal.
The .rpy files also are still corrupted with text like: \ü[£åñ|
Any solutions?
I may need to know the game name, as you may know, my script purely uses VepsrP's modified unrpyc, although I haven't updated to his latest version, because there's no report for any problem yet... So I need the game name, and maybe I can check if the latest version can handle the problem or not.
 

Rixity

New Member
Aug 24, 2020
8
0
I may need to know the game name, as you may know, my script purely uses VepsrP's modified unrpyc, although I haven't updated to his latest version, because there's no report for any problem yet... So I need the game name, and maybe I can check if the latest version can handle the problem or not.
I've been trying it on this game and when I used VepsrP's unrpyc, it was able to successfully decompile it.
 

toobad0912

Newbie
May 1, 2021
80
30
Updated my fork of UnRen to v0.17.0
You don't have permission to view the spoiler content. Log in or register now.
Unfortunately, this update hasn't fixed the issue I keep having.

Python:
 > Could not find platform independent libraries <prefix>
  > Python path configuration:
  >   PYTHONHOME = (not set)
  >   PYTHONPATH = (not set)
  >   program name = '/Users/xxxxxxxxx/Documents/Games/ActingLessons.app/Contents/MacOS/python'
  >   isolated = 0
  >   environment = 1
  >   user site = 1
  >   import site = 1
  >   sys._base_executable = '/Users/xxxxxxxxx/Documents/Games/ActingLessons.app/Contents/MacOS/python''
  >   sys.base_prefix = '/home/tom/ab/renpy-build/tmp/install.mac-arm64'
  >   sys.base_exec_prefix = '/home/tom/ab/renpy-build/tmp/install.mac-arm64'
  >   sys.platlibdir = 'lib'
  >   sys.executable = '/Users/xxxxxxxxx/Documents/Games/ActingLessons.app/Contents/MacOS/python'
  >   sys.prefix = '/home/tom/ab/renpy-build/tmp/install.mac-arm64'
  >   sys.exec_prefix = '/home/tom/ab/renpy-build/tmp/install.mac-arm64'
  >   sys.path = [
  >     '/home/tom/ab/renpy-build/tmp/install.mac-arm64/lib/python39.zip',
  >     '/home/tom/ab/renpy-build/tmp/install.mac-arm64/lib/python3.9',
  >     '/home/tom/ab/renpy-build/tmp/install.mac-arm64/lib/lib-dynload',
  >   ]
  > Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
  > Python runtime state: core initialized
  > ModuleNotFoundError: No module named 'encodings'
  >
  > Current thread 0x00000001ff779e00 (most recent call first):
  > <no Python frame>
Done!
Any thoughts or ideas? dikau ? Or anyone else of course? I hate to keep bothering them with this, but it's seriously a roll of the dice each time I go to use Unren on a game. Will it work? Or will I get this error? Let's spin the wheel to find out! :)
 

dikau

Member
Dec 16, 2019
315
271
Unfortunately, this update hasn't fixed the issue I keep having.

Python:
 > Could not find platform independent libraries <prefix>
  > Python path configuration:
  >   PYTHONHOME = (not set)
  >   PYTHONPATH = (not set)
  >   program name = '/Users/xxxxxxxxx/Documents/Games/ActingLessons.app/Contents/MacOS/python'
  >   isolated = 0
  >   environment = 1
  >   user site = 1
  >   import site = 1
  >   sys._base_executable = '/Users/xxxxxxxxx/Documents/Games/ActingLessons.app/Contents/MacOS/python''
  >   sys.base_prefix = '/home/tom/ab/renpy-build/tmp/install.mac-arm64'
  >   sys.base_exec_prefix = '/home/tom/ab/renpy-build/tmp/install.mac-arm64'
  >   sys.platlibdir = 'lib'
  >   sys.executable = '/Users/xxxxxxxxx/Documents/Games/ActingLessons.app/Contents/MacOS/python'
  >   sys.prefix = '/home/tom/ab/renpy-build/tmp/install.mac-arm64'
  >   sys.exec_prefix = '/home/tom/ab/renpy-build/tmp/install.mac-arm64'
  >   sys.path = [
  >     '/home/tom/ab/renpy-build/tmp/install.mac-arm64/lib/python39.zip',
  >     '/home/tom/ab/renpy-build/tmp/install.mac-arm64/lib/python3.9',
  >     '/home/tom/ab/renpy-build/tmp/install.mac-arm64/lib/lib-dynload',
  >   ]
  > Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
  > Python runtime state: core initialized
  > ModuleNotFoundError: No module named 'encodings'
  >
  > Current thread 0x00000001ff779e00 (most recent call first):
  > <no Python frame>
Done!
Any thoughts or ideas? dikau ? Or anyone else of course? I hate to keep bothering them with this, but it's seriously a roll of the dice each time I go to use Unren on a game. Will it work? Or will I get this error? Let's spin the wheel to find out! :)
That error can only happened if it's running on python 3 (it tries to find encoding module) which it shouldn't possible because that game, "Acting Lessons", still using python 2 from renpy v7.3.0.

see this line:
> program name = '/Users/xxxxxxxxx/Documents/Games/ActingLessons.app/Contents/MacOS/python'
for old renpy games, python executable can't be in this folder.

I don't know how you managed to do that. I can only "guess" that you rebuild the game using newest Renpy-SDK (which uses python 3) for old games.
 
Last edited:

toobad0912

Newbie
May 1, 2021
80
30
That error can only happened if it's running on python 3 (it tries to find encoding module) which it shouldn't possible because that game, "Acting Lessons", still using python 2 from renpy v7.3.0.

see this line:

for old renpy games, python executable can't be in this folder.

I don't know how you managed to do that. I can only "guess" that you rebuild the game using newest Renpy-SDK (which uses python 3) for old games.
Yea, I did build a new distro using the SDK, but only because I couldn't get Unren to work on the clean version. With a fresh version of the game, I get this:

Python:
Please select > 1
  > Could not find platform independent libraries <prefix>
  > ImportError: No module named site
Done!
Press any key to back to main menu, or (q) to quit UnRen >
Sorry that I didn't make that clear! My bad.
 

dikau

Member
Dec 16, 2019
315
271
Yea, I did build a new distro using the SDK, but only because I couldn't get Unren to work on the clean version.

Python:
Please select > 1
  > Could not find platform independent libraries <prefix>
  > ImportError: No module named site
Done!
Press any key to back to main menu, or (q) to quit UnRen >
Sorry that I didn't make that clear! My bad.
Yeah that doesn't make sense. If you really use the clean version than that error won't come up. It's either you did something you're not supposed to or your macOS system have an abnormal shell (unknown Bash, perhaps?).

My fork of UnRen is using modified unrpyc and rpatool that utilize python that shipped within the game and it won't work otherwise.

So my suggestion, if you wanted to use my fork and if you really rebuilding with the SDK, is use the correct SDK version that the same as the game's Renpy version. You can always check what renpy version the developer use by checking script_version.txt and download the SDK version accordingly from this link:
 

toobad0912

Newbie
May 1, 2021
80
30
Yeah that doesn't make sense. If you really use the clean version than that error won't come up. It's either you did something you're not supposed to or your macOS system have an abnormal shell (unknown Bash, perhaps?).

My fork of UnRen is using modified unrpyc and rpatool that utilize python that shipped within the game and it won't work otherwise.

So my suggestion, if you wanted to use my fork and if you really rebuilding with the SDK, is use the correct SDK version that the same as the game's Renpy version. You can always check what renpy version the developer use by checking script_version.txt and download the SDK version accordingly from this link:
Yea, I think you're right. I think I screwed up my default Python that shipped with MacOS while trying to troubleshoot beyond my skills. I usually just use the SDK to create Mac distributions of PC-only games. But now I think I've got all my everything all sorts of mixed up.

Gotta figure out to just get a clean slate and build back from there. Here we go!
 

dikau

Member
Dec 16, 2019
315
271
Yea, I think you're right. I think I screwed up my default Python that shipped with MacOS while trying to troubleshoot beyond my skills. I usually just use the SDK to create Mac distributions of PC-only games. But now I think I've got all my everything all sorts of mixed up.

Gotta figure out to just get a clean slate and build back from there. Here we go!
I'm going to blame my lack of English here, but please try to understand again:

Every Ren'Py game contains its own Python interpreter, which is not the same as the default Python you install from the Python website (or that comes shipped with macOS). In other words, Tom, the creator of the Ren'Py Engine, has his "own version" of Python specifically for Ren'Py.

Furthermore, my script utilizes the Python version that is shipped with the game, and it will not work if you use the default Python.

Therefore, it has nothing to do with your local Python that comes with macOS.
 
Last edited:

toobad0912

Newbie
May 1, 2021
80
30
I'm going to blame my lack of English here, but please try to understand again:

Every Ren'Py game contains its own Python interpreter, which is not the same as the default Python you install from the Python website (or that comes shipped with macOS). In other words, Tom, the creator of the Ren'Py Engine, has his "own version" of Python specifically for Ren'Py.

Furthermore, my script utilizes the Python version that is shipped with the game, and it will not work if you use the default Python.

Therefore, it has nothing to do with your local Python that comes with macOS.
Totally my bad, I just misread your post. For some reason I read "shipped with the game" as "shipped with MacOS." No idea why. I'm just dumb like that sometimes.

However, I have discovered something strange. Where you save a game matters a lot more than I previously thought. When I ran Unren on u4ia today I got this error
Python:
 > Could not find platform independent libraries <prefix>
  > Python path configuration:
  >   PYTHONHOME = (not set)
  >   PYTHONPATH = (not set)
  >   program name = '/Users/xxxxxxx/Games/u4ia.app/Contents/MacOS/python'
  >   isolated = 0
  >   environment = 1
  >   user site = 1
  >   import site = 1
  >   sys._base_executable = '/Users/xxxxxxx/Games/u4ia.app/Contents/MacOS/python'
  >   sys.base_prefix = '/home/tom/ab/renpy-build/tmp/install.mac-arm64'
  >   sys.base_exec_prefix = '/home/tom/ab/renpy-build/tmp/install.mac-arm64'
  >   sys.platlibdir = 'lib'
  >   sys.executable = '/Users/xxxxxxx/Games/u4ia.app/Contents/MacOS/python'
  >   sys.prefix = '/home/tom/ab/renpy-build/tmp/install.mac-arm64'
  >   sys.exec_prefix = '/home/tom/ab/renpy-build/tmp/install.mac-arm64'
  >   sys.path = [
  >     '/home/tom/ab/renpy-build/tmp/install.mac-arm64/lib/python39.zip',
  >     '/home/tom/ab/renpy-build/tmp/install.mac-arm64/lib/python3.9',
  >     '/home/tom/ab/renpy-build/tmp/install.mac-arm64/lib/lib-dynload',
  >   ]
  > Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
  > Python runtime state: core initialized
  > ModuleNotFoundError: No module named 'encodings'
  >
  > Current thread 0x00000001f4275e00 (most recent call first):
  > <no Python frame>
However, based on some discussion in this thread for 0x52's Universal Renpy Mod, I tried moving the game to my desktop and then trying Unren. It worked like a charm. Weird.
 
Last edited:
5.00 star(s) 1 Vote