On Sun, Oct 11, 2009 at 10:50 PM, BS <[email protected]> wrote:
>
> I get following tracebacks:
> Traceback (most recent call last):
>  File "/home/xsx/+act/__hack__/bartskowron.com/web/application.py",
> line 242, in process
>    return self.handle()
>  File "/home/xsx/+act/__hack__/bartskowron.com/web/application.py",
> line 233, in handle
>    return self._delegate(fn, self.fvars, args)
>  File "/home/xsx/+act/__hack__/bartskowron.com/web/application.py",
> line 412, in _delegate
>    return handle_class(cls)
>  File "/home/xsx/+act/__hack__/bartskowron.com/web/application.py",
> line 387, in handle_class
>    return tocall(*args)
>  File "/home/xsx/+act/__hack__/bartskowron.com/main.py", line 155, in
> POST
>    utils.updatedb(db, uploadedfile.name)
>  File "/home/xsx/+act/__hack__/bartskowron.com/utils.py", line 82, in
> updatedb
>    return addsets(db, archive)
>  File "/home/xsx/+act/__hack__/bartskowron.com/utils.py", line 125,
> in addsets
>    f.extractall(path=tmpdir)
>  File "/usr/lib/python2.6/tarfile.py", line 2024, in extractall
>    for tarinfo in members:
>  File "/usr/lib/python2.6/tarfile.py", line 2405, in next
>    tarinfo = self.tarfile.next()
>  File "/usr/lib/python2.6/tarfile.py", line 2307, in next
>    self.fileobj.seek(self.offset)
>  File "/usr/lib/python2.6/gzip.py", line 382, in seek
>    self.read(1024)
>  File "/usr/lib/python2.6/gzip.py", line 219, in read
>    self._read(readsize)
>  File "/usr/lib/python2.6/gzip.py", line 267, in _read
>    self._read_eof()
>  File "/usr/lib/python2.6/gzip.py", line 304, in _read_eof
>    hex(self.crc)))
> IOError: CRC check failed 0xd95f6f6cL != 0x245f1adbL
>
> Traceback (most recent call last):
>  File "/home/xsx/+act/__hack__/bartskowron.com/web/application.py",
> line 240, in process
>    return p(lambda: process(processors))
>  File "/home/xsx/+act/__hack__/bartskowron.com/web/application.py",
> line 558, in processor
>    return handler()
>  File "/home/xsx/+act/__hack__/bartskowron.com/web/application.py",
> line 240, in <lambda>
>    return p(lambda: process(processors))
>  File "/home/xsx/+act/__hack__/bartskowron.com/web/application.py",
> line 249, in process
>    raise self.internalerror()
>  File "/home/xsx/+act/__hack__/bartskowron.com/web/application.py",
> line 470, in internalerror
>    return debugerror.debugerror()
>  File "/home/xsx/+act/__hack__/bartskowron.com/web/debugerror.py",
> line 299, in debugerror
>    return web._InternalError(djangoerror())
>  File "/home/xsx/+act/__hack__/bartskowron.com/web/debugerror.py",
> line 289, in djangoerror
>    return t(exception_type, exception_value, frames)
>  File "/home/xsx/+act/__hack__/bartskowron.com/web/template.py", line
> 863, in __call__
>    return BaseTemplate.__call__(self, *a, **kw)
>  File "/home/xsx/+act/__hack__/bartskowron.com/web/template.py", line
> 776, in __call__
>    return self._join_output(out)
>  File "/home/xsx/+act/__hack__/bartskowron.com/web/template.py", line
> 782, in _join_output
>    for name, value in out:
>  File "/home/xsx/+act/__hack__/bartskowron.com/web/debugerror.pyc",
> line 183, in __template__
>    $if ctx.output or ctx.headers:
>  File "/home/xsx/+act/__hack__/bartskowron.com/web/webapi.py", line
> 265, in input
>    return storify(out, *requireds, **defaults)
>  File "/home/xsx/+act/__hack__/bartskowron.com/web/utils.py", line
> 145, in storify
>    value = getvalue(value)
>  File "/home/xsx/+act/__hack__/bartskowron.com/web/utils.py", line
> 132, in getvalue
>    return unicodify(x.value)
>  File "/home/xsx/+act/__hack__/bartskowron.com/web/utils.py", line
> 127, in unicodify
>    if _unicode and isinstance(s, str): return safeunicode(s)
>  File "/home/xsx/+act/__hack__/bartskowron.com/web/utils.py", line
> 235, in safeunicode
>    return obj.decode(encoding)
>  File "/usr/lib/python2.6/encodings/utf_8.py", line 16, in decode
>    return codecs.utf_8_decode(input, errors, True)
> UnicodeDecodeError: 'utf8' codec can't decode byte 0x8b in position 1:
> unexpected code byte
>
> The first is weird because I'm sure the GZIP file is correct. Also i
> checked it in Python console and no problems with CRC
>
>
> class upload:
>    meta_form = form.Form(
>            form.File("archive",)# form.notnull,),
>            )
>    def GET(self):
>        form = self.meta_form()
>        return render.upload(form=form)
>
>    def POST(self):
>        form = self.meta_form()
>        result = web.input(archive={})
>
>        if not form.validates(result):
>            return render.upload(form=form)
>
>        uploadedfile = tempfile.NamedTemporaryFile()
>        uploadedfile.write(result.archive.file.read())
>        utils.updatedb(db, uploadedfile.name)
>        uploadedfile.close()
>        return render.dbupdated()
>
> anyone can help?

There seems to be a bug in debugerror that causes failure when the
input data is not unicode. I fixed it just now.

Try using result.archive.value instead of result.archive.file.read().

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to