Baz Walter wrote:

> 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']

You did not set the PYTHONDONTWRITEBYTECODE environment variable in a former 
life, or did you?

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to