What is Python?

Python is an open source interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for rapid application development, as well as for use as a scripting or glue language to connect existing components together. Python's simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse.

The main Python homepage is at

What is AmigaPython?

Python is developed mainly for the Unix platform. Because the full source code is available, ports to many other platforms exist nowadays. These include Macintosh, Windows and AmigaOS of course! AmigaPython is the Python version for AmigaOS. Not only is it largely compatible with the 'mainstream' Unix Python version, but it is also a real Amiga program by adding some exciting Amiga features to it:-

  • Workbench support - you can launch the interpreter, the scripts, and data files linked to Python scripts from Workbench (not currently working in alpha release of 2.3.3)
  • ARexx support - connect to your favorite ARexx enabled Amiga application. Script them with Python instead of ARexx.
  • AmigaOS extensions - write powerful Python scripts able to perform many Amiga-specific tricks with the system and your files

I intend to make sure that at the very least all of the examples in O'Reilly's Learning Python will work, so please consider buying that book by clicking the Amazon link in the sidebar.

What's New in alpha release 2?

  • XML (pyexpat) support working
  • bzip2 and zlib (zip) support
  • socket module for Internet access works
  • Uses ieee math libraries instead of FPU only ones
  • More complete amiga and amigapath modules, fixing st_size bug amongst others


Don't forget to Save Target As... or equivalent, modern servers and browsers don't always know .lha means binary!

Commercial and Copyright

AmigaPython and this website are:
Copyright (C) 2005 Tim Ocock, Copyright (C) Irmen de Jong (used with permission).

For license terms, see the front page of my Amiga section, here

Python was originally ported to the Amiga by Irmen de Jong. He did a great job adding Amiga specific functionality, including ARexx support (allowing you to use Python as an alternative to ARexx amongst other things!). However, Irmen no longer has an Amiga and requested someone take on the project on his original website here

I (Tim Ocock) took on the challenge, since I wanted to refresh my memory of Amiga programming, give something to the Amiga community that has held on for so long, and because I seem to be one of the few people with the SAS/C compiler that Irmen used (I bought one of the last sets, the binderless ones they sold at great discount). Irmen gave me some useful advice and support, and permission to continue his work and incorporate his original website in my own.

Python is free but please support my Amiga software development in general. You can do that in a number of ways:

  • Make a donation using your credit card or Paypal account by clicking the Paypal button over on the left
  • Purchase items from Amazon by following the links on the left - I have directly linked to the O'Reilly book "Learning Python" which I can recommend. I will be using this book as part of the testing of AmigaPython so almost all of the examples should work.
  • Send free versions of your commercial/shareware Amiga software

You can contact me here

What's new in AmigaPython 2.3.3?

Integrated Irmen de Jong's AmigaPython 2.0 source with the generic Python 2.3.3 source. Fixed a few bugs and added support for 2.3.3 to the Amiga modules.

You can find out what's new in Python 2.3.3 at the main Python website here. The examples there all work.

Currently it is compiled it with SAS/C 6.58 for the 68020 CPU, and AmigaOS 3.0 or higher with AmiTCP/Genesis and 2MB of memory. I think this is a fair baseline these days. The full source code is available so in theory you could build a 68000 OS 2.04 version with no networking. But permission is not granted to release your own builds - instead send them to me.

AmigaPython and AmigaOS4

Python is designed to fill the niche between shell scripts and full on programs - and it does it very well - but not as well perhaps as ARexx, since it needs 10x as much memory. However, on today's computers that's not so much of a concern. Thus it would suit OS4 quite well as an alternative to ARexx, especially since AmigaPython already supports ARexx. I understand Hyperion have previously considered and dismissed Python, for the time being, as they have more than enough to do, so I don't blame them at all.

I am hoping that a 68K to OS4 cross compiler will be released sooner rather than later. I am unlikely to be able to justify getting an OS4 capable computer for the foreseeable future. But I'd like to be able to build a version for all those who have supported Hyperion. The sad truth is that there won't be any native software for AmigaOne owners unless someone makes it easy to develop for, and that means making tools and documentation available to all.

If you want to see native software on OS4, please consider making a donation to this project, using the Paypal link in the menu, and to other projects that you would like to see on OS4.

Known Problems

  • Unicode support is broken
  • Help command is broken - this is to do with the docs not being available. I took them out because I figured you didn't want tex versions and other unfriendly formats taking up precious disk space. I intend to convert the html docs to AmigaGuide at some point.
  • Loading scripts from command line arguments is broken, so import runtest then runtest.dotest() to try the test suite
  • Python is fussy about the use of tabs and spaces and indentation. Actually this isn't a bug, but may catch you out.

Don't forget to assign Python: to your python directory first!!

Check the distribution for a more detailed ToDo list and FAQ


I will make a Beta release when the test suite completes without anything other than errors due to modules not available on the Amiga. At this stage I will complete testing of the examples from the book, and begin to fix any problems I find there.

The final release will then be made when all the examples from the book are working, and I have integrated the documentation to provide online help. Only after this will I begin work on support for Tkinter GUIs.

I will also be using the RSS module to test the interpret, as I would very much like to provide RSS news reading on the Amiga.


Python isn't very Amiga like in the way it integrates with it's host system. It's basically one huge executable and each Python program needs it's own instance of the interpreter. Most of that 1MB file size is taken up by the builtin function modules which are statically linked. On Unix systems, they can be dynamically loaded using the dlopen() which is a very inelegant way of using MMUs to have a virtual contiguous address space. Apparently this might be available in OS4, but it's not very efficient. A much better approach would be one that allows Python to be a resource shared across the system, like ARexx, but I don't know how possible that will be. Ideally I would like the following:

  • Make Python a system server, like RexxMast
  • Add support for threads
  • Dynamic loading of modules written in C
  • Implement TclTk GUI to support Python Tkinter GUIs
  • I have also had requests to support pygame and pyone.

AmigaPython Example: 'finger' for ARexx

Enough talk. Let's see some Python to give you an idea. Note that this example is for AmigaPython only because it uses the ARexx extension!

A finger tool for ARexx - just like the 'finger' command you know to find out about a user. Is it possible? YES! First let's make a ARexx host in Python which provides us with a FINGER ARexx command. Here is the source:

# Python interface to the Internet finger daemon.

import sys, string
import socket
import ARexx


def finger(host, args):
print host,args
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(host, FINGER_PORT)
s.send(args + '\n')
while 1:
---buf = s.recv(1024)
---if not buf: break
---return reply

# The function to handle the arexx commands,
def cmd_dispatcher(host,msg,cmd,args):
---if cmd=='FINGER':

except socket.error,string:
---return 1
print 'The ARexx port name is ',

(N.B. In Python, indentation matters. Thanks to the limits of HTML, the above code doesn't show the correct indentation. When copying, remember to add 3 blank spaces in place of --- )

We have an interface to the finger daemon in Python, and a full-fledged ARexx host which provides us with two commands: HELP and FINGER. The last line ( activates the message loop which will handle all commands until you press CTRL-C. HELP is a default command which is provided by the class for you, including a simple implementation. I defined the FINGER command with arguments:-

The hostname to finger is necessary while the user name may be omitted (it defaults to the empty string). Now, let's see how we can access this ARexx host when it's running:

/* Finger client in ARexx */
options results

address 'PYTHON' /* fill in your port name here */

say 'FINGER @localhost...'
FINGER 'localhost'

say 'FINGER root@localhost...'
FINGER 'localhost root'

say 'The help string on the FINGER command is:' RESULT

if RC=0 then do
else do
say 'An error occured for HELP BOGUSCOMMAND:' RC2

Voila! Of course you could now use AmigaPython's ARexx capabilities to write another Python script which duplicates this ARexx script's behavior and calls the ARexx host (AmigaPython running the Python script above in another shell), effectively using ARexx as an interprocess communication layer. I'll leave this as an exercise to the reader.

Amiga specific extensions

Currently there are a number of Amiga specific extensions to the 'core' Python:
  • ARexx support modules
  • Dos library support modules
  • Workbench support
  • Enhanced environment variables control
  • Miscellaneous Amiga enhancements

Of course, time permitted, as AmigaPython evolves this list may grow! Suggestions are welcome. For GUI support, I would rather implement Tk or wxWindows than do something Amiga specific, but that is a lot of work. I suggest using AWNPipe for GUI's for now.

ARexx Module

AmigaPython includes very powerful ARexx support. Irmen added a low-level builtin module ( ARexxll ) and a high-level module (ARexx , written in Python). You're able to add an ARexx port to your Python programs in no-time, and you're also able to control other applications from Python by sending them ARexx commands to their ARexx port. The ARexx module implements:

  • port class (generic ARexx port root class)
  • privateport class (private ARexx port for sending messages only)
  • publicport class (public ARexx port to receive commands on)
  • host class (full-featured ARexx host class, including powerful command parser and dispatcher)
  • wrapper functions for easy ARexx message sending
  • DOS Library Module

    For more powerful operation under AmigaDOS, and because it is needed for the ARexx implementation, there are two additional modules. The first is the low-level builtin module Doslib, and the other, the Dos module, is written on top of it (in Python). They work together much the same as the strop and string modules do: you don't use the builtin one directy but rather the higher-level module. So, you will only need to use the Dos module which provides the following:

    • set of AmigaDOS specific functions, like Relabel, Examine, SetComment, SetFileDate, etc.
    • functions for waiting on and checking of AmigaDOS signal flags
      definition of a set of AmigaDOS flags (break signals, file protection bits etc.)
    • higher level wrapper and utility functions like touch, AssignAdd, etc.
    • ArgParser class. This is an argument string parser to parse strings according to a template as understood by the standard AmigaDOS ReadArgs function. The ARexx module uses it for parsing the ARexx command arguments. This is actually a very powerful class!

    Workbench Support

    Of course AmigaPython supports the Workbench. You can:

    • launch AmigaPython from the Workbench
    • launch Python scripts from the Workbench (icons are provided)
    • associate Python scripts as tools to data files! This is cool!

    And as you might expect: tooltypes and multi-selected icons are converted to command line arguments. Python never knows it was launched from the Workbench!

    Enhanced Environment Variables

    For total control and flexibility there is a module ( environment ) that implements various functions to control your environment variables from within Python. AmigaPython discriminates between Global environment variables (in ENV:)  and Local environment variables (shell-local). You're able to read, write and update both types of variables. For portability, os.environ contains both types.

    Miscellaneous Amiga Enhancements

    Finally there are some small enhancements scattered throughout the program, but mostly in the amiga module. For instance, there is a very fast CRC-32 checksum function. In the select module, there is an enhanced version of the select function. The AmigaPython version is able to wait not only on network events, but also on DOS signals, with or without a timeout!

    The current release is: 2.3.3 build 2 (alpha release)  

    Previous releases are available on Aminet:

    Python 2.0, build 1, released October 29, 2000. Features include:
    Based on the 2.0 final Python source
    AREXX support: ARexx module
    Direct AmigaDOS support: Dos module
    Workbench support (accepts Workbench icon tooltypes, arguments and scripts)
    Other Amiga specific enhancements
    First fully Unicode aware AmigaDOS application (as far as I know)
    Contains fast XML parser (Expat)
    Documentation for Amiga features

    Python 1.6, build 1

    Python 1.5.2, build 5

    Known Bugs and Problems in older releases

    For the 1.5.x and 1.6 versions, currently no bugs or problems are known.

    The 2.0 version appears to have some stack related problem which seems fixed by using a BIG stack (400Kb+). (Fixed in 2.3.3)