tobixen / plann

Command-line interface to calendars
GNU General Public License v3.0
44 stars 2 forks source link

The Windows Experience 🪟 #5

Closed jspraul closed 1 year ago

jspraul commented 1 year ago

Should be reproducible in Windows Sandbox:

Running plann indicates a dependency on PyYaml:

File "C:\Users\WDAGUtilityAccount\scoop\apps\python\current\Lib\site-packages\plann-0.15-py3.11.egg\plann\config.py", line 3, in <module>
ModuleNotFoundError: No module named 'yaml'

Running plann indicates a dependency on a HOME environment variable:

  File "C:\Users\WDAGUtilityAccount\scoop\apps\python\current\Lib\site-packages\plann-0.15-py3.11.egg\plann\cli.py", line 236, in <module>
  File "<frozen os>", line 679, in __getitem__
KeyError: 'HOME'

With those two missing pieces things seem to work.

Windows Sandbox seems to indicate Windows does have the combinable HOMEDRIVE + HOMEPATH environment variables.

tobixen commented 1 year ago

Thanks for your feedback.

The missing PyYAML is a bug that could have easily been spotted if I would have had github running tests for every commit. I will set it up at some point in the not-too-far future.

The code referencing HOME has been sort of fixed:

-@click.option('-c', '--config-file', default=f"{os.environ['HOME']}/.config/calendar.conf")
+@click.option('-c', '--config-file', default=f"{os.environ.get('HOME')}/.config/calendar.conf")

... obviously the new default also won't work on "exotic OS distributions" (even asserting the presence of $HOME/.config may break on Linux). Suggestions for a more robust default value here is welcome. Anyway, file/directory not found is an expected exception so it should not break with a traceback anymore. (I hope. Did not test. I really should write up lots of test code on this one - but currently I'm prioritizing to hack up something that is useful for me).

jspraul commented 1 year ago

Re-ran the steps provided and it's all clear.

tobixen commented 1 year ago

Re-ran the steps provided and it's all clear.

thanks