sys.stdin.read() HELP! 
Author Message
 sys.stdin.read() HELP!

I have a cgi script which reads XML data from a FLASH5 movie. The script
reads data into a string like this:

text = sys.stdin.read()

After I moved my scripts from a machine with python 1.7.2 to to a one
with python 2 .0, I started getting the following error:

text = sys.stdin.read()
IOError: [Errno 9] Bad file descriptor

WHAT THE #$^ does that mean??? Please help!  If I can't use my way with
2.0 anymore, what can I use instead?
Thanks in advance!

Andrey



Sun, 21 Dec 2003 14:30:08 GMT  
 sys.stdin.read() HELP!

Quote:

> I have a cgi script which reads XML data from a FLASH5 movie. The script
> reads data into a string like this:

> text = sys.stdin.read()

> After I moved my scripts from a machine with python 1.7.2 to to a one

1.5.2, I presume?

Quote:
> with python 2 .0, I started getting the following error:

> text = sys.stdin.read()
> IOError: [Errno 9] Bad file descriptor

> WHAT THE #$^ does that mean???

It means sys.stdin isn't attached properly.  This is unlikely to be
Python's fault, I'd have thought.  Can you shed a few more details as
to the environment you're working in?  Maybe somebody who has
experience in these things will be able to spot the mis-config (not
likely to be me).

Are you sure the version of Python is the only difference between the
two machines?

Cheers,
M.

--
  The only problem with Microsoft is they just have no taste.
              -- Steve Jobs, (From _Triumph of the Nerds_ PBS special)
                         and quoted by Aahz Maruch on comp.lang.python



Sun, 21 Dec 2003 19:21:00 GMT  
 sys.stdin.read() HELP!
There's not much code in my srcript - just

import sys
text = sys.stdin.read()
... and then goes string parsing for the text.

If I try using sys.stdin from the shell it works ok.

The machines definitely differ more than by the version of python. In fact
it's a brand new server, and I am not the one who moved stuff onto it. well,
and I don't know much od sysadmin stuff - but if you could give me aclue what
could be the reason I could talk to the guy.

Here are some enviromental variables:

'GATEWAY_INTERFACE': 'CGI/1.1'
'SERVER_SIGNATURE': '<ADDRESS>Apache/1.3.19'
'SERVER_SOFTWARE': 'Apache/1.3.19'

Quote:


> > I have a cgi script which reads XML data from a FLASH5 movie. The script
> > reads data into a string like this:

> > text = sys.stdin.read()

> > After I moved my scripts from a machine with python 1.7.2 to to a one

> 1.5.2, I presume?

> > with python 2 .0, I started getting the following error:

> > text = sys.stdin.read()
> > IOError: [Errno 9] Bad file descriptor

> > WHAT THE #$^ does that mean???

> It means sys.stdin isn't attached properly.  This is unlikely to be
> Python's fault, I'd have thought.  Can you shed a few more details as
> to the environment you're working in?  Maybe somebody who has
> experience in these things will be able to spot the mis-config (not
> likely to be me).

> Are you sure the version of Python is the only difference between the
> two machines?

> Cheers,
> M.

> --
>   The only problem with Microsoft is they just have no taste.
>               -- Steve Jobs, (From _Triumph of the Nerds_ PBS special)
>                          and quoted by Aahz Maruch on comp.lang.python



Mon, 22 Dec 2003 03:42:33 GMT  
 sys.stdin.read() HELP!
Actually it does look like there's something bad about the way the
machine is configured. Even if I simply
make a test  like this:

import cgi
cgi.test()

...and try to send data to this test.cgi file by POST, it generates the
same type of error. If I send data by GET or don't send anything it does
not generate it. But I still don't know what needs to be done with the
server to fix this.

  File "/usr/local/lib/python2.0/cgi.py", line 838, in test
    form = FieldStorage()   # Replace with other classes to test those
  File "/usr/local/lib/python2.0/cgi.py", line 502, in __init__
    self.read_urlencoded()
  File "/usr/local/lib/python2.0/cgi.py", line 574, in read_urlencoded
    qs = self.fp.read(self.length)
IOError: [Errno 9] Bad file descriptor

Andrey.



Mon, 22 Dec 2003 07:23:19 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. using sys.stdin.raw_input and sys.stdin.readline together in a platform independent way

2. non-blocking sys.stdin.read() on win32?

3. Error using sys.stdin.read()

4. can i make sys.stdin.read() not wait?

5. Terminal reads and sys.stdin

6. Problems reading fra sys.stdin and later on duing raw_input

7. Chosing between sys.argv and sys.stdin

8. Help with reading STDIN when clipper is called via CGI

9. banging head against sys.stdin and tkinter on win32

10. sys.stdin.readlines() in 2.2a ?

11. reusing sys.stdin?

12. how to calculate the size of sys.stdin?

 

 
Powered by phpBB® Forum Software