""" testImportRe.py Import a specific re.py so that recompilation of the .pyc can be seen. Create a directory accessible from Linux and Windows and copy this file to it. Create a subdirectory named lib and copy re.py from Python-2.6 to lib. Run this file. First in Linux, then Window, then Linux, using -v flag, then scroll up to see the "wrote re.pyc" line. See log of tests below. """ import sys if 're' in sys.modules: del sys.modules['re'] sys.path.insert(0, 'lib') import re """ 2012/07/12 In the following test, Linux is using Python-2.6.5 and Windows Python-2.6.2. The difference between these bugfix versions makes no difference to the test. Andrew MacKeith Linux 64 bit >python26 -v testImportRe.py Python 2.6.2 (r262:71600, Jul 8 2010, 11:49:56) [GCC 4.1.2 20070115 (SUSE Linux)] on linux2 Type "help", "copyright", "credits" or "license" for more information. import re # from lib/re.py # wrote lib/re.pyc quicksim@/u/users/omh/work/testimportmtime>ls -l lib/re* -rwxr-x--- ... 12966 Jan 1 2009 lib/re.py* -rwxr-x--- ... 12807 Jul 12 11:07 lib/re.pyc* Windows 64 bit Python 2.6.5 (r265:79096, Mar 19 2010, 18:02:59) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. # lib\re.pyc has bad mtime import re # from lib\re.py # wrote lib\re.pyc X:\work\testimportmtime>ls -l lib/re* -rwxrwxrwa ... 12966 Jan 1 2009 lib/re.py -rwxrwxrwa ... 12807 Jul 12 11:09 lib/re.pyc back to Linux Python 2.6.2 (r262:71600, Jul 8 2010, 11:49:56) [GCC 4.1.2 20070115 (SUSE Linux)] on linux2 Type "help", "copyright", "credits" or "license" for more information. # lib/re.pyc has bad mtime import re # from lib/re.py # wrote lib/re.pyc quicksim@/u/users/omh/work/testimportmtime>ls -l lib/re* -rwxr-x--- 1 omh hks 12966 Jan 1 2009 lib/re.py* -rwxr-x--- 1 omh hks 12807 Jul 12 11:11 lib/re.pyc* Linux Python version details: Python 2.6.2 (r262:71600, Jul 8 2010, 11:49:56) [GCC 4.1.2 20070115 (SUSE Linux)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import platform >>> print platform.platform() Linux-2.6.18-194.el5-x86_64-with-redhat-5.5-Tikanga >>> print platform.architecture() ('64bit', 'ELF') >>> print platform.python_compiler() GCC 4.1.2 20070115 (SUSE Linux) >>> Windows Python version details: Python 2.6.5 (r265:79096, Mar 19 2010, 18:02:59) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import platform >>> print platform.platform() Windows-post2008Server-6.1.7601-SP1 >>> print platform.architecture() ('64bit', 'WindowsPE') >>> print platform.python_compiler() MSC v.1500 64 bit (AMD64) >>> """