Skip to content

Commit

Permalink
Fix script path detection for a stand-alone executable
Browse files Browse the repository at this point in the history
  • Loading branch information
monk-time committed Jan 11, 2018
1 parent 62c9d2f commit 7af431d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion imdb_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
import re
import sys
import time
import zipfile
from pathlib import Path
Expand Down Expand Up @@ -31,7 +32,9 @@ def slugify(s: str) -> str:


def load_imdb_cookies():
script_path = Path(__file__).resolve().parent
"""Read an IMDb 'id' cookie from the folder containing the script or executable."""
# https://pyinstaller.readthedocs.io/en/stable/runtime-information.html#using-sys-executable-and-sys-argv-0
script_path = Path(sys.argv[0]).resolve().parent
cookie_path = script_path / COOKIE_FNAME

if cookie_path.exists():
Expand Down

0 comments on commit 7af431d

Please sign in to comment.