• Mystic MPY issue

    From Gryphon@21:1/120 to All on Tue Oct 30 17:18:48 2018
    So I'm trying to write a mystic python MPY app that will run a google search and return the list of links that are hits. I'm able to get a raw python script to work just fine. But when I convert it to MPY for use in Mystic, it throws an error. I can't see why one works and one fails.

    The original PY code:
    --------------------
    #!/usr/bin/env python

    #Dependancies
    from googlesearch import search
    import requests

    def GoogleIt(input):
    for j in search(input, tld="com", num=20, stop=2, pause=2):
    print(j)

    input = raw_input("Google Search: ")
    print('Getting information, Please Wait....')
    GoogleIt(input)
    -----------------------------
    And its output:
    Google Search: halloween
    Getting information, Please Wait....
    https://www.history.com/topics/halloween https://www.deviantart.com/enijoi/art/Happy-Halloween-491737168 https://www.pinterest.com/madamemort/%2Bthis-is-halloween%2B/ https://genius.com/Kodak-black-halloween-lyrics https://www.halloweencostumes.com/
    https://www.walmart.com/browse/2637_615760
    ...

    You can see that it seems to work properly.

    Here's the MPY code
    -----------------------------
    import mystic_bbs as bbs

    from googlesearch import search

    def GoogleIt(input):
    for j in search(input, tld="com", num=20, stop=2, pause=2):
    bbs.writeln(j)

    def GetTitle():
    bbs.write('Google Search: ')
    input = bbs.getstr(1,40,40,"")
    bbs.writeln('Getting information, Please Wait....')
    GoogleIt(input)

    GetTitle()
    bbs.writeln('|CR|PADone!|CL')
    -------------------------------

    I get this error:

    Google Search: halloween
    Getting information, Please Wait....

    PYTHON ERROR (sixdegs.mpy)

    File "sixdegs.mpy", line 15, in <module>
    File "sixdegs.mpy", line 13, in GetTitle
    File "sixdegs.mpy", line 6, in GoogleIt
    File "/usr/local/lib/python2.7/dist-packages/googlesearch/__init__.py",
    line 330, in search
    get_page(url_home % vars())
    --------------------

    In both instances, I must assume that both scripts are using the same module. What I don't know is why one works and the other doesn't.

    Any thoughts?

    --- Mystic BBS v1.12 A39 2018/04/21 (Linux/64)
    * Origin: Cyberia BBS | cyberiabbs.zapto.org | San Jose, CA (21:1/120)
  • From Avon@21:1/101 to Gryphon on Thu Nov 1 18:52:17 2018
    On 10/30/18, Gryphon pondered and said...

    raw python script to work just fine. But when I convert it to MPY for
    use in Mystic, it throws an error. I can't see why one works and one fails.

    I'm not ofait with python and how much is implemented in Mystic Gryphon but could it be the functions you're trying to use are not implemented yet by g00r00?

    --- Mystic BBS v1.12 A39 2018/04/21 (Windows/32)
    * Origin: Agency BBS | Dunedin, New Zealand | agency.bbs.nz (21:1/101)
  • From Gryphon@21:1/120 to Avon on Thu Nov 1 14:51:28 2018
    On 11/01/18, Avon said the following...

    On 10/30/18, Gryphon pondered and said...

    raw python script to work just fine. But when I convert it to MPY fo use in Mystic, it throws an error. I can't see why one works and one fails.

    I'm not ofait with python and how much is implemented in Mystic Gryphon but could it be the functions you're trying to use are not implemented
    yet by g00r00?

    I'm of the thought that MPY is different than MPL in that it uses an outside interpreter and its modules. So I don't think it's something that needs to
    be 'included' into mystic. The fact is that many other modules do work. But these particular ones don't seem to work, and I don't know why.

    --- Mystic BBS v1.12 A39 2018/04/21 (Linux/64)
    * Origin: Cyberia BBS | cyberiabbs.zapto.org | San Jose, CA (21:1/120)
  • From Avon@21:1/101 to Gryphon on Thu Nov 8 02:17:40 2018
    On 11/01/18, Gryphon pondered and said...

    I'm not ofait with python and how much is implemented in Mystic Gryph but could it be the functions you're trying to use are not implemente yet by g00r00?

    I'm of the thought that MPY is different than MPL in that it uses an outside interpreter and its modules. So I don't think it's something
    that needs to be 'included' into mystic. The fact is that many other modules do work. But these particular ones don't seem to work, and I don't know why.

    OK, sure. I don't really have a lot of knowledge in this area but I'm aware there were only so many bbs functions enabled for Mystic in the module g00r00 has created for Python. I hope you can solve your problem. Good luck.

    --- Mystic BBS v1.12 A39 2018/04/21 (Windows/32)
    * Origin: Agency BBS | Dunedin, New Zealand | agency.bbs.nz (21:1/101)
  • From Gryphon@21:1/120 to Avon on Thu Nov 8 16:25:51 2018
    On 11/07/18, Avon said the following...

    On 11/01/18, Gryphon pondered and said...

    I'm not ofait with python and how much is implemented in Mystic but could it be the functions you're trying to use are not imple yet by g00r00?

    I'm of the thought that MPY is different than MPL in that it uses an outside interpreter and its modules. So I don't think it's something that needs to be 'included' into mystic. The fact is that many other modules do work. But these particular ones don't seem to work, and I don't know why.

    OK, sure. I don't really have a lot of knowledge in this area but I'm aware there were only so many bbs functions enabled for Mystic in the module g00r00 has created for Python. I hope you can solve your problem.

    Oh, yes. I just realized what you meant. Yes, g00r00 only incorporated a
    few BBS functions; not nearly as many as in MPL. But it is not the BBS functions that are failing, but rather a module in python.

    --- Mystic BBS v1.12 A39 2018/04/21 (Linux/64)
    * Origin: Cyberia BBS | cyberiabbs.zapto.org | San Jose, CA (21:1/120)
  • From bcw142@21:1/145 to Gryphon on Fri Nov 9 16:17:28 2018
    On 10/30/18, Gryphon said the following...

    So I'm trying to write a mystic python MPY app that will run a google search and return the list of links that are hits. I'm able to get a
    raw python script to work just fine. But when I convert it to MPY for
    use in Mystic, it throws an error. I can't see why one works and one fails.

    Try the script under mystic's DD so your running the Python script without going through Mystic. It's more likely to work, I run a number of scripts (bash) like that which work fine.

    --- Mystic BBS v1.12 A39 2018/04/21 (Raspberry Pi/32)
    * Origin: Mystic Pi BBS bcw142.zapto.org (21:1/145)
  • From Gryphon@21:1/120 to bcw142 on Fri Nov 9 14:46:02 2018
    On 11/09/18, bcw142 said the following...

    On 10/30/18, Gryphon said the following...

    So I'm trying to write a mystic python MPY app that will run a google search and return the list of links that are hits. I'm able to get a raw python script to work just fine. But when I convert it to MPY fo use in Mystic, it throws an error. I can't see why one works and one fails.

    Try the script under mystic's DD so your running the Python script
    without going through Mystic. It's more likely to work, I run a number
    of scripts (bash) like that which work fine.

    Because my app involves a lot of light-bar user interaction, the only real option I have in python is to use the ncurses library to do that. But as we have all seen, native apps that use ncurses just will not display correctly in Mystic. Since I'm coding a game, there needs to be a proper user interface,
    so running python as a door is out.

    So my alternative is to write an MPL to do the UX work, and use a python
    script to run the backend functions to do the web scraping. It's kludgy, but so far, it works.

    --- Mystic BBS v1.12 A39 2018/04/21 (Linux/64)
    * Origin: Cyberia BBS | cyberiabbs.zapto.org | San Jose, CA (21:1/120)
  • From dream master@21:1/163 to Gryphon on Fri Nov 9 17:09:19 2018
    On 11/08/18, Gryphon said the following...
    Oh, yes. I just realized what you meant. Yes, g00r00 only incorporated
    a few BBS functions; not nearly as many as in MPL. But it is not the BBS functions that are failing, but rather a module in python.

    i'm sure it's a bug

    |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[|15bbs|09.|15dreamlandbbs|09.|15org|08]

    --- Mystic BBS v1.12 A39 2018/04/21 (Windows/64)
    * Origin: |08--[|15!|07dreamland BBS bbs.dreamlandbbs.org (21:1/163)
  • From bcw142@21:1/145 to Gryphon on Mon Nov 12 00:06:56 2018
    On 11/09/18, Gryphon said the following...

    Because my app involves a lot of light-bar user interaction, the only
    real option I have in python is to use the ncurses library to do that. But as we have all seen, native apps that use ncurses just will not display correctly in Mystic. Since I'm coding a game, there needs to be
    a proper user interface, so running python as a door is out.

    So my alternative is to write an MPL to do the UX work, and use a python script to run the backend functions to do the web scraping. It's
    kludgy, but so far, it works.

    OK so like mRC a mix, at least we know that works. There must be other ways, but I suspect that is the best combination for now as we know it works.
    Python was added for web use so that makes since.

    --- Mystic BBS v1.12 A39 2018/04/21 (Raspberry Pi/32)
    * Origin: Mystic Pi BBS bcw142.zapto.org (21:1/145)