Can anyone help with some python and flask please | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone help with some python and flask please

Hello all, I'm currently working on a schoolproject in which i'm building a Python program of a simple elevator with 3 floors. i have 2 Python modules: one(FinalLift.py) which is my working elevator program an the other is a flask(FlaskServer.py) file in which i'm trying to import and display values in a webinterface. I want FinalLift.py running in a separate console and the flaskServer.py in another console if possible. My project tree in pycharm is as follows: FinalLift -static -style.css -template -index.html -venv -FinalLift.py -FlaskServer.py As mentioned i really would like to use the variables s1,s2,s3 and etage, and would like to overwrite them from the webinterface if posible. Any help would be appreciated. Thanks in advance. codes below: FinalLift.py from os import system, name etage= 1 s1=0 s2=1 s3=1 while True: def downWards(): print("Lift daalt naar {}\n".format(nieuwEtage)) def downWards(): print("Lift daalt naar {}\n".format(nieuwEtage)) def upWards(): print("Lift stijgt naar {}\n".format(nieuwEtage)) def processStop(): print("\nLift bevindt zich al op de gegeven etage: {}".format(etage),'\nHet bewegen is gestopt\n') def checkEtage(): global etage s1 = int(input("Sensors voor etage 1 zijn: ")) s2 = int(input("Sensors voor etage 2 zijn: ")) s3 = int(input("Sensors voor etage 3 zijn: ")) print("\n") print("S2 = {}".format(s2)) print("S1 = {}".format(s1)) print("S3 = {}".format(s3)) if s1 == 0 and s2 == 1 and s3 == 1 : etage = 1 #print("Liftkamer is nu op etage 1") elif s1 == 1 and s2 == 0 and s3 == 1 : eta

17th Apr 2020, 6:03 PM
Merhai Akshay
Merhai Akshay - avatar
2 Answers
+ 4
You have def downWards() defined twice. This is ambiguous and won't work. P.S. post code in the playground and link it to your posts. It's much easier for people to read that way. A very small snippet isn't a big deal to post like this, but when they are more than just a few lines it is strongly advised to link to them.
17th Apr 2020, 7:00 PM
ChaoticDawg
ChaoticDawg - avatar
0
Ok buddy
17th Apr 2020, 7:17 PM
Merhai Akshay
Merhai Akshay - avatar