Skip to content
This repository has been archived by the owner on Jan 27, 2025. It is now read-only.

Commit

Permalink
Fix not saving session after adb connection error
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Mishchenko committed Aug 22, 2020
1 parent 6f8815a commit 36c759e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@ def close_instagram(device_id):
def take_screenshot(device):
os.makedirs("screenshots/", exist_ok=True)
filename = "Crash-" + datetime.now().strftime("%Y-%m-%d-%H-%M-%S") + ".png"
device.screenshot("screenshots/" + filename)
print(COLOR_OKGREEN + "Screenshot taken and saved as " + filename + COLOR_ENDC)
try:
device.screenshot("screenshots/" + filename)
print(COLOR_OKGREEN + "Screenshot taken and saved as " + filename + COLOR_ENDC)
except RuntimeError:
print(COLOR_FAIL + "Cannot save screenshot." + COLOR_ENDC)


def print_copyright(username):
Expand Down

0 comments on commit 36c759e

Please sign in to comment.