Skip to content

Some functions are not working #42

@lutecky

Description

@lutecky

Hi,
I'm trying to use this great webserver (very good job!) in my app. Some functions don't work for me, so I test on pure ESP8266. After compiling to .mpy the tinyweb and logging module while importing tinyweb I receive a message: ValueError: invalid syntax for number

To fast fix this I decided to delete all logging references in tinyweb module - with succeeded because server started up. The example from README.md works fine! But...

  1. Sending a static file doesn't work (resp.send_file)
  2. REST API exable doesn't work too (app.add_resource)

Each time I get a blank page, server are respond. I need help because I haven't been able to run it properly for 4 days :-/ I used clean ESP8266 with 4MB memory, Micropython 1.13 with official .bin

My corrections and "improvements":

#import logging
import uasyncio as asyncio
import uasyncio.core, sys, gc
from ujson import loads, dumps
from uos import stat
from uerrno import ENOENT, EACCES, ECONNABORTED, ECONNRESET
from usocket import getaddrinfo, socket, AF_INET, SOCK_STREAM, SOL_SOCKET, SO_REUSEADDR

#log = logging.getLogger('WEB')

(...)
        except OSError as e:
            if e.args[0] not in (ECONNABORTED, ECONNRESET, 32):
                await resp.error(500)
        except HTTPException as e:
            await resp.error(e.code)
        except Exception as e:
            # Unhandled expection in user's method
            #log.error(req.path.decode())
            #log.exc(e, "")
            try:
                await resp.error(500)
(...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions