From c427e08f959113a0beeffc60eaa0dbfd5db4f08f Mon Sep 17 00:00:00 2001 From: Ian Burgwin Date: Mon, 9 Apr 2018 22:55:00 -0700 Subject: [PATCH] strip target_path of whitespace e.g. prevents issue with whitespace being added when a user drags a file to the terminal on mac --- servefiles/servefiles.py | 1 + 1 file changed, 1 insertion(+) diff --git a/servefiles/servefiles.py b/servefiles/servefiles.py index ad3ecec..9fb4a4d 100644 --- a/servefiles/servefiles.py +++ b/servefiles/servefiles.py @@ -78,6 +78,7 @@ else: print('Detecting host IP...') hostIp = [(s.connect(('8.8.8.8', 53)), s.getsockname()[0], s.close()) for s in [socket.socket(socket.AF_INET, socket.SOCK_DGRAM)]][0][1] +target_path = target_path.strip() if not os.path.exists(target_path): print(target_path + ': No such file or directory.') sys.exit(1)