Sep-09-2018, 12:06 AM
Quote:if you only want this to run if the program is executed from command routine, change to:Suprisingly enough, the
if __name__ == '__main__': # If a giveaway is saved in memory, load it automaticly db = database.database() db.init() print(db.data["userdata"]["help"])
if '__name__' == '__main__':
fixed it.Quote:Works fine for me (2.7 and 3.6). I did put all the code in one file, and changed the file names, but I don't think that should have changed anything. How exactly are you calling the program?I'm running it from importing a different file.
(init.py)
initmsg = ["``dsconfig\nInitializing Utilities (Spooper/Utilities/__init__.py)\n\n"] initmsg.append("Initializing Database.py (Spooper/Utilities/database.py)\n") import Utilities.database as database initmsg.append("Finished Initializing Database.py (Spooper/Utilities/database.py)\n\n") initmsg.append("Initializing Giveaway.py (Spooper/Utilities/giveaway.py)\n") import Utilities.giveaway as giveaway initmsg.append("Finished Initializing Giveaway.py (Spooper/Utilities/database.py)\n\n") initmsg.append("Finished Initializing Utilities (Spooper/Utilities/__init__.py)\n") initmsg.append("\n``") initmsg = ''.join(initmsg)