__pycache__, one more good reason to stck with Python 2?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed Jan 19 16:01:04 EST 2011


On Wed, 19 Jan 2011 16:00:20 +0100, Antoine Pitrou wrote:
 
>> .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.
> 
> It seems to work here:

[snip incantation]

Then I stand corrected, thank you.

I know I've seen problems executing .pyc files from the shell in the 
past... perhaps I was conflating details of something else. Ah, I know!

[steve at sylar ~]$ chmod u+x toto.pyc
[steve at sylar ~]$ ./toto.pyc
: command not found ��
./toto.pyc: line 2: syntax error near unexpected token `('
./toto.pyc: line 2: `P7Mc at s     dGHdS(tfooN((((s        ./
toto.py<module>s'



-- 
Steven



More information about the Python-list mailing list