Created
January 18, 2019 02:20
-
-
Save cemeyer/83472d805d22a88ba481f8571a2c4cfd to your computer and use it in GitHub Desktop.
Poor man's nailgun, for when some imports are stupid slow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Other code goes here | |
def run(): | |
pass | |
# ... | |
def main(): | |
global nailgun | |
while True: | |
try: | |
nailgun = importlib.reload(nailgun) | |
except ImportError as e: | |
print("ImportError: {}".format(e)) | |
print("Hit enter to reload") | |
input() | |
continue | |
try: | |
nailgun.run() | |
except Exception as e: | |
print(repr(e)) | |
print("Caught exception in run: {}".format(e)) | |
print("Hit enter to reload/rerun") | |
input() | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment