B
Baz Walter
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.
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.
['foo.py', 'foo.pyc']>>> 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('.')