Closed propthink closed 4 months ago
This error is expected. The string
parameter requires a str
type but names_at_mouse_location
is a builtin_function_or_method
as described by the error message.
For VSCode I'd recommend setting up the ms-python.mypy-type-checker plugin to detect these kinds of errors. Make sure get_names_at_location
is returning the correct type.
Use Mypy to debug all cases of TypeError
, AttributeError
, and NameError
.
Thank you for your advice, I will look into this issue. I apologize if this was an errant bug report
It is errant, but I'm not bothered by it. The Discussions tab is a better place to ask for general help on the tutorial.
Describe the bug I am following the 2020 version of the python-tcod roguelike tutorial located at this link: https://rogueliketutorials.com/tutorials/tcod/v2/
towards the end of chapter 7, I am getting an error when I try and run the render_names_at_mouse_location function
To Reproduce here is the code snippit from the tutorial that is causing the error:
def render_names_at_mouse_location( console: Console, x: int, y: int, engine: Engine ) -> None:
specifically the last line is triggering the following error from the python-tcod lib, specifically on like 970 in the \tcod\console.py file:
"AttributeError: 'builtin_function_or_method' object has no attribute 'encode'"
Expected behavior the function should be printing a string at a given location
Screenshots
Desktop (please complete the following information):
Additional context Add any other context about the problem here.