gramener / gramex

A visual analytics platform to build data-based web apps with less code.
https://gramener.com/gramex/guide/
Other
142 stars 57 forks source link

Gramex crashing on yaml keywords #704

Closed shraddheya closed 1 year ago

shraddheya commented 1 year ago

Gramex crashes with error

Traceback (most recent call last):
  File "C:\Users\shraddheya.shrivasta\.conda\envs\g39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\shraddheya.shrivasta\.conda\envs\g39\lib\runpy.py", line 87, in _run_code
DEBUG   29-Mar 16:13:01 gramex:migrate PORT 1.87.0: SKIP migrated storelocations.user.url: C:/Users/shraddheya.shrivasta/AppData/Local/Gramex Data/auth.user.db      exec(code, run_globals)
  File "C:\Users\shraddheya.shrivasta\.conda\envs\g39\Scripts\gramex.exe\__main__.py", line 7, in <module>

  File "C:\Users\shraddheya.shrivasta\Documents\work\gramex\gramex\gramex\__init__.py", line 184, in commandline       return init(cmd=config)
  File "C:\Users\shraddheya.shrivasta\Documents\work\gramex\gramex\gramex\__init__.py", line 309, in init
    callback = getattr(services, key)(conf[key])   File "C:\Users\shraddheya.shrivasta\Documents\work\gramex\gramex\gramex\services\__init__.py", line 257, in url      _key = cache_key('url', spec)     File "C:\Users\shraddheya.shrivasta\Documents\work\gramex\gramex\gramex\cache.py", line 470, in cache_key            return _json_dump(args)       File "C:\Users\shraddheya.shrivasta\Documents\work\gramex\gramex\gramex\cache.py", line 440, in _json_dump       
WARNING 29-Mar 16:13:01 gramex:data PORT DELETE FROM users     return json.dumps(    File "C:\Users\shraddheya.shrivasta\.conda\envs\g39\lib\json\__init__.py", line 234, in dumps    return cls(     
  File "C:\Users\shraddheya.shrivasta\.conda\envs\g39\lib\json\encoder.py", line 199, in encode    chunks = self.iterencode(o, _one_shot=True)
  File "C:\Users\shraddheya.shrivasta\.conda\envs\g39\lib\json\encoder.py", line 257, in iterencode
    return _iterencode(o, 0) TypeError: '<' not supported between instances of 'bool' and 'str'

When we use on in gramex.yaml For example:

url:
  sqlite:
    pattern: /$YAMLURL/sqlite/
    handler: FormHandler
    kwargs:
      url: 'sqlite:///$YAMLPATH/mydatabase.db'
      table: [order_items, orders, customer]
      join:
        orders:
          type: inner
          on:
            order_tems.order_id: orders.id
        customers:
          join: left
          on:
            orders.customer_id: customers.id
      default:
        sales.amount>~: 0
        customer.age>~: 0
sanand0 commented 1 year ago

This fails because:

We don't anticipate gramex.yaml having keys that are not strings. (We'll change on: to something else.)

Closing as won't fix.