__pycache__, one more good reason to stck with Python 2?
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Fri Jan 21 03:01:14 EST 2011
On Wed, 19 Jan 2011 14:31:15 -0800, Alice Bevan–McGregor wrote:
> On 2011-01-19 13:01:04 -0800, Steven D'Aprano said:
>> 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'
>
> ... don't do that. I do not know why that would be expected to work,
> ever. (Unless you're crafty and wrap a real shell script around the
> .pyc, in which case it's no longer a .pyc.)
I didn't expect it to work, but I have seen others do it and be surprised
that it doesn't. This is why I was pleasantly surprised to learn that
`python toto.pyc` does work -- I was conflating the above failure with
the issue under discussion.
--
Steven
More information about the Python-list
mailing list