express-option-chain icon indicating copy to clipboard operation
express-option-chain copied to clipboard

importing OptionStream in windows envionment is throwing error "KeyError: 'HOME'

Open chansarav2020 opened this issue 4 months ago • 2 comments

Describe the bug importing OptionStream in windows envionment is throwing error "KeyError: 'HOME' since "HOME" is used in default parameter of def get_secrets(filename=f'{os.environ["HOME"]}/.kite/secrets'):

Paste the code from expressoptionchain.option_stream import OptionStream

Expected behavior A clear and concise description of what you expected to happen.

Exceptions If applicable, add screenshots to help explain your problem.

Operating System windows

Additional context Add any other context about the problem here.

chansarav2020 avatar Aug 07 '25 17:08 chansarav2020

In helper.py , pls replace def get_secrets(filename=f'{os.environ["HOME"]}/.kite/secrets'): with def get_secrets(filename=None): if filename is None: home = os.environ.get("HOME") or os.path.expanduser("~") filename = f"{home}/.kite/secrets"

chansarav2020 avatar Aug 07 '25 17:08 chansarav2020

Thanks for the bug report. Until I fix it, please either pass the filename to get_secrets or set environment variable HOME.

Workaround 1: Set the HOME Environment Variable

In Command Prompt (cmd.exe):

set HOME=%USERPROFILE%
python your_script.py

Workaround 2: Pass the filename to get_secrets()

secrets = get_secrets(filename=secrets_path)

pramakrishn avatar Aug 07 '25 21:08 pramakrishn