Page 1 of 1

[Solved] File not found update.pem

Posted: Mon Feb 12, 2024 9:15 am
by Imperf3kt
I recently updated Ren'Py to 8.2.0.25012702 and tried to build an Android version of my project (universal apk) but upon building the package, I am met with the following error

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/android.rpy", line 539, in <module>
  File "game/android.rpy", line 223, in android_build
  File "game/distribute.rpy", line 591, in __init__
  File "game/distribute.rpy", line 1700, in make_key_pem
FileNotFoundError: [Errno 2] No such file or directory: 'F:\\renpy\\GGD Mentor\\update.pem'

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "launcher/game/front_page.rpyc", line 246, in script call
  File "launcher/game/android.rpyc", line 539, in script
  File "C:\Program Files (x86)\renpy\renpy\ast.py", line 823, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\Program Files (x86)\renpy\renpy\python.py", line 1178, in py_exec_bytecode
    exec(bytecode, globals, locals)
  File "game/android.rpy", line 539, in <module>
  File "game/android.rpy", line 223, in android_build
  File "game/distribute.rpy", line 591, in __init__
  File "game/distribute.rpy", line 1700, in make_key_pem
FileNotFoundError: [Errno 2] No such file or directory: 'F:\\renpy\\GGD Mentor\\update.pem'

Windows-10-10.0.19045 AMD64
Ren'Py 8.2.0.24012702
Ren'Py Launcher 8.2.0.24012702
Tue Feb 13 00:12:42 2024
I don't know when this first started but I know it worked fine at least as recently as 8.1.3.23091805

Does anybody know what I need to do to fix this?


I just checked the Android SDK and I might need to download a new version of the JDK. I believe I am using Java 8 still and Ren'Py is telling me I should have JDK21. That might be my issue

Re: File not found update.pem

Posted: Tue Feb 13, 2024 6:16 am
by m_from_space
Imperf3kt wrote: Mon Feb 12, 2024 9:15 amI believe I am using Java 8 still and Ren'Py is telling me I should have JDK21. That might be my issue
I mean, Java 8 is from 2014. Man... :lol: How about trying that first?

Re: File not found update.pem

Posted: Tue Feb 13, 2024 10:41 pm
by Imperf3kt
m_from_space wrote: Tue Feb 13, 2024 6:16 am
Imperf3kt wrote: Mon Feb 12, 2024 9:15 amI believe I am using Java 8 still and Ren'Py is telling me I should have JDK21. That might be my issue
I mean, Java 8 is from 2014. Man... :lol: How about trying that first?
I made the thread before considering that may be the issue.
I'll update when I get a chance to try.

For what it's worth, ren'py was working fine exporting Android builds all the way up to 8.1 using JDK 8 and I believe was necessary for it to work unless I am mistaken

Re: File not found update.pem

Posted: Fri Feb 16, 2024 12:16 am
by Imperf3kt
Today I got around to installing the correct JDK. I clicked "Install SDK" and it says "It looks like you're ready to start packaging games." so I started trying to build a universal APK which appeared to work fine, at first, but it still fails with the same error.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/android.rpy", line 539, in <module>
  File "game/android.rpy", line 223, in android_build
  File "game/distribute.rpy", line 591, in __init__
  File "game/distribute.rpy", line 1700, in make_key_pem
FileNotFoundError: [Errno 2] No such file or directory: 'F:\\renpy\\GGD Mentor\\update.pem'

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "launcher/game/front_page.rpyc", line 246, in script call
  File "launcher/game/android.rpyc", line 539, in script
  File "C:\Program Files (x86)\renpy\renpy\ast.py", line 823, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\Program Files (x86)\renpy\renpy\python.py", line 1178, in py_exec_bytecode
    exec(bytecode, globals, locals)
  File "game/android.rpy", line 539, in <module>
  File "game/android.rpy", line 223, in android_build
  File "game/distribute.rpy", line 591, in __init__
  File "game/distribute.rpy", line 1700, in make_key_pem
FileNotFoundError: [Errno 2] No such file or directory: 'F:\\renpy\\GGD Mentor\\update.pem'

Windows-10-10.0.19045 AMD64
Ren'Py 8.2.0.24012702
Ren'Py Launcher 8.2.0.24012702
Fri Feb 16 15:00:49 2024
I don't know anything about the error to even begin troubleshooting

Re: File not found update.pem

