Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   .pyc from stdin? (http://www.velocityreviews.com/forums/t700850-pyc-from-stdin.html)

Shay Telfer 10-07-2009 01:54 PM

.pyc from stdin?
 
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

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

Thanks,
Shay

lallous 10-08-2009 09:09 AM

Re: .pyc from stdin?
 
Hello Shay,

"Shay Telfer" <shaypython@earthyself.com> wrote in message
news:mailman.1021.1254988413.2807.python-list@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....

--
Elias


lallous 10-08-2009 09:10 AM

Re: .pyc from stdin?
 
Hello Shay,

"Shay Telfer" <shaypython@earthyself.com> wrote in message
news:mailman.1021.1254988413.2807.python-list@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....

--
Elias


lallous 10-08-2009 09:10 AM

Re: .pyc from stdin?
 
Hello Shay,

"Shay Telfer" <shaypython@earthyself.com> wrote in message
news:mailman.1021.1254988413.2807.python-list@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....

--
Elias



All times are GMT. The time now is 02:07 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.