Appendices


IDE not very


There is currently no IDE for python on RISC OS although there are rumours. In the meantime it is possible to tune StrongED to make development easier. The necessary changes are described below.


SETUP FOR PYTHON WITH STRONGED

    1. load python file into into StrongED with double click
    2. change ModeWhen to prevent multiple StrongEd copies
    3. run from StrongED with F10 (running man icon)
    4. change font for readability 

1.
    
    !Python !boot sets:-
        Set Alias$@RunType_a73 python3 %%*0
        
    Change runtype to run strongED instead of python
        SET Alias$@RunType_a73 Run SCSI::SSD.$.Apps.S1.!StrongED.!Run %*0
        I do this with an obey file.

2.
    Set up StrongED to accept doubleclicked Python files 

    - Right click on StrongED's iconbar icon to open the modes menu
    - In the menu that appears, click on Python with Ctrl held down
    - In the ModeWhen file, find the line '! a73,**' and remove '!'
    - Save ModeWhen file (to UserPrefs if asked)

      Now Python files will load without another instance of StrongED starting.
   
3.
    Make python files run in taskwindow from StrongED

    Change .....Python3.ModeFile
    
    comment out default behaviour
        #Select	SetTmp() SaveRun("")
        
    add line to execute via TaskWindow    
        Select	SetTmp() SaveRun("TaskWindow \"Python3\" ")

4.
    font Bitmap 11x19 Luc is good on a 1920x1080 screen



PIP Installer


PIP  Pip Installs Packages

The PyPA recommended tool for installing Python packages

key commands into a TaskWindow and press return
  or
save commands as obey files and double click
  or
load obey file into StrongED and click Run icon

*python3 -m pip --help
    Usage:
      __main__/py  [options]
    Commands:
      install        Install packages.
      download       Download packages.
      uninstall      Uninstall packages.
      freeze         Output installed packages ....
      list           List installed packages
      .......

*python3 -m pip --version
    pip 20.0.2 from SCSI::SSD.$.!BOOT.Resources.!PythonSite.
    Python38.Site-Packages.pip (python 3.8)


python3 -m pip install riscos_toolbox
    Collecting riscos_toolbox
      Downloading riscos_toolbox-0.1.0-py3-none-any.whl (4.9 kB)
    Installing collected packages: riscos-toolbox
    Successfully installed riscos-toolbox-0-1-0


*python3 -m pip install --upgrade youtube-dl

*python3 -m pip list
    Package        Version
    -------------- -------------------
    riscos-toolbox 0-1-0
    setuptools     41.2.0.post20200303
    youtube-dl     2021-3-3

Path Variables

When the Python related apps have been seen the following path variables are set. Note; currently (11th of April, 2021) PythonUser$Path is not set.

Python3$Path :       SCSI::SSD.$.Apps.Development.!Python3.
PythonSite$Path :    SCSI::SSD.$.!BOOT.Resources.!PythonSite.
Run$Path :           SCSI::SSD.$.!BOOT.Library.,
                     ,%.
                     ,SCSI::SSD.$.!BOOT.Resources.!Internet.bin.
                     ,PythonUser:Scripts.
                     ,PythonSite:Scripts.
                     ,Python3:Bin.
                     ,Python3:Scripts.
                     ,SCSI::SSD.$.Apps.L1.!lua.bin.

Python Filetypes in RISC OS

There are two filetypes for Python script files.

Python27    AE5  scripts
Python3     A73  scripts
There are two other Python filetypes which are not version specific. The Python interpreter creates a "bytecode" file when a .py file is imported. There is also a file type for " Extensions".

PytnCode    A74
PytnExtn    A75

© 2021 JR