• Python update

    From g00r00@77:1/138 to All on Thu Jan 21 17:15:01 2021
    For those who do development in Mystic Python, I have updated the prealphas today with a fully functional new Python 2.x engine (menu command GZ I think for now) so please test your existing scripts with it if you can. It will be replacing the old engine based on feedback (or if I get none I assume it works).

    The Python 3.x engine is there too but I have no tested it with the latest round of changes. I am focusing on the new Python 2 engine first and them moving on to debugging 3.x but YMMV with Py3 (menu command G@ for now).

    The new engine should handle errors better, do better at cleaning up bad code (if for example you don't call a msg_close for example on an open message base, it should detect it and close it). It should also run without any of the environment nonsense we had to do with recompiling in the past, and overall it should be more stable across many platforms.

    --- Mystic BBS v1.12 A47 2021/01/16 (Windows/32)
    * Origin: Sector 7 | Mystic WHQ (77:1/138)
  • From xqtr@77:2/102 to g00r00 on Fri Jan 22 19:51:06 2021
    For those who do development in Mystic Python, I have updated the prealpha today with a fully functional new Python 2.x engine (menu command GZ I thi for now) so please test your existing scripts with it if you can. It will

    I tested this version: v1.12 A47 Linux/64 Compiled 2021/01/21 16:56:30

    ... with the following scripts: VirtualBase, xMsgArea (my custom message area), Voteliner, MysticBB and some other code snippets... and all was fine! I also tested it with Opicrons RJAM script and it was working fine.

    Just those mods, are using various python2 modules (configparser, pickle, os, sys, struct, binascii, smtplib, ftplib, base64 and more) and Mystics internal functions (file access, msg access etc.)

    I also tested a Python3 script with the new python3 support and although the script was not a 100% mystic compatible (my code i mean), it run with out errors.

    The only thing is, that both Python2 and 3 on my system are compiled with the --shared option, as were the instructions until now. If there isn't a need to compile them now, it would be better. :)

    :: XQTR :: Another Droid BBS :: andr01d.zapto.org:9999 :: xqtr@gmx.com

    --- Mystic BBS v1.12 A47 2020/11/23 (Raspberry Pi/32)
    * Origin: Another Droid BBS # andr01d.zapto.org:9999 (77:2/102)
  • From g00r00@77:1/138 to xqtr on Fri Jan 22 16:53:27 2021
    I tested this version: v1.12 A47 Linux/64 Compiled 2021/01/21 16:56:30

    ... with the following scripts: VirtualBase, xMsgArea (my custom message area), Voteliner, MysticBB and some other code snippets... and all was fine! I also tested it with Opicrons RJAM script and it was working
    fine.

    Just those mods, are using various python2 modules (configparser,
    pickle, os, sys, struct, binascii, smtplib, ftplib, base64 and more) and Mystics internal functions (file access, msg access etc.)

    This is great to hear, thank you for testing! If there are Python features you'd like to see please let me know!

    I also tested a Python3 script with the new python3 support and although the script was not a 100% mystic compatible (my code i mean), it run
    with out errors.

    Well that is surprisingly good news :)

    The only thing is, that both Python2 and 3 on my system are compiled
    with the --shared option, as were the instructions until now. If there isn't a need to compile them now, it would be better. :)

    You should not need to do the recompile any more, at least I did not have to when I tried it on a fresh Ubuntu 20.04 installation. I have only tested with Ubuntu 20.04 so far.

    The only thing I did was a "sudu apt install libpython2.7" because 2.7 wasn't installed in Ubuntu 20.04. Everything worked after that for both versions without any recompile!

    We are making good progress in Python support finally! :)

    --- Mystic BBS v1.12 A47 2021/01/16 (Windows/32)
    * Origin: Sector 7 | Mystic WHQ (77:1/138)
  • From Alpha@77:1/127 to g00r00 on Sat Jan 23 18:24:41 2021
    The Python 3.x engine is there too but I have no tested it with the
    latest round of changes. I am focusing on the new Python 2 engine first and them moving on to debugging 3.x but YMMV with Py3 (menu command G@
    for now).

    Hey g00r00, exciting news about Python updates!

    Question on Python 3 -- I spun up up a fresh Ubuntu 20.04 VM w/mystic, and I'm trying to run the example Python3 script that comes installed (testpy3.mpy). Receiving the "Cannot initialize python press a key" message.
    I'm *assuming* this may have to do with the settings in mystic -cfg, or env variables? My 'Python3 Library' setting in config points to /usr/lib/python3.8 -- is that correct for a fresh install?

    Also, Wiki shows PYTHONHOME and PYTHONPATH may need to be set. For a fresh ubuntu 20.04 install, are there a known working settings for these that you or someone can share?

    Thanks!

    |04þ |12Alpha |04þ
    |03Corporation X BBS|08........|11corpxbbs.com:2323|08...........|07Mystic |03The Drunken Gamer BBS|08....|11thedrunkengamer.com:8888|08....|07Talisman

    --- Mystic BBS v1.12 A47 2021/01/21 (Linux/64)
    * Origin: Corporation X BBS (77:1/127)
  • From xqtr@77:2/102 to g00r00 on Sat Jan 23 19:23:07 2021
    This is great to hear, thank you for testing! If there are Python features you'd like to see please let me know!

    hmmm... a save/restore screen feature, although with the getchar() function is easy to make one :) native support for the message/text editor and full access to all .dat files, within the MPY environment. For example, i need to access users signature and i can only do it, if i read the users.dat file :) For a start, i think are enough :) hahaha

    The only thing I did was a "sudu apt install libpython2.7" because 2.7 wasn't installed in Ubuntu 20.04. Everything worked after that for both versions without any recompile!

    Yes... even with Python2, Mystic now gives an error if you haven't setup the libpython path in the settings. When you do that, both python 2 and 3, work like charm :)

    We are making good progress in Python support finally! :)

    And for both versions, which is very good! Did you use the python4delphi code after all?

    :: XQTR :: Another Droid BBS :: andr01d.zapto.org:9999 :: xqtr@gmx.com

    --- Mystic BBS v1.12 A47 2020/11/23 (Raspberry Pi/32)
    * Origin: Another Droid BBS # andr01d.zapto.org:9999 (77:2/102)
  • From g00r00@77:1/138 to Alpha on Sat Jan 23 13:51:41 2021
    -cfg, or env variables? My 'Python3 Library' setting in config points
    to /usr/lib/python3.8 -- is that correct for a fresh install?

    No for a fresh install of Ubuntu 20.04 you should do nothing ie try it with a blank value.

    Mystic defaults to libpython3.8.so.1.0 which is what ships with Ubuntu 20.04 so it works out of the box with no configuration (or at least it does for me).

    But normally you would set it to the libpython library if you are not using the default. If you do a "sudo find /usr -name'libpython3*.so*' you should see results of a search that prints out your Python installation. In Linux you are looking for something along the lines of "libpython3.5.so.1.0"

    Also, Wiki shows PYTHONHOME and PYTHONPATH may need to be set. For a
    fresh ubuntu 20.04 install, are there a known working settings for these that you or someone can share?

    That stuff is for the old 2.x engine so it may or may not apply here, but you shouldn't have to do anything.

    --- Mystic BBS v1.12 A47 2021/01/16 (Windows/32)
    * Origin: Sector 7 | Mystic WHQ (77:1/138)
  • From g00r00@77:1/138 to xqtr on Sat Jan 23 19:21:17 2021
    hmmm... a save/restore screen feature, although with the getchar() function is easy to make one :) native support for the message/text
    editor and full access to all .dat files, within the MPY environment.
    For example, i need to access users signature and i can only do it, if i read the users.dat file :) For a start, i think are enough :) hahaha

    Thanks for the feedback!

    I'll make sure those things are on the list. Part of my hold up for this sort of stuff is because I may be doing some massive changes to how almost all of it works. I may change how characters are stored, how the editor works, and there has been some auto signature changes on the TODO list for years that I still haven't done.

    And for both versions, which is very good! Did you use the python4delphi code after all?

    No I didn't end up using anything from Python4Delphi. I looked at it briefly but it turned out to only support Python 3 and I wasn't sold on the idea of completely getting rid of 2.x yet.

    Python 3 isn't compatible with the way Mystic handles strings and I think people will still end up having to use Python 2 for some mods until I can figure out what the solution will be for that. Maybe then I could use Python4Delphi and not have to worry about maintaining my own engine.

    The big "breakthrough" was as simple as changing the flags I used to load the libpython library. Its ridiculous how much time I spent trying to get this stuff to work and all it took was a single line of code to fix it!

    --- Mystic BBS v1.12 A47 2021/01/16 (Windows/32)
    * Origin: Sector 7 | Mystic WHQ (77:1/138)
  • From Alpha@77:1/127 to g00r00 on Mon Jan 25 22:58:03 2021
    -cfg, or env variables? My 'Python3 Library' setting in config point to /usr/lib/python3.8 -- is that correct for a fresh install?

    No for a fresh install of Ubuntu 20.04 you should do nothing ie try it with a blank value.

    Blank value did the trick on the fresh install! thanks.

    |04þ |12Alpha |04þ
    |03Corporation X BBS|08........|11corpxbbs.com:2323|08...........|07Mystic |03The Drunken Gamer BBS|08....|11thedrunkengamer.com:8888|08....|07Talisman

    --- Mystic BBS v1.12 A47 2021/01/21 (Linux/64)
    * Origin: Corporation X BBS (77:1/127)
  • From xqtr@77:2/102 to g00r00 on Sat Feb 20 19:25:31 2021
    Is there any update on the Python engine? Will there be an update and/or "official" release of the new P3 engine?

    I am only asking, because i don't know what to do. If i write something in P2, i may have to rewrite it in P3 very shortly and if i write something on P3, it may not be released soon, as long the new engine is not ready.

    :: XQTR :: Another Droid BBS :: andr01d.zapto.org:9999 :: xqtr@gmx.com

    --- Mystic BBS v1.12 A47 2020/11/23 (Raspberry Pi/32)
    * Origin: Another Droid BBS # andr01d.zapto.org:9999 (77:2/102)
  • From ryan@77:1/128 to xqtr on Sat Feb 20 18:55:59 2021
    I am only asking, because i don't know what to do. If i write something
    in P2, i may have to rewrite it in P3 very shortly and if i write something on P3, it may not be released soon, as long the new engine is not ready.

    If it were me, I'd write it in P3. P2 is potentially a security concern at
    some point in the near term, so I'd use what's modern and supported,
    especially as g00r00 has already implemented it for testing purposes.

    Maybe I should test it out myself and provide a bit of feedback so we can try moving things forward :P

    --- Mystic BBS v1.12 A46 2020/08/06 (Linux/64)
    * Origin: monterey bbs (77:1/128)
  • From xqtr@77:2/102 to ryan on Sun Feb 21 09:12:38 2021
    If it were me, I'd write it in P3. P2 is potentially a security concern atsome point in the near term, so I'd use what's modern and supported, especially as g00r00 has already implemented it for testing purposes.

    Sure, but first P3 is only implemented in some versions of A47, which is not officially released and secondly it may have changes/differences with P2/mpy. So imaging, writing something in P3/mpy and after some days/weeks, you have to re-write it again.

    I am only asking just to see where we are in this subject. I understand that g00r00 may have other matters to attend and honestly i also enjoy a break :)

    :: XQTR :: Another Droid BBS :: andr01d.zapto.org:9999 :: xqtr@gmx.com

    --- Mystic BBS v1.12 A47 2020/11/23 (Raspberry Pi/32)
    * Origin: Another Droid BBS # andr01d.zapto.org:9999 (77:2/102)
  • From g00r00@77:1/138 to xqtr on Sun Feb 21 18:05:36 2021
    I am only asking, because i don't know what to do. If i write something
    in P2, i may have to rewrite it in P3 very shortly and if i write something on P3, it ma y not be released soon, as long the new engine is not ready.

    I have no plans to remove Python 2. The current builds all run Python 2 and 3 on the new "dual version" engine. The mystic_bbs module will stay as close to the same as it has always been. There will probably be some changes down the road, but those wouldn't be because of Python version - just growing the module's capabilities.

    There are some challenges though:

    Python 3 does not encode strings the same way Mystic does, and so dealing with strings that contain characters outside of the ASCII range might prove to be problematic or challenging until I decide on a solution. The biggest thing to worry about is that the way message text and file descriptions are returned could change. Ideally I will keep it working the way it does now and only add new functions, but I can't say for sure yet.

    There is also one person who still says Python 3 cannot work with modules/or is in general broken for them, so I need to look more into that too. Those are the two things that give me less confidence that A47 is ready to be final.

    TLDR - Python 2 is staying so you only need to move to Python 3 if you want to.

    In terms of work on the engine, I have not done anything with Mystic in the past couple of weeks for the most part. I am having a really busy spell outside of BBS stuff which is preventing me from spending a lot of time on the hobby right now. Mostly I am just fixing bugs the past few weeks if they are reported.

    --- Mystic BBS v1.12 A47 2021/02/12 (Windows/64)
    * Origin: Sector 7 | Mystic WHQ (77:1/138)