• [ANSI] Help with Python Script

    From KB2MOB@21:1/176 to All on Monday, October 31, 2016 10:56:00
    Howde...

    I posted this in the Fido echo for Mystic, and got a reply, but noticed my reply never went out from Necro BBS. So I guess i will ask here.

    I am writing a Python script to have new users accept the Acceptable Use
    Policy for my board, and when I try to have it display the text of the file, nothing happens. Someone suggested it may be scrolling past the screen to
    fast. I scroll back and nothing is there. I added a pause, nothing. So not
    sure what I am missing. but, here is the code in hopes someone can see something I don't get.

    Any help would be appreciated. Thank you!

    Running on the current version of Mystic with Python 2.7 on Linux...

    ===Begin code===

    #################################################
    # Acceptable Use Policy Script for Mystic BBS #
    # Written by Rich Lawrence, KB2MOB #
    # SysOp of Radio Freqs & Geeks BBS #
    # Telnet/SSH: rfgeeksbbs.ddns.net # #################################################

    from mystic_bbs import *

    file = open('aup.txt' , 'r')
    for line in file:
    writeln(line)
    writeln("|PA")

    writeln ('|CLTo agree to the AUP, please type in "I AGREE" in the input field.'

    writeln ('Typing in anything else besides "I AGREE", is the same as a No respon e')
    writeln ('and you will disconnected from the BBS, but able to reapply in the fu ure.')
    write ('|CRDo you agree to the Acceptable Use Policy|CRof Radio Freqs & Geeks B S? -> ')
    answer = getstr(11 , 7, 7, "I AGREE")

    if answer.upper() == "I AGREE":
    writeln('Thank You. You will return to the new account setup...|CR|PA') else:
    writeln ('|CRYou will now be disconnected from the BBS. You may reapply at anytime.')
    writeln ('Press ENTER to disconnect... |PN')
    shutdown()


    ===End code===

    --- Mystic BBS v1.12 A31 (Linux)
    * Origin: Radio Freqs & Geeks BBS (21:1/176)
  • From Gryphon@21:1/120 to KB2MOB on Wednesday, November 02, 2016 08:42:00
    On 10/31/16, KB2MOB said the following...

    Howde...

    I posted this in the Fido echo for Mystic, and got a reply, but noticed
    my reply never went out from Necro BBS. So I guess i will ask here.

    I am writing a Python script to have new users accept the Acceptable Use Policy for my board, and when I try to have it display the text of the file, nothing happens. Someone suggested it may be scrolling past the screen to fast. I scroll back and nothing is there. I added a pause, nothing. So not sure what I am missing. but, here is the code in hopes someone can see something I don't get.

    Any help would be appreciated. Thank you!


    Maybe you need to give the full path to the file. It may be that the script
    is looking in the wrong place for it, and therefore not finding it to display.

    Running on the current version of Mystic with Python 2.7 on Linux...

    ===Begin code===

    #################################################
    # Acceptable Use Policy Script for Mystic BBS #
    # Written by Rich Lawrence, KB2MOB #
    # SysOp of Radio Freqs & Geeks BBS #
    # Telnet/SSH: rfgeeksbbs.ddns.net # #################################################

    from mystic_bbs import *

    file = open('aup.txt' , 'r')
    for line in file:
    writeln(line)
    writeln("|PA")

    writeln ('|CLTo agree to the AUP, please type in "I AGREE" in the input field.'

    writeln ('Typing in anything else besides "I AGREE", is the same as a No respon e')
    writeln ('and you will disconnected from the BBS, but able to reapply in the fu ure.')
    write ('|CRDo you agree to the Acceptable Use Policy|CRof Radio Freqs & Geeks B S? -> ')
    answer = getstr(11 , 7, 7, "I AGREE")

    if answer.upper() == "I AGREE":
    writeln('Thank You. You will return to the new account setup...|CR|PA') else:
    writeln ('|CRYou will now be disconnected from the BBS. You may reapply at anytime.')
    writeln ('Press ENTER to disconnect... |PN')
    shutdown()


    ===End code===

    "No matter where you go, there you are!" - Buckaroo Bonzai

    --- Mystic BBS v1.12 A31 (Raspberry Pi)
    * Origin: Cyberia BBS | Cyberia.Darktech.Org | Kingwood, TX (21:1/120)
  • From dream master@21:1/163 to KB2MOB on Wednesday, November 02, 2016 15:43:00
    On 10/31/16, KB2MOB said the following...
    Howde...
    I posted this in the Fido echo for Mystic, and got a reply, but noticed
    my reply never went out from Necro BBS. So I guess i will ask here.
    I am writing a Python script to have new users accept the Acceptable Use Policy for my board, and when I try to have it display the text of the file, nothing happens. Someone suggested it may be scrolling past the screen to fast. I scroll back and nothing is there. I added a pause, nothing. So not sure what I am missing. but, here is the code in hopes someone can see something I don't get.

    interesting. i dont do python that well i would for me use a mpl for that. what if they dont accept? what would the python script do after hang up? is this after they create an account?

    |08 .|05ú|13ù|15Dr|07e|08am Ma|07st|15er|13ù|05ú|08.
    |08 øù|05ú|13ùø |13øù|05ú|08ùø
    |11 DoRE|03!|11ACiDiC|03!|11Demonic |08[|15dreamland|09.|15darktech|09.|15org|08]

    --- Mystic BBS v1.12 A31 (Windows)
    * Origin: |08--[|15!|07dreamland BBS dreamland.darktech.org (21:1/163)
  • From Avon@21:1/101 to dream master on Thursday, November 03, 2016 12:26:00
    On 11/02/16, dream master pondered and said...

    interesting. i dont do python that well i would for me use a mpl for
    that. what if they dont accept? what would the python script do after
    hang up? is this after they create an account?

    I don't do Python that well either but for this example I'm really going to
    try and learn enough to offer an answer... as I think it's also cool that efforts to use Python in Mystic are encouraged. It will also help g00r00 to spotlight things that are more requested functions to be enabled in Python
    that are already available in MPL... just a thought :)

    --- Mystic BBS v1.12 A31 (Windows)
    * Origin: Agency BBS | telnet://agency.bbs.geek.nz (21:1/101)
  • From KB2MOB@21:1/176 to dream master on Wednesday, November 02, 2016 21:34:00
    On 11/02/16, dream master said the following...

    interesting. i dont do python that well i would for me use a mpl for
    that. what if they dont accept? what would the python script do after
    hang up? is this after they create an account?

    No, it's before they fill out the new user questions. It prompts after the
    AUP is displayed if they want to continue or hang up. If they say yes, then
    it just goes into the regular new user workflow.

    -MobbyG, KB2MOB

    --- Mystic BBS v1.12 A31 (Linux)
    * Origin: Radio Freqs & Geeks BBS (21:1/176)
  • From KB2MOB@21:1/176 to Avon on Wednesday, November 02, 2016 21:40:00
    On 11/03/16, Avon said the following...

    I don't do Python that well either but for this example I'm really going to try and learn enough to offer an answer... as I think it's also cool that efforts to use Python in Mystic are encouraged. It will also help g00r00 to spotlight things that are more requested functions to be
    enabled in Python that are already available in MPL... just a thought :)

    I've been looking for a way to expand my Python skills. I started to write a CNet Amiga BBS clone, and have a basic framework, but using a external Telnet server. And I want the message bases to be capable of doing fido without any
    in between, like Mystic does. I have the JAM docs, but I'm struggling with reading and writing binary files, and the only code I have found that I have been looking at to learn more is in C and it's like reading a foreign
    language to me. And tutorials I watch on YouTube seem to just make my head
    swim worse.

    But now that Mystic has Python support, I'm pretty excited as I already have
    a few ideas I want to do that I had planned on baking into my project. Just need to figure out this whole displaying a file. LOL. Not sure why it doens't work.

    Guess I gotta keep hacking at it... <Dory>Just keep hacking...Just keep hacking..</Dory>

    -MobbyG, KB2MOB

    --- Mystic BBS v1.12 A31 (Linux)
    * Origin: Radio Freqs & Geeks BBS (21:1/176)
  • From KB2MOB@21:1/176 to All on Thursday, November 03, 2016 00:25:00
    OK, So I did some hacking and and yes, I needed the full path for the txt
    file. Now it appears that the txt file is some how all wonkied up, as the formatting is just waaaaay off. I tried to strip the tabs and newlines out
    but it seems to still not be enough.

    lines.strip('\t\n\r')

    So maybe I just need a fresh file? not really sure. I guess I'll test it on another machine and see if it's Mystic throwing something or the file itself.

    But I'm closer!

    -MobbyG, KB2MOB

    --- Mystic BBS v1.12 A31 (Linux)
    * Origin: Radio Freqs & Geeks BBS (21:1/176)
  • From Avon@21:1/101 to KB2MOB on Sunday, November 06, 2016 07:35:00
    On 11/02/16, KB2MOB pondered and said...

    g00r00 to spotlight things that are more requested functions to be enabled in Python that are already available in MPL... just a thought

    I've been looking for a way to expand my Python skills. I started to
    write a CNet Amiga BBS clone, and have a basic framework, but using a external Telnet server. And I want the message bases to be capable of doing fido without any in between, like Mystic does. I have the JAM
    docs, but I'm struggling with reading and writing binary files, and the only code I have found that I have been looking at to learn more is in C and it's like reading a foreign language to me. And tutorials I watch on YouTube seem to just make my head swim worse.

    I'm a n00b at Python, bought a basic how to book earlier this year at got 65% of the way through it before work/family life took my attention away from it.
    I like the idea of learning this language and lord know the Raspberry Pi
    seems to be built to embrace it. When g00r00 added some BBS functions and the ability to embrace Python I was really happy.

    I presume you have checked out the python.txt file in the docs dir? It shows where things are at right now, but I figure when g00r00 does come back be
    sure to let him know the kind of functions that would make a difference being able to use for the benefit of your project. It would help him (I'm guessing here) to know where he might put his efforts next in that space :)

    I agree about the videos they can be a bit overwhelming for this n00b too :)

    Best, Paul

    --- Mystic BBS v1.12 A31 (Windows)
    * Origin: Agency BBS | telnet://agency.bbs.geek.nz (21:1/101)
  • From dream master@21:1/163 to KB2MOB on Saturday, November 05, 2016 13:05:00
    On 11/02/16, KB2MOB said the following...
    interesting. i dont do python that well i would for me use a mpl for that. what if they dont accept? what would the python script do after hang up? is this after they create an account?
    No, it's before they fill out the new user questions. It prompts after
    the AUP is displayed if they want to continue or hang up. If they say
    yes, then it just goes into the regular new user workflow.

    so ran via startup.mps?

    |08 .|05ú|13ù|15Dr|07e|08am Ma|07st|15er|13ù|05ú|08.
    |08 øù|05ú|13ùø |13øù|05ú|08ùø
    |11 DoRE|03!|11ACiDiC|03!|11Demonic |08[|15dreamland|09.|15darktech|09.|15org|08]

    --- Mystic BBS v1.12 A31 (Windows)
    * Origin: |08--[|15!|07dreamland BBS dreamland.darktech.org (21:1/163)
  • From Zero Reader@21:1/113 to KB2MOB on Sunday, November 06, 2016 10:14:00
    On 11/02/16, KB2MOB said the following...

    have a few ideas I want to do that I had planned on baking into my project. Just need to figure out this whole displaying a file. LOL. Not sure why it doens't work.

    Displaying a file with Mystic Python? This seems kind of kludgy, but just output a string containing the DF MCI code (|DFxsomefilex|) to display a file. This seemed to work last time I played with it.

    --- Mystic BBS v1.12 A31 (Raspberry Pi)
    * Origin: Alcoholiday / Est. 1995 / alco.bbs.io (21:1/113)
  • From KB2MOB@21:1/176 to Avon on Saturday, November 05, 2016 22:51:00
    On 11/06/16, Avon said the following...
    I'm a n00b at Python, bought a basic how to book earlier this year at
    got 65% of the way through it before work/family life took my attention away from it. I like the idea of learning this language and lord know
    the Raspberry Pi seems to be built to embrace it. When g00r00 added some BBS functions and the ability to embrace Python I was really happy.

    Me too. I started with Python on the RaspPi and then started to looking for anything I could find to help me get better. I found some old videos from Google that was a 2 day crash course on Python, and I found a couple of the same kind of files from PyCon. That, along with my free Lynda.com account I used to have from work and Codecademy.com, I managed to get enough knowledge
    to make myself dangerous.. LOL..

    I presume you have checked out the python.txt file in the docs dir? It shows where things are at right now, but I figure when g00r00 does come back be sure to let him know the kind of functions that would make a difference being able to use for the benefit of your project. It would help him (I'm guessing here) to know where he might put his efforts next in that space :)

    I did read the python.txt file. It's kinda sparse, but hey, I know I can ask
    if I don't get something. And the more I study it and hack, I'm sure I'll figure it out. I'm planning on making a few of my days off from work
    dedicated to doing some projects for my BBS. The AUP one is just like a beta idea.

    But I have noticed that when iterating through a file, it's sending extra
    tabs and new lines causing the file I want to display to loose the
    formatting. I've tried taking them out with the .strip() method, but it
    doesn't seem to make much difference. So not quite sure where it's coming
    from. But I'll keep plugging away.

    -MobbyG, KB2MOB

    --- Mystic BBS v1.12 A31 (Linux)
    * Origin: Radio Freqs & Geeks BBS (21:1/176)
  • From KB2MOB@21:1/176 to dream master on Saturday, November 05, 2016 23:03:00
    On 11/05/16, dream master said the following...

    so ran via startup.mps?

    No, the plan was from the newuser.asc file. I thought there was a pipe code
    for it but I can't seem to find it now.

    --- Mystic BBS v1.12 A31 (Linux)
    * Origin: Radio Freqs & Geeks BBS (21:1/176)