Hello all!
I am trying to implement a simple frontend for ffmpeg tests and find
problems due to socket errors which have been discussed previously on
this group. Unfortunately, I was not able to use any of the
suggestions and Ulrik's post (
http://groups.google.com/group/webpy/
browse_thread/thread/507bd537be623fb7/9932b4e7e2c3c000?
lnk=gst&q=ulrik#9932b4e7e2c3c000) remained unanswered...
I based the following code on a Django fix addressing the same issue
on that platform.
class upload:
def POST(self):
asset = web.input(asset={}).asset
video = open(os.path.join('./static',
'in'+os.path.basename(os.path.splitext(asset.filename)[1])), 'wb')
len = web.intget(web.ctx.env.get('CONTENT_LENGTH'), 0)
while True:
r = len - video.tell()
if r <= 0: break
chunk = web.ctx.env['wsgi.input'].read(min(2048L, r))
if not chunk: break
video.write(chunk)
video.close()
# os.system("ffmpeg -y -i %s %s" % (
video.name, 'static/out.flv'))
web.redirect(web.ctx.home+'/view')
Unfortunately, the code above still fails:
[...]
chunk = web.ctx.env['wsgi.input'].read(min(2048L, r))
File "/tmp/python.6884/usr/lib/python2.5/socket.py", line 309, in
read
data = self._sock.recv(recv_size)
timeout: timed out
Any suggestions?
TIA
- JP