On Mon, Jun 14, 2010 at 17:11, Primoz Anzur <[email protected]> wrote:
> Hi!
> I'm trying to stream bigger files via web.py, and something is wrong, but I
> can't put my finger on it... The code is this:
>
...
>
> and I get this error:
>
> File "/www/192.168.1.5/docs/aa/ai/index.py", line 30
> yield line
> SyntaxError: 'return' with argument inside generator
>
>
> Any idea, what's wrong?
>
...
> def openfile(self, f):
> filename = f[2]
> if web.ctx.has_key('HTTP_IF_MODIFIED_SINCE'):
> return web.notmodified()
I think your problem is here, I'm pretty sure you need to change this
return to a yield because this is a generator function because of the
yield below.
> else:
> web.ok()
> web.header('Content-Length', os.stat(filename).st_size)
>
> f = open(filename)
> for line in f:
> yield line
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.