.pyc from stdin?

lallous lallous at lgwm.org
Thu Oct 8 11:09:54 CEST 2009

Hello Shay,

"Shay Telfer" <shaypython at earthyself.com> wrote in message 
news:mailman.1021.1254988413.2807.python-list at python.org...
> Hi...
> It seems that python will accept a .py file piped from stdin, but not a 
> .pyc file (and there don't seem to be any flags to allow this). Am I 
> missing something?
> Eg
> cat blah.py | python
> works, but
> cat blah.pyc | python

Try for example: python -c "import blah"

> doesn't. (If you're wondering why anyone would do this it's because I'm 
> actually intending to use curl rather than cat :)

The former works because the Python interpreter understands python syntax, 
and when you (in the latter case) provide the interpreter a pyc file it 
surely won't work because it does not understand those compiled bytes just 
like that....


More information about the Python-list mailing list