Python3, Toolbox coding
Andrew McCarthy (3688) 605 posts |
As I’m taking a break from learning C, I’m now working my way through a Python book. Does anyone have any Python 3 code they could share that makes use of the ToolBox? |
John Rickman (71) 646 posts |
Hello Andrew, |
Andrew McCarthy (3688) 605 posts |
Hi John. I tried !TbxTest, and I get a wall of text in a single-tasking error box. Snippets of it are: PythonHome, PythonPath = not set, \xfd\xfd\NULL Pointer DEREFERENCE!!! Fatal Python error init_fs_encoding failed to get the codec for the file system encoding. No module named encodings. |
John Rickman (71) 646 posts |
I have just checked the licence which allows redistribution, so here is a link:-
This is the version I am using. It sounds as if your python environment is not set up properly or has been corrupted. Here is a link to how to get python going on risc os. |
Andrew McCarthy (3688) 605 posts |
Thank you, John, for the link and zip file. I’ll take a look at the link to check my setup. The contents of the zip file seems incomplete. In my !TbxTest application folder, I have the following: !Run, !RunImage, Messages, Res and a toolbox folder. |
John Rickman (71) 646 posts |
I have added the missing tbox app to the link and will investigate why my !TbxTest only works intermittently. I have been intending to update my python riscos guide with how to use the toolbox. So now have some motivation. |
Andrew McCarthy (3688) 605 posts |
John, thank you for your help. I’ve read most of your guide; it’s clear and concise; I look forward to the updates. :) An observation, on removing Python utilising PackMan, it leaves behind PythonSite; I removed that manually. The TBXApp gave the same error message as before; I should add that I have pygame installed, which works perfectly; I have tried with and without pygame installed. Finally, I also tried moving the new install up to the root. No luck. |
John Rickman (71) 646 posts |
An observation, on removing Python utilising PackMan, it leaves behind PythonSite; I removed that manually. Thanks for that. I will amend guide accordingly. |
John Rickman (71) 646 posts |
I have pygame installed, which works perfectly; I have had mixed success working through the pygame examples. Some work and some don’t. I am compiling a list of good of ok/not ok and will share it when it is in better shape. But really good to know there is someone extra working on RISC OS python. |
Andrew McCarthy (3688) 605 posts |
To add to your list of working games – Boing worked for me; once I’d found and installed the required shared libraries.:) ;) Learning Python, I aim to model some ideas. So anyone out there with any Python 3 code that works with the toolbox would be a huge help. |
Chris Johns (8262) 242 posts |
I guess I should comment here :) There is the TbxTest app going around which was distributed with the some of the betas. As others have found it has problems with int too long error. This is because somewhere between the beta and the release version, the way to specify an unsigned integer to swi.swi changed. I think I picked one way for the beta, then changed it later to match how other things worked in python. There a pip install-able riscos-toolbox which is the latest version of the toolbox libraries. https://pypi.org/project/riscos-toolbox/ It might be possible to get the TbxTest application to work with that version. There is a TbxTest on the linked github page too. I really should get back to updating the library, as there are quite a few bits that aren’t supported at all. If someone need a component or gadget adding give me a prod … or submit a patch :) |
Andrew McCarthy (3688) 605 posts |
Chris, thank you for the information, link, and incredible work on Python, extended to all those involved in bringing Python to RISC OS. My original copy of TbxTest was the one that came with Python 2.7. I’ve tried several different versions of TbxTest, but with my current level of knowledge, I wouldn’t know where to start with getting it to work. As a result of figuring out how to print the error messages, I decided to create a new thread to deal with that specifically, especially as the error messages don’t seem to align with what you’ve experienced. |