On Jul 26, 5:22 pm, Baz Walter <baz...@ftml.net> wrote: > hello > > i thought that python automatically compiled pyc files after a module is > successfully imported. what could prevent this happening? > > Python 2.6.1 (r261:67515, Apr 12 2009, 03:51:25) > [GCC 4.3.2] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import os > >>> os.mkdir('/home/baz/tmp/foo') > >>> os.chdir('/home/baz/tmp/foo') > >>> f = open('foo.py', 'w') > >>> f.write('print "hello world"\n') > >>> f.close() > >>> os.listdir('.') > ['foo.py'] > >>> import foo > hello world > >>> os.listdir('.') # why no pyc file? > ['foo.py'] > >>> import py_compile > >>> py_compile.compile('foo.py') > >>> os.listdir('.') > ['foo.py', 'foo.pyc']
Works for me I'm afraid (Mac OS X and Python 2.6). Michael Foord -- http://www.ironpythoninaction.com/ -- http://mail.python.org/mailman/listinfo/python-list