====== What is Python? ====== [[http://www.python.org/|Python]] is a **[[wp>Script_language|script language]]** for computer. {{gallery> :en:dev:python:build_python_2x_3x.jpg?160x120&direct}} This means is strongly dedicated to developers. But an advantage of Python is to be relatively easy, like the Basic, to understand and use it. But it can be also used in a more complex and powerfull way, with it's Oriented Object Programing (OOP) paradigm. Python has been seriously known with its version 1.5. Now latest one is the 3.x serie (last revision is 3.1.1). Python is one of my first biggest project made for MorphOS. I've started in the end of 2003 and I continue to support it. MorphOS port has been a long a difficult port, my most difficult one to be honest! It's mainly due to the fact Python uses globals variables and this kind of variables is the most difficult things to support with AmigaOS libraries.\\ But I've prove that it's possible ;-)\\ ...Event dynamics modules is supported! But sure, some limitations exists. I'll make a page about that someday. On last thing to know about the port: it's a **native** port, so AmigaOS path is supported, not posix! This can be lead to some headhaches if you attemps to use posix designed external third-parties! Python on MorphOS is currently only available on 2.x serie. But I'm working on 3.x (3.1.1) and a release is comming soon! ====== Versions ====== ===== 3.x Serie ===== **[[en:dev:python:rel3x:start|Continue on the 3.x Serie page]]** (In development... please wait ;-)) The latest one, but carefully here: strong modifications in the language and API!\\ The most known: ''print'' is now a function! print("Hello World!") ===== 2.x Serie ===== **[[en:dev:python:rel2x:start|Continue on the 2.x Serie page]]** The most used version of Python used in the World! This serie is ported since 7 years on MorphOS now. It could be used for a wide range of projects.\\ I'm using this one for my own projects: [[..:pymui:start|PyMUI]] and [[..:gribouillis:start|Gribouillis]]. ====== General Information ====== ===== Installation ===== //**Note: following text only applies on versions > 2.5.4. Previous versions are not longer supported.\\ \\ IMPORTANT: for users of 2.5.4 -r42 and before: delete ''LIBS:python.library'' (replaced by a new library name) and update immediately your system. All compiled dynamics python modules (*.pym) shall be rebuilt with the new SDK also. **// - Download the wanted version archive (see for each serie section **Downloads**), and put it for example in ''RAM:''. - Uncompresse and unarchive this file using following Shell command:\\ XADUnTar RAM:pythonarchiveXXX.tar.bz2 RAM: - A new directory named ''Python-X.Y.Z-N'' is created. From this last, copy contents of: * ''C'' to ''C:''. * ''Libs'' to ''Libs:''. * ((only for ones have installed the MorphOS developing environment)) ''DevEnv'' to ''usr:local''. ===== Quick Startup ===== The Python interpretor **''pythonX.Y''**((don't forget to change X.Y by the version number)) installed in ''C:'' can be executed from any MorphOS Shell consoles. Note that for 2.x, the copy is also found as ''python'', this one is used by 2.x compatible scripts.\\ To know pathnames from where Python is searching for scripts imported by command ''import'', you can type following Shell command in a console: pythonX.Y -c "import sys; print(sys.path)" //Notes: this code works on 2.x and 3.x.// By default, the following pathname((others with less importance are also added)) is used: ''LIBS:pythonX.Y'', where X and Y corresponding to same values as the archive's name in chapter [[#Installation|Installation]].