Skip to content

GPS print.py output exception #38

Description

@hostaboat

When trying to print to console via print.py with GPS enabled, there is no GPS output, no '=' delimiter line between readings, and in the airpi.log file I see the following:

2016-09-25 17:01:05,689 - __main__ - DEBUG -  ERROR:   Exception during output: Unknown format code 'f' for object of type 'str'

The breakage seems to have happened In the commit by Haydn Williams on Oct 15, 2014 - Lots of pylint improvements.

This part of the commit in format_output_gps() broke GPS output:

 100       -        return str(prop.ljust(17) + ": " + str("{0:.2f}".format(value)).rjust(10) + " " + unit) 
      147  +        value = str(prop.ljust(17)) + ": "
      148  +        value += str("{0:.2f}".format(value).rjust(10) + " " + unit) 

Note that value is passed in as an argument then immediately overwritten and assigned a value that is a string. When it is then appended to, the attempt to format what is now a string as a float causes the exception.

GPS output works by just changing back with an ljust(18) to match the other outputs:

return str(prop.ljust(18)) + ": " + str("{0:.2f}".format(value).rjust(10) + " " + unit)

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions