Skip to content

Starting the Editor

Rahul Arya edited this page Mar 22, 2019 · 2 revisions

The editor can be launched from the terminal, with the command python editor. It supports Python 3.6 and above, and has no dependencies other than what are provided with Python.

Directory Layout

The editor lives in a single folder editor, in the same directory as the .scm files that we wish to edit. Note that, unlike most Python modules, this folder cannot be zipped and still work, since there are static assets within the folder. If OKPy integration is desired, ok and scheme should be present at the same level as editor, along with all its configuration files. Thus, a correct file structure would look something like:

working-directory
│   ok
|   scheme
│   config.ok
|   file1.scm
|   file2.scm
└───editor   
    │   internal files...

Command-line arguments

TL; DR: editor [-h] [-f [FILES [FILES ...]]] [-nb] [-p PORT]

The editor supports the following arguments:

  • -f / --files accepts a (potentially empty) list of files that will be "testable". If no files are passed in, the editor will look for a .ok file to determine which files to test. If no or multiple .ok files are present, and the --files argument is not present, the editor will throw an error. If okpy integration is not desired, we can run python ok --files, which will work even when ok is not present in the working directory.

  • -nb / --nobrowser prevents the editor from launching a new browser window for the editor when python editor is run.

  • -p / --port allows us to change which port is used to host the editor. The default is 31415. Note that if you keep getting an error saying that the port is occupied, make sure that the editor isn't running in the background, before changing the port.

Clone this wiki locally