blob: 68b150e3d166434a1c8b913555b97f619d7ec88a [file] [log] [blame]
Jack Jansen5f962c21996-04-10 14:52:59 +00001<HTML>
2<HEAD>
Jack Jansen3412c5d1997-08-27 14:08:22 +00003<TITLE>Using Python 1.5 on the Macintosh</TITLE>
Jack Jansen5f962c21996-04-10 14:52:59 +00004</HEAD>
5<BODY>
Jack Jansen3412c5d1997-08-27 14:08:22 +00006<H1>Using Python 1.5 on the Macintosh</H1>
Jack Jansen5f962c21996-04-10 14:52:59 +00007<HR>
8
Jack Jansenbd9565a1996-04-15 12:25:44 +00009This document is an introduction to using Python on the Apple
10Macintosh. It does not introduce the language itself, for this you
11should refer to the <A
12HREF="http://www.python.org/doc/tut/tut.html">Python Tutorial</A> by
13Guido van Rossum. This guide more-or-less replaces chapter two of the
14tutorial, and provides some additional material. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +000015
Jack Jansen0fb1d821996-11-20 15:13:24 +000016The tutorial, along with other indispensible documentation like the
17library reference and such, is also available in a number of different
18formats at <a href="ftp://ftp.python.org/pub/python/doc">
19ftp://ftp.python.org/pub/python/doc</a>. The Adobe Acrobat <code>.pdf</code>
20files are probably a good choice for reading or printing the documents
21from your mac. <p>
22
Jack Jansen08365421996-04-19 15:56:08 +000023There is currently no good tutorial for the mac-specific features of
24Python, but to whet your appetite: it has interfaces to many MacOS
25toolboxes (quickdraw, sound, quicktime, open scripting, etc) and
26various portable toolboxes are available too (Tk, stdwin, complex
27numbers, image manipulation, etc). Some <A HREF="index.html">
28annotated sample programs</A> are available to give you an idea of
29Python's power. <P>
30
Jack Jansen5f962c21996-04-10 14:52:59 +000031<h2>Invoking the interpreter</h2>
32
Jack Jansenbd9565a1996-04-15 12:25:44 +000033The name of the interpreter may differ on different installations: it
Jack Jansen04d5c581997-10-10 15:50:37 +000034may be called <CODE>PythonFAT</CODE> (for powerpc macs and 68K macs with
35CFM68K installed) or <CODE>Python68K</CODE> (for 68K macs).
Jack Jansen0fb1d821996-11-20 15:13:24 +000036It will always
Jack Jansenbd9565a1996-04-15 12:25:44 +000037be recognizable by the "16 ton" icon, though. You start the
Jack Jansen08365421996-04-19 15:56:08 +000038interpreter in interactive mode by double-clicking its icon: <p>
Jack Jansen5f962c21996-04-10 14:52:59 +000039
40<img src="html.icons/python.gif"><p>
41
Jack Jansenbd9565a1996-04-15 12:25:44 +000042This should give you a text window with an informative version string
43and a prompt, something like the following:
Jack Jansen5f962c21996-04-10 14:52:59 +000044<PRE>
Jack Jansencf70b841998-04-27 15:07:20 +000045Python 1.5.1 (#122 Aug 27, 1997) [CW PPC w/GUSI MSL]
Jack Jansen3412c5d1997-08-27 14:08:22 +000046Copyright 1991-1997 Stichting Mathematisch Centrum, Amsterdam
Jack Jansen5f962c21996-04-10 14:52:59 +000047&gt;&gt;&gt;
48</PRE>
Jack Jansenbd9565a1996-04-15 12:25:44 +000049The version string tells you the version of Python, whether it was
50built for PPC or 68K macs and possibly some options used to build the
51interpreter. If you find a bug or have a question about how the
52interpreter works it is a good idea to include the version information
53in your message. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +000054
Jack Jansenbd9565a1996-04-15 12:25:44 +000055At the prompt you can type interactive python commands. See the
56tutorial for more information. The interactive window works
57more-or-less like a Communication Toolbox or Telnet window: you type
58commands at the bottom and terminate them with the <EM>[return]</EM>
59or <EM>[enter]</EM> key. Interpreter feedback also appears at the
60bottom of the window, and the contents scroll as output is added. You
61can use copy and paste in the normal way, but be sure to paste only at
62the bottom of the document.
Jack Jansen5f962c21996-04-10 14:52:59 +000063
64<h2>Creating Python scripts</h2>
65
Jack Jansenbd9565a1996-04-15 12:25:44 +000066The Python interpreter works in a way that is different from what you
67would expect of a macintosh program: the interpreter is just that: an
68interpreter. There is no builtin editor or other development
69support. Hence, to create a Python script you need an external text
70editor. For a first script you can use any editor that can create
71plain, unstyled text files, such as <CODE>SimpleText</CODE>. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +000072
Jack Jansenbd9565a1996-04-15 12:25:44 +000073For more serious scripts, though, it is advisable to use a programmers
74editor, such as <CODE>BBEdit</CODE> or <CODE>Alpha</CODE>. BBEdit is
75my favorite: it comes in a commercial version but also in a
76fully-functional free version <CODE>BBEdit Lite</CODE>. You can
77download it from the <A HREF="http://www.barebones.com/">BareBones</A>
78site. The free version will probably provide all the functionality
79you will ever need. Besides the standard edit facilities it has
80multi-file searches and many other goodies that can be very handy when
81editing programs. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +000082
Jack Jansenbd9565a1996-04-15 12:25:44 +000083After you have created your script in the editor of your choice you
84drop it on the interpreter. This will start the interpreter executing
85the script, again with a console window in which the output appears
86and in which you can type input if the script requires it. Normally
87the interpreter will close the window and quit as soon as the script
88is done executing, see below under <A HREF="#startup">startup
89options</A> for a way to change this. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +000090
Jack Jansen0fb1d821996-11-20 15:13:24 +000091<blockquote>
92There is a BBEdit extension available that allows you to run Python
93scripts more-or-less straight from your bbedit source window. Check
94out the <code>Mac:Tools:BBPy</code> folder.
95</blockquote>
96
Jack Jansenbd9565a1996-04-15 12:25:44 +000097It is a good idea to have the names of all your scripts end in
98<CODE>.py</CODE>. While this is not necessary for standalone scripts
99it is needed for modules, and it is probably a good idea to start the
100habit now. <p>
101
102If you do not like to start the Python interpreter afresh for each
103edit-run cycle you can use the <CODE>import</CODE> statement and
104<CODE>reload()</CODE> function to speed things up in some cases. Here
105is Guido's original comment for how to do this, from the 1.1 release
106notes: <P>
107
Jack Jansen08365421996-04-19 15:56:08 +0000108<BLOCKQUOTE>
Jack Jansenbd9565a1996-04-15 12:25:44 +0000109
110Make sure the program is a module file (filename must be a Python
111identifier followed by '<CODE>.py</CODE>'). You can then import it
112when you test it for the first time. There are now three
113possibilities: it contains a syntax error; it gets a runtime error
114(unhandled exception); or it runs OK but gives wrong results. (If it
115gives correct results, you are done testing and don't need to read the
116rest of this paragraph. :-) Note that the following is not
117Mac-specific -- it's just that on UNIX it's easier to restart the
118entire script so it's rarely useful. <P>
119
120Recovery from a syntax error is easy: edit the file and import it
121again. <P>
122
123Recovery from wrong output is almost as easy: edit the file and,
124instead of importing it, call the function <CODE>reload()</CODE> with
125the module name as argument (e.g., if your module is called
126<CODE>foo</CODE>, type <CODE>reload(foo)</CODE>). <P>
127
128Recovery from an exception is trickier. Once the syntax is correct, a
129'module' entry is placed in an internal table, and following import
130statements will not re-read the file, even if the module's
131initialization terminated with an error (one reason why this is done
132is so that mutually recursive modules are initialized only once). You
133must therefore force re-reading the module with <CODE>reload()</CODE>,
134however, if this happens the first time you try to import the module,
135the import statement itself has not completed, and your workspace does
136not know the module name (even though the internal table of moduesl
137does!). The trick is to first import the module again, then reload
138it. For instance, <CODE>import foo; reload(foo)</CODE>. Because the
139module object already exists internally, the import statement does not
140attempt to execute the module again -- it just places it in your
Jack Jansen08365421996-04-19 15:56:08 +0000141workspace. </BLOCKQUOTE>
Jack Jansen5f962c21996-04-10 14:52:59 +0000142
143<h2>Clickable python scripts</h2>
144
Jack Jansenbd9565a1996-04-15 12:25:44 +0000145If you create your script with the correct creator and type, creator
146<CODE>'Pyth'</CODE> and type <CODE>'TEXT'</CODE>, you can double-click
147your script and it will automatically invoke the interpreter. If you
148use BBEdit you can tell it about the Python file type by adding it to
149the "file types" sections of the preferences. Then, if you save a file
150for the first time you can tell BBEdit to save the file as a Python
151script through the "options" choice of the save dialog. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000152
Jack Jansenbd9565a1996-04-15 12:25:44 +0000153The <CODE>Scripts</CODE> folder contains a script
154<CODE>fixfiletypes</CODE> that will recursively traverse a folder and
155set the correct creator and type for all files ending in
156<CODE>.py</CODE>. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000157
Jack Jansen08365421996-04-19 15:56:08 +0000158<BLOCKQUOTE>
159Older releases of Python used the creator code
160<CODE>'PYTH'</CODE> in stead of <CODE>'Pyth'</CODE>. If you still have
161older Python sources on your system and named them with
162<CODE>'.py'</CODE> extension the <CODE>fixfiletypes</CODE> script will
163correct them.
164</BLOCKQUOTE>
165
Jack Jansen5f962c21996-04-10 14:52:59 +0000166<h2>Interaction with the user</h2>
167
Jack Jansenbd9565a1996-04-15 12:25:44 +0000168Normally, the interpreter will check for user input (mouse clicks,
169keyboard input) every once in a while, so it is possible to switch to
170other applications while a script runs. It is also possible to
171interrupt the interpreter with the standard command-period keypress,
172this will raise the <CODE>KeyboardInterrupt</CODE> exception. Scripts
173may, however, turn off this behaviour to facilitate their own event
174handling. Such scripts can only be killed with the
175command-option-escape shortcut.
Jack Jansen5f962c21996-04-10 14:52:59 +0000176
177<h2><A NAME="startup">startup options</A></h2>
178
Jack Jansenbd9565a1996-04-15 12:25:44 +0000179If the <EM>option</EM> key is depressed when Python starts executing
180the interpreter will bring up an options dialog thru which you can
181influence the way the interpreter behaves. Keep the option key
182depressed until the dialog comes up. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000183
184<img src="html.icons/options.gif"><p>
185
186The options modify the interpreters behaviour in the following way:
187<ul>
188<li> the interpreter goes to interactive mode (in stead of
189exiting) after a script has terminated normally,
190<li> for every module imported a line is printed telling you where the
191module was loaded from,
Jack Jansen3412c5d1997-08-27 14:08:22 +0000192<li> do not print the values of expressions executed as statements in
193an interactive python (obsolete),
Jack Jansen5f962c21996-04-10 14:52:59 +0000194<li> do not buffer stdout and stderr,
195<li> print some debugging output during the parsing phase,
196<li> keep the output window open when a script terminates.
197</ul>
Jack Jansenbd9565a1996-04-15 12:25:44 +0000198In addition, you can enter a unix-style command line which is passed
199to the script in <CODE>sys.argv</CODE>. Sys.argv[0] is always the name
200of the script being executed, additional values can be passed
201here. Quoting works as expected. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000202
Jack Jansen22fa6421996-09-05 15:15:59 +0000203<BLOCKQUOTE>
204<EM>Warning:</EM> redirecting standard input or standard output in the
205command-line dialog does not work. This is due to circumstances beyond my
206control, hence I cannot say when this will be fixed.
207</BLOCKQUOTE>
208
Jack Jansenbd9565a1996-04-15 12:25:44 +0000209The default options are also settable on a system-wide basis, see the
210section on <A HREF="#preferences">editing preferences</A>. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000211
212<h2>Module search path</h2>
213
Jack Jansenbd9565a1996-04-15 12:25:44 +0000214The module search path, <CODE>sys.path</CODE>, contains the folders
215python will search when you import a module. The path is settable on a
216system-wide basis (see the preferences section), and normally
217comprises the current folder (where the script lives), the
218<CODE>Lib</CODE> folder and some of its subfolders and possibly some
219more. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000220
221<h2>Working folder</h2>
222
Jack Jansenbd9565a1996-04-15 12:25:44 +0000223The unix concept of a <I>working directory</I> does not translate
224directly to a similar concept on the Macintosh. To facilitate easy
225porting and the use of relative pathnames in scripts the interpreter
226simulates a working directory. When a script is started the initial
227working directory is the folder where the script lives. In case of an
228interactive interpreter the working directory is the folder where the
229interpreter lives. <P>
230
231By the way: the "standard file" folder, the folder that is presented
232to the user initially for an <I>open</I> or <I>save</I> dialog, does
233<EM>not</EM> follow the Python working directory. Which folder is
234initially shown to the user is usually one of (a) the application
235folder, (b) the "Documents" folder or (c) the folder most recently
236used for such a dialog (in any Python program). This is standard MacOS
237behaviour, so don't blame Python for it. The exact behaviour is
238settable through a control panel since System 7.5.
Jack Jansen5f962c21996-04-10 14:52:59 +0000239
240<h2>Interactive startup file</h2>
241
Jack Jansenbd9565a1996-04-15 12:25:44 +0000242If the folder containing the interpreter contains a file named
243<CODE>PythonStartup</CODE> this file is executed when you start an
244interactive interpreter. In this file you could import modules you
245often use and other such things. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000246
247
248<h2>Compiled python scripts</h2>
249
Jack Jansenbd9565a1996-04-15 12:25:44 +0000250Once a python module has been imported the interpreter creates a
251compiled version which is stored in a file with the ".py" extension
252replaced by ".pyc". These compiled files, with creator
253<CODE>'Pyth'</CODE> and type <CODE>'PYC '</CODE> load faster when
254imported (because they do not have to be parsed). The <CODE>Lib</CODE>
255folder contains a script <CODE>compileall.py</CODE>, running this
256script will cause all modules along the python search path to be
257precompiled, which will speed up your programs. Compiled files are
258also double-clickable. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000259
260<h2>Python resources</h2>
261
Jack Jansenbd9565a1996-04-15 12:25:44 +0000262MacPython has the ability to collect a number of compiled modules
263together in the resource fork of a single file. This feature is useful
264if you distribute a python program and want to minimize clutter: you
265can put all the needed modules in a single file (which could even be
266the interpreter itself). <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000267
Jack Jansenbd9565a1996-04-15 12:25:44 +0000268If the module search path contains a filename as one of its entries
269(as opposed to a folder name, which is the normal case) this file will
270be searched for a resource with type <CODE>'PYC '</CODE> and a name
271matching the module being imported. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000272
Jack Jansenbd9565a1996-04-15 12:25:44 +0000273The <CODE>scripts</CODE> folder contains a script
274<CODE>PackLibDir</CODE> which will convert a number of modules (or
275possibly a complete subtree full of modules) into such a resource
276file.
Jack Jansen5f962c21996-04-10 14:52:59 +0000277
278<h2><A NAME="preferences">Setting interpreter preferences</A></h2>
279
Jack Jansenbd9565a1996-04-15 12:25:44 +0000280The python interpreter keeps a preferences file in the standard
281location in the system folder. In this preferences file it remembers
282the default module search path and the default settings for the
283runtime options. The preferences are settable via
Jack Jansen3412c5d1997-08-27 14:08:22 +0000284<CODE>EditPythonPrefs</CODE>. For PPC/cfm68k python this is a standalone
Jack Jansenbd9565a1996-04-15 12:25:44 +0000285program living in the main Python folder, for 68K python it is a
Jack Jansen3412c5d1997-08-27 14:08:22 +0000286script in the <CODE>Mac:Scripts</CODE> folder. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000287
Jack Jansenbd9565a1996-04-15 12:25:44 +0000288The interface to edit the preferences is rather clunky for the current
289release. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000290
291<img src="html.icons/preferences.gif"><p>
292
Jack Jansenbd9565a1996-04-15 12:25:44 +0000293In the editable text field at the top you enter the initial module
294search path, using newline as a separator. There are two special
295values you can use here: an initial substring <CODE>$(PYTHON)</CODE>
296will expand to the Python home folder and a value of
297<CODE>$(APPLICATION)</CODE> will expand to the the python application
298itself. Note that the text field may extend "beyond the bottom" even
299though it does not have a scroll bar. Using the arrow keys works,
300though.<p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000301
Jack Jansen04d5c581997-10-10 15:50:37 +0000302The Python home folder $(PYTHON) is initially, when you install Python,
303set to the folder where the interpreter lives. You can change it here. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000304
Jack Jansenbd9565a1996-04-15 12:25:44 +0000305Finally, you can set the default startup options here, through a
306sub-dialog.
Jack Jansen5f962c21996-04-10 14:52:59 +0000307
308<h2>Applets</h2>
309
Jack Jansenbd9565a1996-04-15 12:25:44 +0000310An applet is a fullblown application written in Python, similar to an
311AppleScript applet (and completely different from a Java
Jack Jansen0fb1d821996-11-20 15:13:24 +0000312applet). Applets are currently supported on PowerPC macintoshes and on
31368K macintoshes if you use the CFM68K version of the interpreter,
Jack Jansen3412c5d1997-08-27 14:08:22 +0000314and are created using the <CODE>BuildApplet</CODE> program. You create an
315applet by dropping the python source script onto BuildApplet.
Jack Jansen0fb1d821996-11-20 15:13:24 +0000316<a href="example2.html">Example 2</a> is a more involved applet
Jack Jansenbd9565a1996-04-15 12:25:44 +0000317with its own resource file, etc. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000318
Jack Jansenbd9565a1996-04-15 12:25:44 +0000319Note that while an applet behaves as a fullblown Macintosh application
320it is not self-sufficient, so distributing it to a machine without an
321installed Python interpreter will not work: it needs the shared python
322execution engine <CODE>PythonCore</CODE>, and probably various modules
Jack Jansene2723031996-10-22 15:29:15 +0000323from the Lib and PlugIns folders. Distributing it to a machine that does
Jack Jansen3412c5d1997-08-27 14:08:22 +0000324have a Python system will work. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000325
326<h2>Customizing applets</h2>
327
Jack Jansenbd9565a1996-04-15 12:25:44 +0000328Applets can have their own settings for the startup options and module
329search path. Dropping an applet on the <CODE>EditPythonPrefs</CODE>
330application allows you to set these, in the same way as
331double-clicking EditPythonPrefs allows you to set the system-wide
332defaults. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000333
Jack Jansenbd9565a1996-04-15 12:25:44 +0000334Actually, not only applets but also the interpreter itself can have
335non-default settings for path and options. If you make a copy of the
336interpreter and drop this copy onto EditPythonPrefs you will have an
Jack Jansen0fb1d821996-11-20 15:13:24 +0000337interpreter that has a different set of default settings. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000338
339<h2>Where to go from here</h2>
340
Jack Jansenbd9565a1996-04-15 12:25:44 +0000341The previously mentioned <A
342HREF="http://www.python.org/doc/tut/tut.html">Python Tutorial</A> is
343an excellent place to start reading if you have never used Python
344before. Other documentation such as the library reference manual is
345indexed at the <A HREF="http://www.python.org/doc/">Python
346Documentation</A> page. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000347
Jack Jansenbd9565a1996-04-15 12:25:44 +0000348There are some <A HREF="index.html">annotated sample programs</A>
349available that show some mac-specific issues, like use of various
350toolboxes and creation of Python applets. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000351
Jack Jansencf70b841998-04-27 15:07:20 +0000352The <CODE>Demo</CODE> and <CODE>Mac:Demo</CODE>
Jack Jansen0fb1d821996-11-20 15:13:24 +0000353folders in the Macintosh distribution
Jack Jansenbd9565a1996-04-15 12:25:44 +0000354contains a number of other example programs. Most of these are only
355very lightly documented, but they may help you to understand some
356aspects of using Python. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000357
Jack Jansencf70b841998-04-27 15:07:20 +0000358Finally, there is a <code>Mac:Contrib</code> folder that contains
359a few contributions to Python that I couldn't fit in the normal tree
360but did want to distribute (many other contributions are contained
361throughout the distribution, but you don't see them, really).
362
Jack Jansen5f962c21996-04-10 14:52:59 +0000363The best way to contact fellow Macintosh Python programmers is to join
Jack Jansenbd9565a1996-04-15 12:25:44 +0000364the MacPython Special Interest Group mailing list. Send a message with
365"info" in the body to <A
366HREF="mailto:pythonmac-sig-request@python.org">pythonmac-sig-request@python.org</A>
367or view the <A
368HREF="http://www.python.org/sigs/pythonmac-sig/">Pythonmac SIG
369page</A> on the <A HREF="http://www.python.org">www.python.org</A> WWW
370server. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000371
372<h2>Troubleshooting</h2>
373
Jack Jansene2723031996-10-22 15:29:15 +0000374A rather baffling error message can be "PythonCore not found" when you
375start the interpreter and you are sure that PythonCore is available. The
376message should actually say "Not enough memory in the system heap to
377load PythonCore".
378Blame Apple for the confusing message. <p>
379
Jack Jansen04d5c581997-10-10 15:50:37 +0000380There appear to be problems with QuickTime for the CFM68K version of the
381interpreter. If you experience these please contact the SIG: some people
382use quicktime without problems and some not, and we are still hunting for
383the cause. <p>
384
Jack Jansenbd9565a1996-04-15 12:25:44 +0000385Python is a rather safe language, and hence it should be difficult to
386crash the interpreter of the system with a Python script. There is an
387exception to this rule, though: the modules that interface to the
388system toolboxes (windowing, quickdraw, etc) do very little error
389checking and therefore a misbehaving program using these modules may
390indeed crash the system. Such programs are unfortunately rather
391difficult to debug, since the crash does not generate the standard
392Python stack trace, obviously, and since debugging print statements
393will often interfere with the operation of the program. There is
394little to do about this currently. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000395
Jack Jansenbd9565a1996-04-15 12:25:44 +0000396Probably the most common cause of problems with modules ported from
397other systems is the Mac end-of-line convention. Where unix uses
Jack Jansend9585c91996-05-07 15:28:20 +0000398linefeed, 0x0a, to separate lines the mac uses carriage return,
3990x0d. To complicate matters more a lot of mac programming editors like
Jack Jansenbd9565a1996-04-15 12:25:44 +0000400BBEdit and emacs will work happily with both conventions, so the file
401will appear to be correct in the editor but cause strange errors when
402imported. BBEdit has a popup menu which allows you to inspect (and
403set) the end-of-line convention used in a file. <p>
Jack Jansen5f962c21996-04-10 14:52:59 +0000404
Jack Jansene2723031996-10-22 15:29:15 +0000405Python attempts to keep its preferences file up-to-date even when you
406move the Python folder around, etc. If this fails the effect will be
407that Python cannot start or, worse, that it does work but it cannot find
Jack Jansen3412c5d1997-08-27 14:08:22 +0000408any standard modules. In this case, start Python and examine <code>sys.path</code>.
Jack Jansen0fb1d821996-11-20 15:13:24 +0000409If it is incorrect remove any Python preferences file from the system
Jack Jansene2723031996-10-22 15:29:15 +0000410folder and start the interpreter <em>while the interpreter sits in the main
Jack Jansen3412c5d1997-08-27 14:08:22 +0000411Python folder</em>. This will regenerate the preferences file. You may also
412have to run the ConfigurePython applet again. <p>
Jack Jansene2723031996-10-22 15:29:15 +0000413
Jack Jansencf70b841998-04-27 15:07:20 +0000414<h2>Your five minutes are up. Next!</h2>
Jack Jansen024a3871996-07-18 16:07:05 +0000415
416The next section to check out is the <a href="index.html">annotated sample programs</a>.<p>
417
Jack Jansen5f962c21996-04-10 14:52:59 +0000418<HR>
419<A HREF="http://www.cwi.nl/~jack">Jack Jansen</A>,
Jack Jansencf70b841998-04-27 15:07:20 +0000420<A HREF="mailto:jack@cwi.nl">jack@cwi.nl</A>, 27-Apr-98.
Jack Jansen5f962c21996-04-10 14:52:59 +0000421
422</BODY>
423</HTML>