| |||||||||
/ Duncan's Home Page / Python for Psion | |||||||||
| |||||||||
|
This is very much a spare time project, so please don't anyone expect too much, but I have been working off and on on a version of Python compiled to run on the Psion Series 5. Python on the 5MXThe version now available for download fixes the problem with running Python.exe directly from the shell on the 5MX. However, I still recommend using E-Shell to start Python.Change history18 August 1999New module EpocTerm exposes some of the internals of the screen interface. You can now move the cursor and select screen attributes. Even the font is selectable (one fixed pitch font at a time only). The screen is zoomable (you can tell I've been copying code from my Nethack port again).New module PyEikon provides the beginnings of some support for standard Eikon classes. The big plus though is that this module is implemented in a DLL (PyEikon.pyd). This module already lets you start another app. Support for .pyd extension DLLs. This makes it possible for anyone with the C++ SDK to extend the Epoc support within Python. N.B. Not all python functions are actually available to DLLs, and the interface isn't quite the same as for other python implementations, but at least it works. Coming soonOther things I am working on:
Features/LimitationsAs yet nothing much Psion specific. Most of the common standard modules exist although there are problems if you try to use some of the functions (reading from a socket seems to be pretty fatal!)In interactive mode you have command line editing with history available. Some special keys: Ctrl-V toggles insert/overwrite mode. Ctrl-Del and Ctrl-Backspace delete words right and left as appropriate, Ctrl-Z and Ctrl-D both do end-of-file, but only if they are typed at the start of a line. Tabs expand to 4 spaces when typing in, but 8 spaces when printed out. Please report any bugs in the line editor as I think it now works. There is no way to directly run a .PY file from the shell. You can use E-Shell or another starter program though. There is no editor for source files. What you can do though, is to use the OPL text editor, and Export as text... when you want to save your work. Note that .PY and .PYC files are identical in format on the Psion to on other platforms (such as NT) so you can download any files which I didn't include in the distribution. The first time you start Python after installing it, it will take several seconds to start. This is because (a) it has to compile several of the library files, and (b) because it is slow compared with a desktop machine. Future runs should start within a couple of seconds. Other features I would like to add, but haven't worked on yet:In rough order of probability/priority:
Known ProblemsSelect module doesn't exist and socket functions mostly don't appear to work (gethostbyname works!)Reading from a socket seems to lock up. No way to abort a Python program while running. SIG_INT isn't implemented and I'm not sure whether it can be. Python is running with a stack size of 64k (it was very interesting trying to run it with the default Psion 8k stack, import site causes a stack overflow on an 8k stack). Stack overflows are not caught. You have been warned. Fortunately any serious Python program is likely to run out of heap long before it runs out of stack. I think the heap is limited to 1Mb at present. If there is enough demand I may make both heap and stack sizes configurable. Environment variables don't do anything useful. System and exec functions don't exist yet (but see the PyEikon module). Please email with any more problems you find. DownloadIf you want to try Python out, and have never used it before, I suggest you download the latest version from www.python.org and get used to the language on something other than the Psion. Even if you have used it before, you will still want another implementation around as I haven't included all of the library sources in the distribution. This is simply because the whole of the lib directory is around 900k, and I'm sure most people won't want all of that (although if you have a decent Flash ROM it probably doesn't matter).This distribution contains Python.exe, a random selection of the library files, and the C runtime library. To install, (assuming you have PsiWin 2.1 or later on your PC), just unzip to get a single .SIS file and run the .SIS file on your PC, or select the appropriate menu options in PsiWin. Python.exe will install in C:\Python (or D: if you choose) with the libraries in a lib subdirectory. Eventually this will all move into \system, but until there is an easier way to run Python you need the .EXE to be readily available. To run it just tap on Python.exe. See above about editing program. | ||||||||