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

Windows: Corrupted display and other problems #1360

Open
sledgehammer999 opened this issue Sep 22, 2024 · 1 comment
Open

Windows: Corrupted display and other problems #1360

sledgehammer999 opened this issue Sep 22, 2024 · 1 comment

Comments

@sledgehammer999
Copy link

Describe the bug
I know that Windows isn't officially supported.
I am writing this in case you can trivially fix this.
Along the way I have discovered 2 other issues which seem trivial and you might benefit in solving anyway.

I have installed khal with pipx. I did the same with vdirsyncer. I configured both of them correctly. I am using both programs in linux so I tried my luck with Windows too.

I discovered 3 issues. I was able to hack around 2 of them. For the 3rd one I have no idea what is happening or how to solve it.

Issue 1

After a clean install ikhal will try to create the sqlite3 database at the default place. Namely, on Windows, C:\Users\<username>\.local\share\khal\khal.db. However, the last part of the path, khal.db, is created as a folder instead of as a file.
Current solution: Set ~/.local/share/khal/khal.db in the config. (the tilde vs the full path probably doesn't matter).

Issue 2

During startup, ikhal tries to figure out if the local calendar is modified and ends up in this code:

elif isinstance(f, str):
flags = 0
if os.path.isdir(f):
flags = os.O_DIRECTORY
f = os.open(f, flags)
close_f = True

The constant os.O_DIRECTORY isn't available on Windows and the program crashes.
Secondly, I tried to understand the logic of the function and it doesn't make sense in the context of a vdir calendar. The f variable wll point to a directory. On Windows, you can't os.open() a directory. It fails with PermissionError: [Errno 13] Permission denied:.
So I slightly changed the function to get it working with this diff:

index 2b3e688..07e75a3 100644
--- a/khal/khalendar/vdir.py
+++ b/khal/khalendar/vdir.py
@@ -71,18 +71,18 @@ def get_etag_from_file(f) -> str:
     if hasattr(f, 'read'):
         f.flush()
         f = f.fileno()
-    elif isinstance(f, str):
-        flags = 0
-        if os.path.isdir(f):
-            flags = os.O_DIRECTORY
-        f = os.open(f, flags)
-        close_f = True
+    # elif isinstance(f, str):
+    #     flags = 0
+    #     if os.path.isdir(f):
+    #         flags = os.O_DIRECTORY
+    #     f = os.open(f, flags)
+    #     close_f = True

     # assure that all internal buffers associated with this file are
     # written to disk
     try:
-        os.fsync(f)
-        stat = os.fstat(f)
+        # os.fsync(f)
+        stat = os.stat(f)
     finally:
         if close_f:
             os.close(f)

Issue 3

Finally, ikhal can now start. But the display is totally corrupted. Take a look at the attached screenshot.
Keep in mind, that I run a non-english Windows version (greek locale).
The display is corrupted both in cmd and in bash (from git for windows). Both are integrated in Terminal.
In bash, LANG is exported as en_GB.UTF-8.
ikhal

OS, version, khal version and how you installed it:

  • The output of khal --version: 0.11.3
  • Installation method: pipx
  • python version: 3.11.2
  • OS: Windows 10
@DGrothe-PhD
Copy link

Want to try this on my (German) machine. I am stuck with not understanding which config you were setting and how:

Current solution: Set ~/.local/share/khal/khal.db in the config. (the tilde vs the full path probably doesn't matter).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants