1 How to install Python 2.2b2 on your Macintosh
2 ---------------------------------------------
4 This is a MacPython that can run on classic MacOS (from 8.1
5 onwards) and natively on MacOSX. The installer tries to work out whether you can
6 use the Carbon version or not.
8 You should definitely read the Relnotes file too, and the section below about
9 toolbox module reorganization. You should also read :Misc:NEWS, which lists
10 the general (non-mac-dependent) new features of this Python release.
12 A special note about the active installer: do not background it, it may hang
13 your machine. This is a general problem with Vise active installers, MindVision
18 If this is your first encounter with Python: you definitely need the
19 common user documentation (common to all platforms). You can find this
20 (in various forms) on www.pythonlabs.com, www.python.org and
21 ftp.python.org. Through there, or via
22 http://www.cwi.nl/~jack/macpython.html you can also find the most recent
23 MacPython distribution.
25 Mac-specific documentation is included in this distribution in folder
26 Mac:Demo. The documentation is sparse, but it will have to serve for
27 now. The documentation is in HTML format, start with index.html.
29 This installer installs MacPython for classic PPC MacOS, MacPython for Carbon
30 (OS X, OS 9 or OS8 with CarbonLib installed) or both, depending on your
31 configuration. By selecting custom install you can bypass these tests and
32 install what you want.
34 If you want 68k support you will have to stay with MacPython 1.5.2.
36 Toolbox module reorganization and more
37 --------------------------------------
39 You can safely skip this section if this is your first encounter with MacPython.
41 I am working on a new organization of the mac-specific modules, and in
42 general bringing the MacPython folder structure more in line with
43 unix-Python. This is not only a good idea, it will also immensely
44 facilitate moving MacPython functionality to an OSX Python that is based
45 on Mach-O and the unix-Python distribution. But don't worry: MacPython
46 is definitely not dead yet, and the hope is that the transition will be
47 as seamless as possible.
49 First a change that should not cause too much concern: :Mac:Plugins has
50 gone, and most of the dynamically loaded modules have moved to
53 Second, and more important: the toolbox modules, such as Res and
54 Resource, have moved to a Carbon package. So, in stead of "import Res"
55 you should now say "from Carbon import Res" and in stead of "from Res
56 import *" you should use "from Carbon.Res import *". For the lifetime of
57 MacPython 2.2 there is a folder :Mac:Lib:lib-compat on sys.path that
58 contains modules with the old names which imports the new names after
61 Note that although the package is called Carbon the modules work fine under
62 classic PPC, and they are normal classic modules. Also note that some
63 modules you may think of as toolbox modules (such as Waste) really are not,
64 and they are not in the Carbon package.
66 Another change related to the OSX growth path is that there is a new module
67 macresource that you can use to easily open a resource file accompanying your
68 script. Use "macresource.need("DLOG", MY_DIALOG_ID, "name.rsrc") and if the
69 given resource is not available (it _is_ available if your script has been
70 turned into an applet) the given resource file will be opened. This method will
71 eventually also contain the magic needed to open the resource file on
74 Another feature to help with the OSX transition is that if you open a
75 textfile for reading MacPython will now accept either unix linefeeds
76 (LF, '\n') or Macintosh linefeeds (CR, '\r') and present both of them
77 as '\n'. This is done on a low level, so it works for files opened by
78 scripts as well as for your scripts and modules itself. This can be
79 turned off with a preference/startup option.
82 - this works only for input, and there's no way to find out what the original
83 linefeed convention of the file was.
84 - Windows \r\n linefeeds are not supported and get turned into \n\n.
89 The optional parts in this distribution are
90 - TK+PIL: Tkinter and support modules, plus Imaging, the Python image
91 manipulation package (allows you to read, write and display images and
92 do lots of operations on them).
93 For Carbon MacPython you only get PIL: there is no Tcl/Tk for Carbon yet.
94 This is the reason Classic MacPython is also installed on MacOSX: it
95 allows you to run Tkinter applications, albeit in the Classic box.
96 - img: another imaging package. Has more file format support and is faster
97 than imaging, but has only limited operations on images. There is a bridge
99 - Numeric: the LLNL Numeric Python extension. All sorts of nifty operations
100 on matrices and such. This is the most recent version from the
102 Numeric has moved from Extensions to :Lib:site-python, by the way,
103 see the release notes.
104 - Developers kit: all header files and some tools and sample projects
105 to get you started on writing Python extensions if you have CodeWarrior.
106 All these except the DevKit are installed with Easy Install.
108 After the installer finishes it automatically launches the appropriate
109 ConfigurePython applet, to finish configuration of your Python. If you
110 run MacOS9 or later (or 8 with CarbonLib installed) you can switch
111 back and forth between the classic and Carbon versions of Python by
112 running either ConfigurePythonClassic or ConfigurePythonCarbon.
114 Moving your Python installation after installing is generally not a
115 good idea. If you have to do this anyway you should remove your
116 preference file, run ConfigurePython and remove all .pyc
117 files. (there's a script zappyc.py that does the latter).
119 If you don't have enough memory: the sizes choosen are somewhat
120 arbitrary, and they are as high as they are so that test.autotest runs
121 with fewer problems. An average Python program can make do with much
122 less memory. Try lowering the application sizes in the finder "get
123 info" window, and seeing whether the resulting python is still usable.
128 It is probably a good idea to run the automatic tests. Start
129 Python and "import test.regrtest ; test.regrtest.main()".
131 test_frozen will fail in MacPython because of different handling on
132 frozen modules. This should not be a problem in normal use.
134 test_time will fail because MacPython accepts bogus values for
135 mktime(), this will be fixed later (it is not a very serious problem).
137 Three tests will fail on MacOS9 with MemoryErrors:
138 test_longexp, test_sha and test_zlib (on MacOSX these should pass).
140 If you increase the PythonInterpreter memory partition size they will
141 pass (but for longexp you have to increase it by an incredible amount,
142 400MB is rumoured). It will, however, print some messages about
143 optional features not supported. You should not worry about these,
144 they are modules that are supported by Python on other
145 platforms. Also, if you didn't run compileall before autotesting you
146 may run out of memory the first time you run the tests. test_socket
147 may also fail if you have no internet connection. Please also read the
148 Relnotes file for other minor problems with this distribution.
150 Using Python is most easily done from the IDE, which has a builtin
151 editor, debugger and other goodies. The alternative is to use
152 PythonInterpreter, which is the lowlevel interpreter with a
153 console-window only (similar to Unix Python).
155 If your program uses Tkinter you MUST run it under PythonInterpreter,
156 Tkinter and IDE are incompatible and your program will fail in strange
162 Two items are installed in the system folder: the interpreter shared
163 libraries PythonCore and PythonCoreCarbon lives in the Extensions
164 folder and the "Python 2.2b2 Preferences" file in the Python subfolder
165 in the Preferences folder. All the rest of Python lives in the folder
168 On OSX the libraries are installed in /Library/CFMSupport. There is a
169 nasty bug in OSX that is triggered by Python: if any orphaned aliases
170 are left in /Library/CFMSupport your machine will start to behave very
171 badly. 2.1 beta installers triggered this problem if you simply threw
172 away your Python folder, so if you installed a 2.1beta you should
173 clean out the aliases in /Library/CFMSupport too. The final 2.1 and
174 2.1.1 installers always copied the shared libraries on OSX, so it does
175 not have the problem anymore.
180 Start off at Mac:Demo:index.html. Read at least the first few sections.
182 There are also some interesting files in the "Relnotes" folder that may
183 contain useful information. There is also a first stab at documentation
184 (plus examples) in the Mac:Demo folder. The toplevel Demo folder has
185 machine-independent demos.
186 The Mac:Lib:test folder also has some programs that show simple
187 capabilities of various modules.
189 The ":Mac:scripts" folder has some sample scripts. Some are useful,
190 some are just interesting to look at to see how various things
191 work. The MkDistr, mkapplet and fullbuild scripts (plus the ones
192 mentioned above) may help you to understand how to use AppleEvents and
193 various other toolboxes from python.
195 Other mac-specific goodies can be found in :Mac:Tools, of which the
196 IDE sources and a CGI framework deserve special mention.
198 The 'img' group of modules, which handles I/O of many different image
199 formats is included, but without documentation. You can find docs at
200 ftp://ftp.cwi.nl/pub/jack/python/img (or somewhere around there).
202 Finally there is a Mac:Contrib folder which contains some contributed
205 Upgrading from older Python releases
206 ------------------------------------
208 Python releases are independent of each other, with separate
209 Preferences files, shared library names, etc. The good news is that
210 this means you can keep your older version around if you are unsure
211 whether to upgrade. The bad news is that your old preference settings
212 are lost and you have to set them again.
214 After you are satisfied that 2.2b2 works as expected you can trash
215 anything in the system folder that has "python" in the name and not
218 The ConfigurePython... applets will try to detect incompatible
219 preferences files and offer to remove them. This means that re-running
220 ConfigurePython after a second install of the same MacPython version
221 (or after moving the Python folder) should fix things up correctly.
226 The installer for this product was created using Installer VISE
227 from MindVision Software. For more information on Installer VISE,
230 7201 North 7th Street
231 Lincoln, NE 68521-8913
234 Internet: mindvision@mindvision.com
235 http://www.mindvision.com
237 Just van Rossum <just@letterror.nl> created the initial version of the
238 installer (with Installer Vise Lite), and Jack worked from there.
243 Thanks go to the whole Python community with Guido in the lead, of
244 course. Mac-specific thanks go to the pythonmac-sig, Just van Rossum,
245 Corran Webster, Tony Ingraldi, Erik van Blokland, Bill Bedford, Chris
246 Stern, Gordon Worley, Oliver Steele, M. Papillon, Steven Majewski, David
247 Goodger, Chris Barker, Luc Lefebvre, Tattoo Mabonzo K., Russell Finn,
248 Tom Bridgman, Russel Owen, Pascal Oberndoerfer, Dean Draayer,
249 Alexandre Parenteau, Donovan Preston
250 and all the other people who provided feedback, code or both!
252 MacPython includes waste, a TextEdit replacement which is (c) 1998
255 A special mention is deserved by Matthias Neeracher, who has written
256 the brilliant unix-compatible GUSI I/O library, without which
257 MacPython would not have sockets or select, and to Alexandre
258 Parenteau, who has ported this library to Carbon.
263 Send bug reports, suggestions, contributions and fanmail to
264 <jack@cwi.nl>. However, a better way to discuss MacPython is to join the
265 <pythonmac-sig@python.org> mailing list, which is explicitly meant for
270 Oratrix Development BV
275 <jack@cwi.nl>, http://www.cwi.nl/~jack