Message from Python discussions
November 2018
— You are probable german so you are from a better mankind
Hi 🙂 I have a problem. Maybe some can help me 😄. I have to call a function from list but the function in the list needs the dictionary data as a parameter to work. I know how to call the function from the list but I can't get it to work with the dictionary. Does anyone know how to fix this 🙂.
— It'll be more clear if you post your code with proper comments
— Or error
— **
— Okay, heres an example of my code:
import Display #import Display Python File
Data = {"time":"12:00:00"} #Dictionary
list = [Display.Hours] #List with function
list[0](Data) #call function from list
The Error i get is:
AttributeError: module 'Display' has no attribute 'Hours'
Display code:
def Hours(Data):
print("current time: ", Data["time"])
— Then you have two display files
— Import the right one
— I only have one Display file in my working directory, i renamed it to DisplayMetric and changed the name in my code to make sure i have the right file. But I get the same Error.
— Your code is working for me.
— That's confusing
— On my raspberry pi under python 3.4 and my Laptop with python 3.7 i can't get it to work