(Apr-11-2024, 03:35 AM)deanhystad Wrote: If you can't open a text file, convert the text file to a python module. This is how you can convert your bible verse text file to a python module.
bible_verse.py
from random import choice
# This is your bible verse text file converted into a multi-line string.
# All you have to do is put the text=""" before the first verse and """
# after the last verse.
text = """
This is a verse.
This is the second verse.
Here's another verse.
This is the last verse
"""
# This splits the multi-line string into a list of strings, one string per
# line (\n). It throws away empty strings.
verses = [quote for quote in text.split("\n") if quote]
# This is a function you can use to get a random verse.
def random_verse():
return choice(verses)
Use the module like this:
test.py
from bible_verse import random_verse
for i in range(10):
print(random_verse())
I'm not surprised that nobody had an answer for how to fix a java security access problem for jython code running in a BBS. That is a small expert pool. I don't know how to fix that problem. Luckily the problem you need to fix was not that problem
Hello again, Dean. I was just trying to implement your suggestion when I ran into a new wall. I have everything set up, including a BibleVerse.py file, a command on the Main Menu of the game to access it, and an ANSI menu screen as well. Sadly -- and I kind of expected this to happen -- being as my BBS is running in a Mac Classic environment, apparently, that imposes the 32K size limit on text files, just as it does with SimpleText on Mac OS 9. As a result, the minute I tried to run the external/module on my BBS, I got a SyntaxError: "string constant too large (more than 32,767 characters)".
Based on that, I would have to break the file -- which is 740K in size -- into 25 individual files, and then somehow make that function you gave me randomly select one of those twenty-five files, and then randomly select a verse string in the randomly selected file that it chose.
Do you think that kind of a setup might work? And if so, exactly how would I edit the function you gave me so that it could do that?
Thanks for your time and help. I appreciate it. As I said earlier, no one else has been able to offer me any kind of a solution to the SecurityException.