#🔒 TypeError that makes no sense

15 messages · Page 1 of 1 (latest)

simple dust
#

hi! getting this typeError

'<' not supported between instances of 'list' and 'int'
  File "C:\Users\Logan\Desktop\M5Lab2\M5Lab2dice_hist.py", line 79, in <module>
    hist.render_to_file("dice_barchart.svg")
TypeError: '<' not supported between instances of 'list' and 'int'

from this line:

ist.render_to_file("dice_barchart.svg")

really not sure what's up here, it shouldn't be comparing anything.

serene gyroBOT
#

@simple dust

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

ebon kettle
#

Is render_to_file your code?

simple dust
#

No, it was given to me as part of the assignment I am working on.

ebon kettle
#

What's its definition?

simple dust
#

I believe it is part of PyGal

analog niche
#

are all your files saved properly? sometimes you get mismatch between the error and the actually shown line, if some of the files haven't been saved properly.

#

or some __pycache__ issues. try deleting that folder if it exists

simple dust
#

Hehe, that’s embarrassing… I made an oopsie and was accidentally giving that line the list frequencies instead of the variable frequency…

#

Unfortunately the IDE doesn’t tell you if you make a typo if both names exist.

ebon kettle
#

A good IDE will if you use static typing (or simple cases where types can be inferred easily)

#

Or, I guess this is a clearer version of the error:

serene gyroBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.