Skip to content

Instantly share code, notes, and snippets.

@cemeyer
Created January 18, 2019 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cemeyer/83472d805d22a88ba481f8571a2c4cfd to your computer and use it in GitHub Desktop.
Save cemeyer/83472d805d22a88ba481f8571a2c4cfd to your computer and use it in GitHub Desktop.
Poor man's nailgun, for when some imports are stupid slow
# 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