GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Allow non-JSON payloads · Issue #16 · msgflo/msgflo-python

Allow non-JSON payloads #16

New issue
Copy link
New issue
Copy link
Open
Open
Allow non-JSON payloads#16
Copy link
Labels
enhancement

Description

@bergie
bergie
opened on May 5, 2017
Issue body actions

Currently msgflo-python fails if payloads can't be serialized as JSON:

Traceback (most recent call last):
  File "/home/bergie/.local/lib/python2.7/site-packages/gevent/greenlet.py", line 536, in run
    result = self._run(*self.args, **self.kwargs)
  File "/home/bergie/Projects/c-base/farbgeber/farbgeber.py", line 107, in loop
    self.send_palette(palette)
  File "/home/bergie/Projects/c-base/farbgeber/farbgeber.py", line 128, in send_palette
    self.send('palette', palette)
  File "/home/bergie/.local/lib/python2.7/site-packages/msgflo/msgflo.py", line 54, in send
    self._engine._send(outport, outdata)
  File "/home/bergie/.local/lib/python2.7/site-packages/msgflo/msgflo.py", line 234, in _send
    serialized = json.dumps(data)
  File "/usr/lib/python2.7/json/__init__.py", line 243, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python2.7/json/encoder.py", line 184, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <Color #cc5d00> is not JSON serializable

Activity

  1. bergie
    added a commit that references this issue on May 5, 2017

    Send as dict instead of byte array, refs msgflo/msgflo-python#16

    2a8286c
  2. jonnor
    added
    enhancement
    on May 6, 2017
  3. bergie commented on May 7, 2017

    @bergie
    bergie
    on May 7, 2017
    MemberAuthor
    More actions

    Also would be nice to be able to send strings as-is. Now they become quoted.

    So when sending hello world, the MQTT topic gets "hello world"

  4. bergie
    added a commit that references this issue on May 7, 2017

    add automatic json parsing if someone wants to send us json strings i…

    658b979
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.