NishantTharani / LogSeqToObsidian

Some tools to help move my notes from LogSeq to Obsidian
101 stars 15 forks source link

Syntax error thrown when running on Ubuntu 20.04 #11

Closed walkabout21 closed 6 months ago

walkabout21 commented 6 months ago

Python 2.7.18

python convert_notes.py -logseq ~/nextcloud/Notes/ --output ~/Documents/obsidian
  File "convert_notes.py", line 37
    def is_markdown_file(fpath: str) -> bool:
                              ^
SyntaxError: invalid syntax

Python 3.8.1

Traceback (most recent call last):
  File "convert_notes.py", line 58, in <module>
    def get_markdown_file_properties(fpath: str) -> tuple[dict, int]:
TypeError: 'type' object is not subscriptable

I'm not sure why this is throwing this syntax error when I run

NishantTharani commented 6 months ago

Hi @walkabout21 , could you try running it using the latest Python version (or, at least 3.10)? I think that specifying the type of member elements through tuple[dict, int] is only supported in Python 3.9 onwards. Sorry!

If this isn't possible then you could try removing all the type hints from the script.

There may be multiple issues with running this using Python 2, I'm afraid I cannot look into them, I would suggest sticking to Python 3.

NishantTharani commented 6 months ago

PS if you're unfamiliar with Ubuntu, you can update Python by running sudo apt update && sudo apt upgrade -y. After that you can run python3 --version to see what version of Python is now present, then try running the script again.

walkabout21 commented 6 months ago

I'm using the highest version available in ubuntu 20.04 apt packages. I will have to look into if upgrading the python version will cause any os/application issues for me. I've been using Ubuntu for about 15 years and update/upgrade daily. Normally I use Python3 but I was just checking with Python 2 in case it was a legacy problem. Will upgrade my Python version if possible and get back to you.

walkabout21 commented 6 months ago

There was a PPA I used to install a tagged 3.9 version. I ran with that it appeared to resolve. Thanks! Closing the issue.