Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed2.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'scripts': 0.03; 'shipped': 0.05; 'python3': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'bytecode': 0.16; 'files)': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:python': 0.16; 'files.': 0.16; 'folks': 0.16; 'wrote:': 0.18; '(not': 0.18; 'import': 0.22; 'header:User- Agent:1': 0.23; 'exists': 0.24; 'versions': 0.24; "i've": 0.25; 'source': 0.25; 'least': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'minor': 0.31; 'file': 0.32; 'there.': 0.32; 'run': 0.32; 'could': 0.34; 'but': 0.35; 'version': 0.36; 'done,': 0.36; 'words,': 0.36; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'does': 0.39; 'itself': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'changed': 0.39; 'received:org': 0.40; 'days': 0.60; 'between': 0.67; 'therefore': 0.72; 'alone.': 0.84; '1:47': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Ned Batchelder Subject: Re: running python 2 vs 3 Date: Thu, 20 Mar 2014 14:45:06 -0400 References: <87fvmcn4o1.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 18.189.9.83 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 In-Reply-To: <87fvmcn4o1.fsf@elektro.pacujo.net> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1395341130 news.xs4all.nl 2939 [2001:888:2000:d::a6]:53783 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68597 On 3/20/14 1:47 PM, Marko Rauhamaa wrote: > Mark H Harris : > >> If you wanted to you could run your python scripts from the .pyc file >> alone. In other words, you may import as long as the .pyc file exists >> and the source does not need to be there. Some folks use this (not >> recommended) trick to hide or obfuscate their source from their >> users). > > I've seen it done, but at least in those Python 2 days the pyc format > changed between minor releases of Python, so Python itself had to be > shipped with the pyc files. > Python3 still makes no guarantees about the compatibility of bytecode (and therefore .pyc files) across versions of Python, so if you want to run from pure .pyc files, you have to be sure to use the same version of Python that produced the files. --Ned. > > Marko > -- Ned Batchelder, http://nedbatchelder.com