![]() |
Updating existing Py app - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Updating existing Py app (/thread-10698.html) |
Updating existing Py app - n8bizall - Jun-01-2018 I am a JR .NET developer and have only a couple hours of basic Python training. I have been tasked with updating an existing py application. In the code snippit below I have added the green to the existing function. I have 2 questions. Does there look like any potential errors with my added snippet? And now that the change is made how to I push this to the executable? I am definitely more concerned with saving it to the exe. ![]() def additem(): results=msSQL.query("SELECT ID FROM TradePulse.dbo.chainauth WHERE ID='{0}';" .format(item_number_entry.get()+LocalDB.settings('chainid'))) ar = results[0] [color=#2ECC71]stmt= "SELECT DeletedItemV.Item FROM DeletedItemV LEFT OUTER JOIN ItemV ON (DeletedItemV.Item = ItemV.Item)WHERE ItemV.Item IS NULL"[/color] if len(ar) > 0: root = tk.Tk() root.withdraw() messagebox.showerror("Chain ID Error", 'Choose a different item number, the entered selected already exists.') [color=#27AE60] # if the item has been deleted and is not active in all warehouses do not allow to add if ar == stmt: root = tk.Tk() root.withdraw() messagebox.showerror("Item ID Error", 'Choose a different item number, the entered selected already has been cancelled.')[/color] if len(ar) == 0: chain=LocalDB.settings('chainid') item=item_number_entry.get() altcode=item_retail_entry.get() if altcode=='AltCode': altcode='' msSQL.queryExecute("INSERT TradePulse.dbo.chainauth (ITEM,CHIND,AltCode,ID) VALUES ({0},'{1}','{2}','{3}');" .format(item,chain,altcode,item+chain)) item_name_txt.set('Item#') item_retail_txt.set('AltCode') item_grid(itemQuery()) RE: Updating existing Py app - Larz60+ - Jun-01-2018 Your indentation appears to be incorrect. After a function (or method) definition (def) code should be indented 4 spaces. After conditionals an additional 4 spaces and so on. RE: Updating existing Py app - n8bizall - Jun-01-2018 The indentation was messed up due to how I copy pasted. I only added the green code. The rest was already there and working fine. I was able to find a program to turn my .py into .exe however I think I am over my head when trying to put the program back together. |