Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > .pyc from stdin?

Reply
Thread Tools

.pyc from stdin?

 
 
Shay Telfer
Guest
Posts: n/a
 
      10-07-2009
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
 
Reply With Quote
 
 
 
 
lallous
Guest
Posts: n/a
 
      10-08-2009
Hello Shay,

"Shay Telfer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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

 
Reply With Quote
 
 
 
 
lallous
Guest
Posts: n/a
 
      10-08-2009
Hello Shay,

"Shay Telfer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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

 
Reply With Quote
 
lallous
Guest
Posts: n/a
 
      10-08-2009
Hello Shay,

"Shay Telfer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments