How do I define name 'feildNames1'?
Question
I've been googling and I cannot find a solution. Would someone please share a working example?
import easygui
#Multi Enter Box
fieldNames1= ['Situation:(Example: Waiting for a friend who is late.)','Thoughts:(EXAMPLE: My friend Bob is always late!)','Emotions:(EXAMPLE: Mad & Stressed)','Behavior:(EXAMPLE: Arguing with family)']
#Write to file
file = open('Log.txt', 'a')
file.write(feildNames1)
file.close()
This is the error that I'm struggling with:
file.write(repr(feildNames1)) NameError: name 'feildNames1' is not defined
Solution
It's a spelling error.
You're setting the fieldNames1
variable, but calling repr()
on feildNames1
. Note the placement of the e
and i
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow