Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: when running khalorg from a venv, the global khal executable is … #5

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/khalorg/khal/calendar.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import logging
from os.path import dirname, join
import sys
from datetime import date, datetime
from typing import Callable, Iterable, TypedDict, Union

Expand Down Expand Up @@ -84,8 +86,9 @@ def __init__(self, name: str):
"""
path_config: Union[str, None] = find_configuration_file()

new_item_args: list = ["python3", "-m", "khal", "new"]
list_args: list = ["python3", "-m", "khal", "list", "-df", ""]
khal_bin: str = join(dirname(sys.executable), 'khal')
new_item_args: list = [khal_bin, "new"]
list_args: list = [khal_bin, "list", "-df", ""]

self._collection: CalendarCollection
self._new_item: Callable = subprocess_callback(new_item_args)
Expand Down
3 changes: 1 addition & 2 deletions src/khalorg/khal/helpers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
import sys
from datetime import date, datetime
from subprocess import STDOUT, CalledProcessError, check_output
from typing import Callable
Expand Down Expand Up @@ -72,7 +71,7 @@ def callback(args: list) -> str:

def try_check_output(args: list) -> bytes:
try:
return check_output(args, stderr=STDOUT, executable=sys.executable)
return check_output(args, stderr=STDOUT)
except CalledProcessError as error:
error_message: str = (
f"The following arguments were sent to khal:\n\n{' '.join(args)}"
Expand Down