Posted: Tue Feb 27, 2024 5:31 am
by Imperf3kt
I have checked other, older projects, and they build an android distribution just fine, so I am completely confused what is happening with this project.
The project in question is considerably larger and more complex than the others I built, but I haven't changed anything significant since last releasing an update, so I don't know the first thing to troubleshoot.

I will just restart the project from scratch, copying it over piece by piece until I have rebuilt the entire thing. I really don't want to do that, but I have no idea how else to fix whatever is wrong with it.

Re: File not found update.pem

Posted: Tue Feb 27, 2024 7:35 am
by jeffster
All I can say is that

PEM is a container file format often used to store cryptographic keys.

Like those used for SSL certificates (for "https" web connections).

The error must have something to do with a failure to acquire or use some Android key or something.
Is it a Ren'Py bug or some change in Android /store data - no idea, but maybe dig in that direction.

Re: File not found update.pem

Posted: Wed Feb 28, 2024 1:06 am
by downover
I also ran into this. I think it probably only happens when you have "Build Updates" checked. I can't find any code in renpy to generate it, but something did in one of my projects, so I just copied it into my other project so it could be used there as well. I'm just testing stuff at this point, not releasing anything.

It's used to build updates.ecdsa, which is used to sign builds so that they can be verified by the updater. See https://www.renpy.org/doc/html/updater.html. There's not much documentation about it, but it does say that it can usually be safely ignored, which doesn't seem to be the case :).

According to this there should be one in renpy base so maybe you can just copy that one. But again, I would only do that for test projects - if you're going to distribute this you should probably make an update.pem unique to your project and store it securely!

Code: Select all

        def find_update_pem(self):
            if self.build['renpy']:
                return os.path.join(config.renpy_base, "update.pem")
            else:
                return os.path.join(self.project.path, "update.pem")

Re: File not found update.pem

Posted: Wed Feb 28, 2024 1:13 am
by downover
Oh, here is where it's generated. It should happen as part of the Distribute flow.

distribute_gui.rpy:

Code: Select all

label start_distribute:
    if project.current.dump["build"]["include_update"] and not os.path.exists(os.path.join(project.current.path, "update.pem")):
        call add_update_pem
Looks like it's just generating one randomly. So if you can't find out how to get renpy to create it, you could just use this snippet to create one in python. Substitute your project's path, of course.

Code: Select all

        import ecdsa
        key = ecdsa.SigningKey.generate(curve=ecdsa.NIST256p).to_pem()

        with open(os.path.join(project.current.path, "update.pem"), "wb") as f:
            f.write(key)

Re: File not found update.pem

Posted: Wed Feb 28, 2024 4:41 am
by Imperf3kt
Thanks for the tips.
I was going into android.rpy looking for any references I could, but I never thought to check distribute_gui
jeffster wrote: Tue Feb 27, 2024 7:35 am All I can say is that

PEM is a container file format often used to store cryptographic keys.

Like those used for SSL certificates (for "https" web connections).

The error must have something to do with a failure to acquire or use some Android key or something.
Is it a Ren'Py bug or some change in Android /store data - no idea, but maybe dig in that direction.
I'm going to assume it's an error on my end, I just need to figure out exactly what, but I have a couple of leads now.
Thanks everyone

Re: File not found update.pem

Posted: Wed Feb 28, 2024 7:06 am
by Imperf3kt
downover wrote: Wed Feb 28, 2024 1:06 am I also ran into this. I think it probably only happens when you have "Build Updates" checked. I can't find any code in renpy to generate it, but something did in one of my projects, so I just copied it into my other project so it could be used there as well. I'm just testing stuff at this point, not releasing anything.

It's used to build updates.ecdsa, which is used to sign builds so that they can be verified by the updater. See https://www.renpy.org/doc/html/updater.html. There's not much documentation about it, but it does say that it can usually be safely ignored, which doesn't seem to be the case :).

According to this there should be one in renpy base so maybe you can just copy that one. But again, I would only do that for test projects - if you're going to distribute this you should probably make an update.pem unique to your project and store it securely!

Code: Select all

        def find_update_pem(self):
            if self.build['renpy']:
                return os.path.join(config.renpy_base, "update.pem")
            else:
                return os.path.join(self.project.path, "update.pem")
This seems to have been the issue. Thank you so much for finding this and the suggested fix

Re: File not found update.pem

Posted: Thu Feb 29, 2024 5:22 pm
by schaakakon
Imperf3kt wrote: Wed Feb 28, 2024 7:06 am
downover wrote: Wed Feb 28, 2024 1:06 am I also ran into this. I think it probably only happens when you have "Build Updates" checked. I can't find any code in renpy to generate it, but something did in one of my projects, so I just copied it into my other project so it could be used there as well. I'm just testing stuff at this point, not releasing anything.

It's used to build updates.ecdsa, which is used to sign builds so that they can be verified by the updater. See https://www.renpy.org/doc/html/updater.html. There's not much documentation about it, but it does say that it can usually be safely ignored, which doesn't seem to be the case :).

According to this there should be one in renpy base so maybe you can just copy that one. But again, I would only do that for test projects - if you're going to distribute this you should probably make an update.pem unique to your project and store it securely!

Code: Select all

        def find_update_pem(self):
            if self.build['renpy']:
                return os.path.join(config.renpy_base, "update.pem")
            else:
                return os.path.join(self.project.path, "update.pem")
This seems to have been the issue. Thank you so much for finding this and the suggested fix
I'm having this exact same issue. Looks like the solution worked for you but I'm not skilled enough at Renpy to understand how to use the solution. What is it that solved this update.pem file not found issue for you?

Re: File not found update.pem

Posted: Sat Mar 02, 2024 10:45 am
by Imperf3kt
schaakakon wrote: Thu Feb 29, 2024 5:22 pm
Imperf3kt wrote: Wed Feb 28, 2024 7:06 am
downover wrote: Wed Feb 28, 2024 1:06 am I also ran into this. I think it probably only happens when you have "Build Updates" checked. I can't find any code in renpy to generate it, but something did in one of my projects, so I just copied it into my other project so it could be used there as well. I'm just testing stuff at this point, not releasing anything.

It's used to build updates.ecdsa, which is used to sign builds so that they can be verified by the updater. See https://www.renpy.org/doc/html/updater.html. There's not much documentation about it, but it does say that it can usually be safely ignored, which doesn't seem to be the case :).

According to this there should be one in renpy base so maybe you can just copy that one. But again, I would only do that for test projects - if you're going to distribute this you should probably make an update.pem unique to your project and store it securely!

Code: Select all

        def find_update_pem(self):
            if self.build['renpy']:
                return os.path.join(config.renpy_base, "update.pem")
            else:
                return os.path.join(self.project.path, "update.pem")
This seems to have been the issue. Thank you so much for finding this and the suggested fix
I'm having this exact same issue. Looks like the solution worked for you but I'm not skilled enough at Renpy to understand how to use the solution. What is it that solved this update.pem file not found issue for you?
I have build_updates set to true in my project
Setting that to false fixes ignores the issue.
But using the code provided within the splashscreen, generates the missing file and I could turn it back to true

Re: [Solved] File not found update.pem

Posted: Mon Mar 04, 2024 1:46 am
by alisa1
I encountered a similar error but I don't know how to solve it, in building package, I have renpy 8.2.0, and also java, jdk latest versions

Code: Select all

While running game code:
  File "game/android.rpy", line 539, in <module>
  File "game/android.rpy", line 223, in android_build
  File "game/distribute.rpy", line 591, in __init__
  File "game/distribute.rpy", line 1700, in make_key_pem
FileNotFoundError: [Errno 2] No such file or directory: "C:\\Users\\User\\Downloads\\Ren'Py\\renpy-8.2.0-sdk\\project\\update.pem"

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "launcher/game/front_page.rpyc", line 246, in script call
  File "launcher/game/android.rpyc", line 539, in script
  File "C:\Users\User\Downloads\Ren'Py\renpy-8.2.0-sdk\renpy\ast.py", line 823, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\Users\User\Downloads\Ren'Py\renpy-8.2.0-sdk\renpy\python.py", line 1178, in py_exec_bytecode
    exec(bytecode, globals, locals)
  File "game/android.rpy", line 539, in <module>
  File "game/android.rpy", line 223, in android_build
  File "game/distribute.rpy", line 591, in __init__
  File "game/distribute.rpy", line 1700, in make_key_pem
FileNotFoundError: [Errno 2] No such file or directory: "C:\\Users\\User\\Downloads\\Ren'Py\\renpy-8.2.0-sdk\\project\\update.pem"

Windows-10-10.0.19041 AMD64
Ren'Py 8.2.0.24012702
Ren'Py Launcher 8.2.0.24012702
Sun Mar  3 19:25:53 2024