kootenpv / whereami

Uses WiFi signals :signal_strength: and machine learning to predict where you are
GNU Affero General Public License v3.0
5.1k stars 247 forks source link

Don't show stacktrace when using Ctrl-C #39

Closed fedekau closed 7 years ago

fedekau commented 7 years ago

If you run whereami predict and before is has finished you press Ctrl+C to kill the execution you get a Python stacktrace.


$ whereami predict
^CTraceback (most recent call last):
  File "/Users/user/anaconda3/bin/whereami", line 11, in <module>
    sys.exit(main())
  File "/Users/user/anaconda3/lib/python3.5/site-packages/whereami/__main__.py", line 77, in main
    print(predict(args.input_path, args.model_path, args.device))
  File "/Users/user/anaconda3/lib/python3.5/site-packages/whereami/predict.py", line 17, in predict
    data_sample = sample(device) if input_path is None else get_external_sample(input_path)
  File "/Users/user/anaconda3/lib/python3.5/site-packages/whereami/get_data.py", line 15, in sample
    aps = wifi_scanner.get_access_points()
  File "/Users/user/anaconda3/lib/python3.5/site-packages/access_points/__init__.py", line 79, in get_access_points
    out = self.call_subprocess(self.cmd)
  File "/Users/user/anaconda3/lib/python3.5/site-packages/access_points/__init__.py", line 86, in call_subprocess
    (out, _) = proc.communicate()
  File "/Users/user/anaconda3/lib/python3.5/subprocess.py", line 1059, in communicate
    stdout = self.stdout.read()
KeyboardInterrupt```