Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'option,': 0.07; 'seemed': 0.07; 'python': 0.08; 'mtime': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; '"import': 0.16; '.py': 0.16; 'hint:': 0.16; 'bytes': 0.19; 'file,': 0.22; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'checking': 0.28; 'import': 0.29; 'ignored.': 0.29; 'matches': 0.29; 'subject: .': 0.29; 'match': 0.30; 'to:addr:python-list': 0.34; 'header:X-Complaints-To:1': 0.34; 'header:User-Agent:1': 0.34; 'test': 0.34; 'version.': 0.35; 'idea': 0.36; 'file': 0.36; 'but': 0.37; 'received:org': 0.38; 'subject:: ': 0.38; 'something': 0.38; 'run': 0.39; 'header:Mime- Version:1': 0.39; 'returned': 0.39; 'to:addr:python.org': 0.39; 'header': 0.40; 'touch': 0.66; 'dated': 0.67; 'beside': 0.84; 'precompiled': 0.84; 'schrieb': 0.84; 'subject:Only': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Christian Heimes Subject: Re: Only Bytecode, No .py Files Date: Wed, 27 Jul 2011 00:04:07 +0200 References: <1311693548.3796.212.camel@ewzdev.atlantic> <1311715229.3796.224.camel@ewzdev.atlantic> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: f049079102.adsl.alicedsl.de User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110617 Lightning/1.0b2.102ipre2 Thunderbird/3.1.11 In-Reply-To: <1311715229.3796.224.camel@ewzdev.atlantic> X-Enigmail-Version: 1.1.2 OpenPGP: id=AD16AB1B; url=http://cheimes.de/heimes.asc X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1311717864 news.xs4all.nl 23886 [2001:888:2000:d::a6]:43968 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:10349 Am 26.07.2011 23:20, schrieb Eldon Ziegler: > That seemed like a good idea but the .py file was complied even though > it was dated 2001-01-01 00:00:00. Python must be checking something > beside the date. The first four bytes of a pyc file contain the magic header. It must match the magic of the current Python version. The next four bytes contain the pyc_mtime. It must match the mtime of the corresponding .py files as returned by fstat().st_mtime. If the magic doesn't match or the mtime header doesn't match the mtime of the .py file, the pyc is ignored. Hint: If you run python with the -v option, you can get information why a pyc file is ignored. $ touch test.py $ pycompile test.py $ python -v -c "import test" ... # test.pyc matches test.py import test # precompiled from test.pyc ... $ touch test.py $ python -v -c "import test" ... # test.pyc has bad mtime import test # from test.py ... Christian