On Thu, 20 Jan 2011 05:09:50 -0800, John Pinner wrote: > Hi > > You have disturbe my slumber, Steven ;-) > > On Jan 19, 2:42 pm, Steven D'Aprano <steve > +comp.lang.pyt...@pearwood.info> wrote: >> On Tue, 18 Jan 2011 00:58:14 -0800, jmfauth wrote: >> > It is now practically impossible to launch a Python application via a >> > .pyc file. >> >> When has that ever been possible? >> >> .pyc files are Python byte-code. You can't run them directly using >> Python (except via the import machinery), you can't run them as a >> script, they're not machine code. Unless you write a wrapper to import >> the file as a module, you can't directly execute .pyc files. > > Not true. 'python myprog.pyc' has worked for as long as I have been > using Python. Whether or not it is a good idea is another matter. > > Probably it would be best to check what you're saying before posting > such a bald assertion, even though you were 110% sure of what you were > saying. I've been there, done that, bought the tee-shirt.
Yes, thank you, I've already been corrected over this :) But you got me thinking... how far back does this behaviour go? Apparently it goes back as long as I've been using Python too: [steve@sylar ~]$ echo "print 'spam spam spam'" > spam.py [steve@sylar ~]$ python1.5 Python 1.5.2 (#1, Apr 1 2009, 22:55:54) [GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import spam spam spam spam >>> [steve@sylar ~]$ python1.5 spam.pyc spam spam spam But of course, .pyc files1.5 are version specific: [steve@sylar ~]$ python2.5 spam.pyc RuntimeError: Bad magic number in .pyc file -- Steven -- http://mail.python.org/mailman/listinfo/python-list