blob: 5eb8fec9fb81b785bcf796b63bf174701a4895e2 [file] [log] [blame]
Jack Jansen7701fd91997-05-28 12:01:14 +00001This file contains the release notes of older MacPython versions.
2
3 Changes between 1.4 and 1.3.3
4 -------------------------------
5
6Aside from all the changes Guido made to the machine-independent part
7of Python (see NEWS for those)the following mac-specific changes have
8been made:
9
10- Preference file and other items in the System folder now have the
11 version number in their name, so old and new python installations
12 can coexist.
13- Fixed a GUSI crash when exiting with files open.
14- Fixed interference with some extensions that added resources that
15 looked like ours.
16- Fixed slowness of Python in the background.
17- About box added (at last...).
18- New release of CWGUSI (1.8.0) incorporated. Note that for Tcl/Tk the
19 4.1p1 release is still used (4.2 was a little too late). Everything
20 ported to CW10.
21- Applets can now turn off argc/argv processing (so they can do their
22 own initial AppleEvent handling). Applets can also delay opening the
23 console window until it is actually used (and, hence, not open it at
24 all by refraining from using it).
25- MiniAEFrame: Preliminary AppleScript server support. Example code
26 provided, including an initial stab at writing CGI scripts in Python.
27- macfs: FindApplication() locates application given 4-char creator
28 code.
29- macfs: GetDates and SetDates get and set creation date, etc.
30- FrameWork: preferred method of ending mainloop() is calling _quit().
31- FrameWork: different menubar handling resulting in less flashing
32 during menu creation.
33- FrameWork: added setarrowcursor and setwatchcursor functions.
34- findertools: new module that makes various finder features
35 available.
36- macostools: copy file times too.
37- macostools: added touch() to tell finder about changes to a file.
38- macerrors: New module with symbolic names for all os-releated
39 errors.
40- EasyDialogs: ProgressBar fixed.
41- aetools: start application if needed
42- aetools: use aetools.error for server-generated errors, MacOS.error
43 for communication errors, etc.
44- Finder_7_0_Suite: New module with the "simple" finder scripting
45 interface.
46- mac (aka os): xstat() returns resourcesize, creator, type in
47 addition to stat() information.
48- MacOS: added DebugStr method to drop to low-level debugger.
49- MacOS: fixed splash() to actually draw the splash box:-)
50- Ctl: fixed very nasty bug in DisposeControl and object deletion.
51- Dlg: Added GetDialogWindow and other accessor functions
52- Waste: fixed bug with object hanlder installation
53- Waste: added tab support
54- time: added strftime
55- twit: a windowing debugger for Python (preliminary release)
56- BBPy: a BBEdit extension that send scripts to the Python interpreter,
57 by Just van Rossum.
58
59The following set of changes were already in place for the 1.4b3
60release:
61- The standard 68K Python is built for CFM68K. This means that PPC and
62 68K Python are now largely compatible, both supporting dynamically
63 loaded modules, python applets, etc.
64 As a result of this there have been numerous subtle changes in
65 filenames for PPC plugin modules and such, but these changes should
66 be transparent to Python programs.
67 The one missing module in cfm68k is Macspeech, for which no CFM68K
68 interface library is available (yet?).
69- Raise MemoryError on stack overflow.
70- Python now always uses 8-byte doubles.
71- Removed mactcp, macdnr and stdwin modules from standard
72 distribution.
73- New releases of Tcl/Tk (4.1p1), CWGUSI (1.7.2) and Waste (1.2f) have
74 been incorporated.
75- Macfs.SetFolder method added, which sets initial folder for standard
76 file dialogs.
77- New py_resource module to handle PYC resources.
78- List mgr objects "selFlags" and "listFlags" members now accessible.
79- QuickDraw got a few new symbolic constants.
80- Qt and Cm modules now live in a separate dynamically loadable
81 module, so other toolbox modules work if you don't have QuickTime
82 installed.
83- Old sound mgr calls {Set,Get}SoundVol removed, version number
84 interface changed.
85- Added convenience routines setarrowcursor and setwatchcursor to
86 FrameWork.
87- Bugfixes to time.sleep(), FrameWork, macostools,
88- Minor fixes/additions/updates to demos and documentation in the Demo
89 folder.
90- Internal changes:
91 - Ported to CW9
92 - mwerks_????_config.h organization rationalized
93 - Projects renamed to reflect architecture (ppc, cfm68k, 68k).
94 - various defines (HAVE_CONFIG_H, USE_MAC_DYNAMIC_LOADING) no longer
95 needed.
96 - shared-library architecture made more conforming to metrowerks
97 documentation. Check xx plugin projects if you have built your own
98 dynamically loaded modules.
99
100
101 Changes between 1.3.3 and 1.3.2
102 --------------------------------
103
104A major change since 1.3.2 is in the organization of the files: The
105Mac folder has mac-specific demo programs, attempts at documentation and
106more. Browse the HTML files in Mac:Demo for more info.
107
108Also, Toolbox:bgen is not needed anymore for normal use: the relevant
109python modules have been moved to Mac:Lib:toolbox.
110
111Other changes:
112- Uses final Tk 4.1 and Tcl 7.5 distributions.
113- Override preferences (stored in the interpreter/applet application)
114 allow overriding of system-wide preferences. Explained in
115 "using.html".
116- New functionality in FrameWork.py:
117 - ScrolledWindow class
118 - enable(), settext(), setitem(), setmark(), seticon(),
119 checkmenu() and delete() methods for menu entries.
120 - event parameter added to idle() method
121 - windowbounds() function helps programmer with staggering windows.
122 - Erase only visRgn on an update event.
123- TextEdit interface module added
124- Waste interface module added
125- Demos for waste, including skeleton for html editor
126- Scrap manager interface added
127- Ctl.FindControl() could return reference to deleted object. Fixed.
128- GrafPorts have an _id attribute (address of grafport) allowing them
129 to be compared (since a new python object is created each time).
130- Standard File folder no longer changed on chdir() (this was
131 introduced in 1.3.2).
132- sys.argv can now be set if you option-drag or option-click a python
133 source.
134- Various dialogs now have sensible defaults.
135- binhextree is now a bit more intelligent about when to binhex.
136- gensuitemodule fixed to hand '****' type arguments.
137
138 Changes between 1.3.2 and 1.3.1
139 -------------------------------
140
141The main reason for the 1.3.2 distribution is the availability of Tk
142for the mac. The Tk port and its integration in Python is definitely
143not bug-free, hence this distribution should be treated as beta
144software at best.
145
146Another major change in this release is that the Python I/O system is
147now based on the GUSI library. This is an I/O library that attempts to
148mimic a Posix I/O system. Hence, modules like socket and select are
149now available in MacPython. If you build dynamically loaded modules
150and you use any unix-like feature such as stat() calls you should
151compile using the GUSI include files.
152
153A third major change is that the MacOS creator code has been changed
154from 'PYTH' to 'Pyth', due to a conflict. This means that you will
155have to change the creator of all your old python programs. The
156distribution contains a script "FixCreator.py" that does this
157recursively for a whole folder.
158
159Here are all the changes since 1.3.1, in no particular order:
160- complex number support added
161- cmath module added
162- startup options ("option-drag" dialog) can be retrieved from the
163 preferences file. EditPythonPrefs hasn't been updated yet, though.
164- Creator changed from PYTH to Pyth
165- {mac,os}.unlink is now also called {mac,os}.remove
166- {mac,os}.mkdir second arg optional
167- dup and fdopen calls added
168- select module added
169- socket module added
170- open(file, '*r') for opening resource forks has been removed. It is
171 replaced by MacOS.openrf(file, 'r'), which returns a simple
172 file-like object to read (or write) resource forks.
173- Added AppleEvent URL suite
174- Added AppleEvent netscape suite
175- QuickDraw globals are now all accessible, as Qd.qd.xxxx
176
177
178 Mac-specific changes between 1.3 and 1.3.1
179 --------------------------------------
180
181Aside from the changes mentioned here there have also been some
182changes in the core python, but these are not documented here.
183However, these changes are mainly bugfixes, so there shouldn't be any
184incompatabilities.
185
186- imgsgi and imgpbm modules added
187- Various hooks installed to allow integration with MacTk (currently
188 disabled)
189- Added support for MacOS Fixed type in toolbox arguments (represented
190 as floats in python)
191- Added option to keep output window open on normal termination
192- Decreased minimum heapsize to run interpreter
193- Added progress-bar to EasyDialogs
194- Fixed socket.getportname()
195- Renamed MACTCP.py to MACTCPconst.py
196
197- Many fixes to FrameWork.py:
198 - Added window.SetPort() method
199 - Added optional bounds and resid parameters to Window.open()
200 - Fixed apple-menu DA handling
201 - Fixed activate-event handling
202 - Added default Application.makeusermenus() (File:Quit only)
203 - Fixed bug with keyboard input handling
204 - added idle() method, called from event loop if there are no events
205 pending
206
207Toolbox modules:
208- component manager module added
209- quicktime module added
210- font manager module added
211- Added color window support
212- Added support to obtain pixmap from a window
213- Added BitMap type
214- Added GrafPort type
215- Added support for PenState, Patterns, FontInfo, RGB colors,
216- Fixed GetPen and SetPt arguments
217- Added read access to members of {C}GrafPort objects
218- Added support for cursors
219- Provide access to some QuickDraw globals
220- Fixed InsetRect, OffsetRect, MapRect
221- Added support for various handles such as PatHandle, CursHandle
222- Added functions to access members of Window objects
223
224
225
226 Changes since 1.3beta3
227 ----------------------
228- MkPluginAliases.py now works in a virgin distribution environment. It is
229 also distributed as an applet.
230- hexbin from binhex.py has been fixed
231- various bits and pieces in readme files clarified
232- mkapplet bug wrt owner resource (and, hence, trouble starting applets) fixed.
233- Compiled with CodeWarrior 7.
234- AE client modules generated with gensuitemodule.py now use keyword args.
235- img modules updated to latest version (including pbm and sgi support).
236- Everything compiled with all optimization options available. Let me know
237 if you suspect errors that are due to this.
238
239 Changes since Python 1.2 for the mac
240 ------------------------------------
241- PPC python now uses a shared library organization. This allows the
242 creation of dynamically loadable extension modules (contact me) and
243 creation of python applets (see mkapplet.py). A number of previously
244 builtin modules are now dynamically loaded. Dynamically loaded
245 modules are distributed in the PlugIns folder.
246- Python modules can live in 'PYC ' resources (with a name equal to the
247 module name, so many modules can live in a single file). If you put a
248 file (in stead of a folder) in sys.path its resources will be searched.
249 See the PackLibDir script for creating such a file.
250- new binhex module (partially working, hexbin has problems)
251- Python now has a Preferences file, editable with
252 EditPythonPrefs. Remembered are the python 'home folder' and the
253 initial value for sys.path. If no preferences file is found a simple
254 one is created.
255 NOTE: this only works correctly if you start python the first time
256 from the correct folder.
257- new img modules, to read/write/convert images in various formats
258- new MacOS toolbox modules: AE, Ctl, Dlg, Event, List, Qd, Res, Snd
259 and Win. These provide access to various of the MacOS toolbox
260 interfaces. No documentation yet, but the __doc__ strings provide at
261 least the calling sequence (and Inside Mac will give you the
262 semantics). Minimal demos are provided for most toolbox interfaces,
263 and the 'scripts' directory has some more examples.
264- AppleEvent client interfaces can be generated from aete/aeut
265 resources. No support for objects yet, nor for server interfaces.
266- Lib:mac:FrameWork.py has an application framework (under
267 construction).
268- (PPC Only) support for building Python applets: tiny standalone
269 python applications.
270- fp = open(filename, '*r') opens resource-fork of a file for reading
271 (and similar for writing).
272- option-dragging a file to the interpreter (or immedeately pressing
273 <option> after launching python) will bring up an Options dialog
274 allowing you to set options like import-tracing, etc.
275- MacOS module method added: GetErrorString(OSErr) -> error string
276- There is now a numbering convention for resource-ID's:
277 128-255 Resources used by the interpreter itself
278 256-511 Resources used by standard modules
279 512- Resources for applications
280- macfs module changes:
281 - StandardGetFile without type arguments now shows all files
282 - PromptGetFile(prompt, ...) is like StandardGetFile but with a
283 prompt
284 - GetDirectory (let user select a folder) added
285 - GetFInfo and SetFInfo methods of FSSpec objects get/set finder
286 info. FInfo objects have attributes Creator, Type, etc.
287 - FindFolder (locate trash/preferences/etc) added
288- mactcp/macdnr changes: bug fix wrt idle-loop.
289- EditPythonPrefs script: change initial sys.path and python home
290 folder
291- (PPC only) MkPluginAliases: Setup aliases for dynamically loadable
292 modules that live in a single shared library
293- PackLibDir: Convert Lib directory to a single resource file
294 containing all .pyc code
295- fixfiletypes: Set file types based on file extension over a whole
296 tree.
297- RunLibScript: Run any script as main program, optionally redirecting
298 stdin/stdout, supplying arguments, etc.
299- binhextree: Binhex all files in a tree, depending on the extension.
300- (PPC only) mkapplet: Create a python applet from a sourcefile and
301 (optional) resourcefile.
302
303 PYTHON 1.2 FOR THE MACINTOSH
304 ****************************
305
306Python can be built on the Mac using either THINK C 6.0 (or 7.0), or
307CodeWarrior 5.0 (for 68K and PPC). In the past it has also been compiled
308with earlier versions of Think, but no guarantees are made that the
309source is still compatible with those versions. (Think C 5.0 appears
310to be OK.) Likewise, new compiler versions may effectively change the
311language accepted (or the library provided!) and thus cause problems.
312
313MPW is a special case -- it used to be possible to build Python as
314an MPW tool using MPW 3.2, and this may still work, but I haven't
315tried this lately. What I have tried, however, is building Python
316as a shared library for CFM-68K, using the Symantec C compiler for MPW.
317See subdirectory MPW and the README file there for more info.
318
319
3201. Using Think C 6.0 (or 7.0)
321=============================
322
3231.1 The directory structure
324---------------------------
325
326I duplicate the UNIX directory structure from the distribution. The
327subdirectories needed to compile are: Mac, Include, Parser, Python,
328Objects, Modules. (Don't bother with Grammar and the parser
329generator, nor with the Doc subdirectory.)
330
331For running and testing, you also need Lib and its subdirectories test
332and stdwin. You could also copy some things from the Demo/stdwin
333directory (unfortunately most other demos are UNIX specific and even
334many stdwin demos are).
335
336Make sure there is no config.c file in the Modules subdirectory (if
337you copy from a directory where you have done a UNIX build this might
338occur). Also don't use the config.h generated on UNIX.
339
3401.2 The project file
341--------------------
342
343I put all source files in one project, which I place in the parent
344directory of the source directories.
345
3461.2.1 Project type
347
348(This is the Set Project Type... dialog in the Project menu.)
349
350Set the creator to PYTH; turn on "far data"; leave "far code" and
351"separate strs" unchecked (they just serve to bloat the application).
352A partition size of 1000K should be enough to run the standard test
353suite (which requires a lot of memory because it stress tests the
354parser quite a bit) and most demos or medium-size applications. The
355interpreter will do basic things in as little at 500K but this may
356prevent parsing larger modules.
357
3581.2.2 Compiler options
359
360(This is the Options -> THINK C ... dialog in the Edit menu.)
361
362 - Start with Factory Settings.
363
364 - In the Prefix, remove #include <MacHeaders> and add
365 #define HAVE_CONFIG_H
366
367 - Choose any optimizer and debugger settings you like. - You
368 can choose 4-byte ints if you want. This requires that you
369 rebuild the ANSI and unix libraries with 4-bytes ints as well
370 (better make copies with names like ANSI 32 bit). With 4-byte
371 ints the interpreter is marginally bigger and somewhat (~10%)
372 slower, but Python programs can use strings and lists with
373 more than 32000 items (with 2-byte ints these can cause
374 crashes). The range of Python integers is not affected (these
375 are always represented as longs). In fact, nowadays I always
376 use 4-byte integers, since it is actually rather annoying that
377 strings >= 64K cause crashes.
378
3791.2.3 Files to add
380
381(This is the Add Files... dialog in the Source menu.)
382
383The following source files must be added to the project. I use a
384separate segment for each begin letter -- this avoids segment
385overflow, except for 'c', where you have to put either ceval.c or
386compile.c in a separate segment. You could also group them by
387subdirectory or function, but you may still have to split segments
388arbitrarily because of the 32000 bytes restriction.
389
390 - From Mac: all .c files.
391
392 - From Parser: acceler.c, grammar1.c,
393 myreadline.c, node.c, parser.c, parsetok.c, tokenizer.c.
394
395 - From Python: bltinmodule.c, ceval.c, cgensupport.c,
396 compile.c, errors.c, getargs.c getopt.c, graminit.c, import.c,
397 importdl.c, marshal.c, modsupport.c, mystrtoul.c,
398 pythonmain.c, pythonrun.c, sigcheck.c, structmember.c,
399 sysmodule.c, traceback.c (i.e. all .c files except dup2.c,
400 fmod.c, frozenmain.c, getcwd.c, getmtime.c, memmove.c,
401 sigcheck.c, strerror.c, strtod.c, thread.c)
402
403 - From Objects: all .c files except xxobject.c.
404
405 - From Modules: all the modules listed in config.c (in the Mac
406 subdirectory) in the initializer for inittab[], before
407 "ADDMODULE MARKER 2". Also add md5c.c if you add md5module.c,
408 and regexpr.c if you add regexmodule.c. (You'll find
409 macmodule.c in the Mac subdirectory, so it should already have
410 been added in a previous step.) Note that for most modules,
411 the source file is called <name>module.c, but for a few long
412 module names it is just <module>.c. Don't add stdwinmodule.c
413 yet,
414
415The following THINK C libraries must be added: from Standard
416Libraries, ANSI and unix; from Mac Libraries, MacTraps. I put each
417library in a separate segment. Also see my earlier remark on 4-byte
418ints.
419
4201.4 Adding STDWIN
421-----------------
422
423STDWIN is built in two separate projects: stdwin.pi contains the core
424STDWIN implementation from Ports/mac, textedit.pi contains the files
425from Packs/textedit. Use the same compiler options as for Python and
426the same general source setup (in a sister directory of the toplevel
427Python directory). Put all sources in the same segment. To
428stdwin.pi, also add Tools/strdup.c and Gen/wtextbreak.c.
429
430The two projects can now be added as libraries to the Python project.
431You must also add stdwinmodule.c and add "#define USE_STDWIN" to the
432Prefix in the compiler options dialog (this only affects macmain.c and
433config.c).
434
435Note that stdwinmodule.c contains an #include statement that
436references "stdwin.h" by relative path name -- if the stdwin toplevel
437directory is not a sibling of the python toplevel directory, you may
438have to adjust the number of colons in the pathname.
439
4401.5 Resources
441-------------
442
443Since I created them with ResEdit I have no text source of the
444resources needed to give the application an icon etc... You can copy
445the size, bundle, file reference and icon resources from the
446distributed Python application with ResEdit. THINK C automatically
447copies resources into the application file from a file
448<projectname>.rsrc.
449
4501.6 Think C 5.0
451---------------
452
453Tim Gilbert adds one note that will be helpful to future Think C 5.0
454users: When you have a really big project like python, and you want to
455compile and run it, if you just hit Command-R, often Think C will
456compile the remaining files, think for a moment, and then give you a
457warning "internal error(ZREF)--please remove objects." Don't listen
458to it. It is lying. What you should do instead is "Check Link..."
459and _then_ hit Run. Why? Ask Symantec.
460
461
4622. Using MicroWerks CodeWarrior 5.0
463===================================
464
465Essentially, follow the instructions for Think C.
466
467XXX Should at least list the project options.
468
469
470--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
471<URL:http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>
472
473 PYTHON RELEASE NOTES FOR THE MACINTOSH
474 VERSION 1.1
475
476For the most part, Python on the Mac works just like Python under UNIX.
477The most important differences are:
478
479- Since there is no shell environment on the Mac, the start-up file
480 has a fixed name: PythonStartup. If a file by this name exists
481 (either in the current folder or in the system folder) it is executed
482 when an interactive interpreter is started.
483
484- The default search path for modules is different: first the current
485 directory is searched, then the subdirectories 'lib', 'lib:stdwin' and
486 'demo'. As always, you can change this (e.g. in your PythonStartup
487 file) by assigning or appending to sys.path -- use Macintosh pathnames!
488 (The default contains no absolute paths because these are unlikely
489 to make sense on other people's hard disks.)
490
491- The user interface for typing interactive commands is different.
492 This is actually the THINK C console I/O module, which is based on
493 the Mac toolbox TextEdit. A standard Edit menu provides Cut, Copy,
494 Paste and Clear (Undo is only there for Desk Accessories). A minimal
495 File menu provides Quit, which immediately exits the application,
496 without the usual cleanup. You can Copy from previous output,
497 but you can't scroll back beyond the 24x80 screen. The TAB key
498 always brings you to the end of the current input line; indentation
499 must be entered with spaces (a single space is enough).
500 End-of-file is generated by Command-D; Command-Period interrupts.
501 There is an annoying limit in the length of an input line to a single
502 screen line (less the prompt). Use \ to input long statements.
503 Change your program if it requires long lines typed on input.
504 Even though there is no resize box, the window can be resized by
505 dragging its bottom right corner, but the maximum size is 24x80.
506
507- Tabs in module files are interpreted as 4 (four!) spaces. This is
508 consistent with most Mac editors that I know. For individual files
509 you can change the tab size with a comment like
510
511 # vi:set tabsize=8:
512
513 (exactly as shown here, including the colons!). If you are consistent
514 in always using tabs for indentation on UNIX, your files will be
515 parsed correctly on the Mac, although they may look funny if you
516 have nicely lined-up comments or tables using tabs. Never using tabs
517 also works. Mixing tabs and spaces to simulate 4-character indentation
518 levels is likely to fail.
519
520- You can start a script from the Finder by selecting the script and
521 the Python interpreter together and then double clicking. If you
522 make the owner of the script PYTH (the type should always be TEXT)
523 Python will be launched if you double click it!
524 There is no way to pass command line arguments to Python scripts.
525
526- The set of built-in modules is different:
527
528 = Operating system functions for the 'os' module is provided by the
529 built-in module 'mac', not 'posix'. This doesn't have all the
530 functions from posix, for obvious reasons (if you know the Mac
531 O/S a little bit). The functions in os.path are provided by
532 macpath, they know about Mac pathnames etc.
533
534 = None of the UNIX specific modules ('socket', 'pwd', 'grp' etc.)
535 exists.
536
537 = Module 'stdwin' is always available. It uses the Mac version of
538 STDWIN, which interfaces directly with the Mac toolbox. The most
539 important difference is in the font names; setfont() has a second
540 argument specifying the point size and an optional third one
541 specifying the variation: a single letter character string,
542 'i' for italics, 'b' for bold. Note that when STDWIN is waiting
543 for events, the standard File and Edit menus are inactive but
544 still visible, and (most annoyingly) the Apple menu is also inactive;
545 conversely, menus put up by STDWIN are not active when the Python is
546 reading from the keyboard. If you open Python together with a text
547 file containing a Python script, the script will be executed and
548 a console window is only generated when the script uses standard
549 input or output. A script that uses STDWIN exclusively for its I/O
550 will have a working Apple menu and no extraneous File/Edit menus.
551 (This is because both stdwin and stdio try to initialize the
552 windowing environment; whoever gets there first owns the Apple menu.)
553 LIMITATIONS: a few recent additions to STDWIN for X11 have not yet
554 been added to the Mac version. There are no bitmap objects, and
555 the setwinpos() and setwinsize() methods are non--functional.
556
557- Because launching an application on the Mac is so tedious, you will
558 want to edit your program with a desk accessory editor (e.g., Sigma
559 edit) and test the changed version without leaving Python. This is
560 possible but requires some care. Make sure the program is a module
561 file (filename must be a Python identifier followed by '.py'). You
562 can then import it when you test it for the first time. There are
563 now three possibilities: it contains a syntax error; it gets a runtime
564 error (unhandled exception); or it runs OK but gives wrong results.
565 (If it gives correct results, you are done testing and don't need
566 to read the rest of this paragraph. :-) Note that the following
567 is not Mac-specific -- it's just that on UNIX it's easier to restart
568 the entire script so it's rarely useful.
569
570 Recovery from a syntax error is easy: edit the file and import it
571 again.
572
573 Recovery from wrong output is almost as easy: edit the file and,
574 instead of importing it, call the function reload() with the module
575 name as argument (e.g., if your module is called foo, type
576 "reload(foo)").
577
578 Recovery from an exception is trickier. Once the syntax is correct,
579 a 'module' entry is placed in an internal table, and following import
580 statements will not re-read the file, even if the module's initialization
581 terminated with an error (one reason why this is done is so that
582 mutually recursive modules are initialized only once). You must
583 therefore force re-reading the module with reload(), however, if this
584 happens the first time you try to import the module, the import statement
585 itself has not completed, and your workspace does not know the module
586 name (even though the internal table of moduesl does!). The trick is
587 to first import the module again, then reload it. For instance,
588 "import foo; reload(foo)". Because the module object already exists
589 internally, the import statement does not attempt to execute the
590 module again -- it just places it in your workspace.
591
592 When you edit a module you don't have to worry about the corresponding
593 '.pyc' file (a "compiled" version of the module, which loads much faster
594 than the textual version): the interpreter notices that the '.py' file
595 has changed (because its modification time has changed) and ignores the
596 '.pyc' file. When parsing is successful, a new '.pyc' file is written;
597 if this fails (no write permission, disk full or whatever) it is
598 silently skipped but attempted again the next time the same module
599 is loaded. (Thus, if you plan to place a Python library on a read-only
600 disk, it is advisable to "warm the cache" by making the disk writable
601 and importing all modules once. The standard module 'importall' helps
602 in doing this.)