Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

menu.py: TypeError: unsupported format string passed to NoneType.__format__ #52

Closed
ldrolez opened this issue Jan 13, 2022 · 4 comments
Closed

Comments

@ldrolez
Copy link

ldrolez commented Jan 13, 2022

With the git version, menu.py starts displaying data, and then encounters an error:

...
...
Driver Seat Heater: 0                  Passenger Seat Heater: 0
Is Front Defroster On: False           Is Rear Defroster On: False
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "./menu.py", line 329, in <module>
    main()
  File "./menu.py", line 312, in main
    menu(vehicles[idx])
  File "./menu.py", line 176, in menu
    show_vehicle_data(vehicle.get_vehicle_data())
  File "./menu.py", line 61, in show_vehicle_data
    print(fmt.format(ve['vehicle_name'], vehicle.dist_units(ve['odometer'])))
TypeError: unsupported format string passed to NoneType.__format__

$ python3 --version
Python 3.7.3

@tdorssers
Copy link
Owner

That would mean that either ve['vehicle_name'] or ve['odometer'] equals to None, which is unexpected.
Can you add this line before line 61 and share the output:
print(ve['vehicle_name'], ve['odometer'])

@ldrolez
Copy link
Author

ldrolez commented Jan 13, 2022

Yes I never tried to change the name of the car

@tdorssers
Copy link
Owner

Please checkout menu.py of 8e0ec2e

@ldrolez
Copy link
Author

ldrolez commented Jan 17, 2022

Great! it works

@ldrolez ldrolez closed this as completed Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants