Help With Jython/Java Not Having Permissions

Anything not about Mac emulation.

Moderators: Cat_7, Ronald P. Regensburg

Post Reply
User avatar
Old-School-BBSer
Apple Corer
Posts: 231
Joined: Sun Mar 01, 2015 8:58 am
Location: Guam

Help With Jython/Java Not Having Permissions

Post by Old-School-BBSer »

Hello again, folks. Okay, old Mr. Bill is REALLY going to go off-topic here, but I am a desperate man! :mrgreen:

So here we go .....

As a few of you may recall, for the fourth time since 1993, I recently resurrected my Hermes II BBS from several decades ago. Now to the issue. I am having one basic problem which neither I, nor ChatGPT, have figured out how to rectify, despite many hours working on it.

Basically, the Hermes II software that I use has its own Jython 2-based runtime environment. Within the file and folder structure of Hermes II, there is in fact a Jython folder, which among other things contains various packages, including a Hermes API package, a Jython package, a QT Java package, an MRJClasses package, as well as a few other things.

The python module I am creating is heavily based on the code of another BBS game which was quite popular within the BBS world quite a few years ago. That game is called Leech. Some of you older folks will no doubt be familiar with one flavor or another of this game.

At any rate, back around 2015 — or a little earlier — the last developer of my BBS software -- Michael Alyn Miller -- made a huge departure from the Pascal-based framework which was used to make games -- meaning externals -- for Hermes II, when he created a development system for externals -- called External Development System -- which is based on Jython, and not on Pascal. He then released a new version of Hermes II, which utilizes this then-new Jython framework.

The primary reason why he did this was to simplify the process of creating externals, so that SysOps who use his BBS software, can more easily create externals themselves for their own Hermes II BBSes, without all of the heavy coding and compilation work involved when using Pascal.

To show and teach SysOps how to create their own BBS externals with Python/Jython, he created an open source version of the Leech game, so that SysOps could learn from his code, which uses a lot of different functions and methods from the Jython development environment.

His Jython version of Leech in fact includes a number of class files, which after some online research, I figured out how to open with an app I found on the web. Upon opening these class files, I can see all of the imports he has made from python.org, all of the strings he has made, function names he has created, etc.

For those of you here who may have experience with this stuff, you will probably find all of this very easy to understand. However, I am not a programmer of Pascal, Python, Jython, C or anything else. Thus, I have struggled since my journey began about a week ago, and a lot of it is still Greek to me.

But, trying my best to understand Michael's coding examples, and more recently getting some help from ChatGPT — which is blowing my mind — I have made considerable progress for a 70-year-old n00b such as myself.

I now have the entry point for my game module set up in the main.py file, which consists of six ANSI screens which serve as the welcome and backstory for my game.

I also have the framework for the main menu, which currently has 5 or 6 working menu commands. I haven’t even begun working on the real meat of the game yet.

This leads us to my current problem. In the storyline for my game, I am including an option on the main menu where the game’s users can go to a spiritual retreat to relax from work. It is a place for spiritual inspiration.

If the game user types in the key command for the retreat, they will be able to randomly display, as many times as they want, quotes taken from the Bible, which are all stored in a text file in the “strings” folder, which is inside of the “resources” folder. This text file contains over 3,000 verses and verse sets from the KJV Bible, which I have personally compiled since 2002.

The coding structure for all of this has already been added to the main.py module, thanks to the Leech coding example, and to a lot of help from ChatGPT.

Now here is the problem — and I have seen through online research, that others have encountered this same problem too.

With all of this code in place, my game module is unable to load within my BBS environment, because the Java/Jython components are unable to open and read the text file which contains the aforementioned 3,000+ strings,.

The error output is stating the following. I have obfuscated the actual path for reasons of security:

Traceback (innermost last):
File "/Macintosh HD/Applications/BBS Soft/BBS Files/Doors/MyGame/main.py", line 305, in ?
File "/Macintosh HD/Applications/BBS Soft/BBS Files/Doors/MyGame//main.py", line 264, in main
File "/Macintosh HD/Applications/BBS Soft/BBS Files/Doors/MyGame//main.py", line 96, in read_quotes

java.lang.SecurityException: java.lang.SecurityException: not allowed to read resources/strings/QuotesFile.txt

A runtimeException occurred.

So the problem is that I have absolutely no idea how to give — I assume main.py — the permissions it needs to read the “QuotesFile.txt” file. It knows exactly where to find the file, and sees it, but it doesn't have permission to open it, or Java doesn't have permission, or Jython. I am really not sure which is trying to open the file. If someone can explain to me exactly how to do this -- that is, provide the needed permissions -- then hopefully, my game module will load again, and I will be able to continue working on it.

Please note that this is all happening in a Mac OS 9.2.2 environment, which is made possible by running the Qemu PPC emulator, which runs inside of macOS Sonoma 14.4.1, on my 2019 5K iMac.

So, if anyone knows the solution to this problem, and can explain it to me in layman’s terms, I wold be most appreciative.

So there you have it.
Kind regards,

Bill Kochman
Last edited by Old-School-BBSer on Thu Apr 04, 2024 12:25 pm, edited 1 time in total.
Bill Kochman
Armageddon BBS
Guam, Mariana Islands, USA
User avatar
Cat_7
Expert User
Posts: 6222
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Help With Jython/Java Not Having Permissions

Post by Cat_7 »

I assume you are not trying to run this from inside the disk on your 9.2.2 desktop that gives access to the shared folder on your host?

Best,
Cat_7
User avatar
Old-School-BBSer
Apple Corer
Posts: 231
Joined: Sun Mar 01, 2015 8:58 am
Location: Guam

Re: Help With Jython/Java Not Having Permissions

Post by Old-School-BBSer »

Hi Cat_7. This python module is actually a game listed in the "Externals" section of my Hermes II BBS. In other words, you type a number at the Externals menu to access a particular game or other utility, and then the game simply runs inside of Hermes.

To clarify, my module will run within Hermes, IF I were to remove the various functions which make the call to the text file in question. With those functions removed, I can easily enter the module, go through the six or so welcome and backstory intro ANSI screens, arrive at the main menu, and use a number of different commands on the Main Menu. This all works and is very stable. But trying to get the module to open the text file is simply a no-go due to the permission errors shown above. I hope that clarifies things for you.
Bill Kochman
Armageddon BBS
Guam, Mariana Islands, USA
User avatar
Old-School-BBSer
Apple Corer
Posts: 231
Joined: Sun Mar 01, 2015 8:58 am
Location: Guam

Re: Help With Jython/Java Not Having Permissions

Post by Old-School-BBSer »

Cat_7 wrote: Thu Apr 04, 2024 5:59 am I assume you are not trying to run this from inside the disk on your 9.2.2 desktop that gives access to the shared folder on your host?
Have you thought of any further ideas regarding why Jython is throwing this security exception error when my module tries to open the text file containing the Bible quotes?

I haven't worked on it in several days, because it was burning out my brain. So I've been working on our new Jython-based games for my BBS. But I still want to get the "Retreat" section of the code for "Space Race: Mission to Mars!" fixed and working properly.
Bill Kochman
Armageddon BBS
Guam, Mariana Islands, USA
User avatar
Cat_7
Expert User
Posts: 6222
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Help With Jython/Java Not Having Permissions

Post by Cat_7 »

I really have no idea whatsoever.

Best,
Cat_7
Post Reply