Maboroshy / Note-Station-to-markdown

The cross-platform script that converts notes from Synology Note Station to markdown files
Apache License 2.0
240 stars 51 forks source link

ModuleNotFoundError: No module named 'distutils' #31

Closed thwismer closed 8 months ago

thwismer commented 8 months ago

I get the error "ModuleNotFoundError: No module named 'distutils'" when running but it seems distulis is legacy?

https://docs.python.org/3.10/library/distutils.html

Am I doing it wrong?

Thanks in advance.

Maboroshy commented 8 months ago

I've removed distutils dependency. Please test the new version.

thwismer commented 8 months ago

Thank you so much. This worked like a bliss!

The only thing that is not working is that for some images there are the wrong links. It just puts the link like this:

![](webman/3rdparty/NoteStation/images/transparent.gif)

The image itself is present in the "media" folder.

My settings are as following: `

Select file link options

links_as_URI = False # True for file://link%20target style links, False for /link target style links absolute_links = False # True for absolute links, False for relative links

Select File/Attachments/Media options

media_dir_name = 'media' # name of the directory inside the produced directory where all images and attachments will be stored md_file_ext = 'md' # extension for produced markdown syntax note files creation_date_in_filename = False # True to insert note creation time to the note file name, False to disable. `

Maboroshy commented 8 months ago

Could you upload the .nsx file with the note that has such broken links.

thwismer commented 8 months ago

thank you very much for responding.

I am still trying to replicate it with only a portion of my notes. I can only consistently reproduce it with a full blown notebook with like 100 notes upwards. but there it never works flawlessly. One thing that might be related is that I notice this weird image naming: https://imgur.com/7X76tt5 I imagine that if I had 100 more notes the file names would get too long for windows at some point. E. g. in the error log from console of my full blown nsx file i find something like this: Can't find attachment "Bild_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20_21_22_23_24_25_26_27_28_29_30_31_32_33_34_35_36_37_38_39_40_41_42_43_44_45_46_47_48_49_50_51_52_53_54_55_56_57_58_59_60_61_62_63_64_65_66_67_68_69_70_71_72_73_74_75_76_77_78_79_80_81_82_83_84_85_86.jpg" of note "Asia-Sesam-Burger"

If i go into said note "Asia-Sesam-Burger" it's exactly a case like this where it would show: ![](webman/3rdparty/NoteStation/images/transparent.gif)![](webman/3rdparty/NoteStation/images/transparent.gif)![](webman/3rdparty/NoteStation/images/transparent.gif)

This sounds like one hell of a filename and I'm pretty sure it has not been named like this before ;)

Maboroshy commented 8 months ago

I've fixed the naming issue. Please, test the new version.

thwismer commented 8 months ago

thank you so much! Most of it works now but I still have the same error in large notebooks.

I can't replicate it when I isolate the culprit notes in a small notebook. It only happens in large notebooks.

Maboroshy commented 8 months ago

I've converted your notebook and loaded it to Obsidian.

The issues I've seen:

  1. ![](webman/3rdparty/NoteStation/images/transparent.gif) dead links. Looks like fixable.
  2. The spaces in links issue. Obsidian wants links without file:// but with %20 instead of spaces. The script has no option for that style currently. I should make link options more customizable. Maybe I should set Obsidian style markdown as default since it has become a very popular app.
  3. ![](media/webpc-passthru.php) dead links. These "php" files have image content. Looks like some Note Station link format not implemented in the script. I didn't have it in my test notes. I'm not sure how to get the original file names for these, maybe I'll have to stick with image.jpg and hope that it is always jpg file and not png or something.
  4. Some pandoc warnings that don't look important.

Anything I've missed?

Maboroshy commented 8 months ago

![](media/webpc-passthru.php) links has application/octet-stream MIME type, that hints it can be any format. Obsidian and most other apps can't handle unknown format by themselves. Implementing file format detector into script is too much for it's scale. I'll try to put on something but I can't see a way to reliably convert these "phps" for now.

thwismer commented 8 months ago

Thank you so much! ![](webman/3rdparty/NoteStation/images/transparent.gif) is the main issue I think.

For the php thing it would be good enough to have a log with the affected notes so they can be fixed manually after import. What do you think?

I don't understand the link one? Isn't your script migrating them correctly? I was not even aware of any such error? Is it only if image names have a space in them?

Maboroshy commented 8 months ago

For the php thing it would be good enough to have a log with the affected notes so they can be fixed manually after import. What do you think?

Will do. I'm also thinking about some option for dumb putting jpg extension for them. That would be up to user to use it or not.

I don't understand the link one? Isn't your script migrating them correctly? I was not even aware of any such error? Is it only if image names have a space in them?

It does migrate it correctly but not the Obsidian correctly. I saw broken link to pdf attachment in one of your notes with the issue. I'll move the spaces handling to it's own option.

Maboroshy commented 8 months ago

I've done number 1 and 2. Please, test the new version.

thwismer commented 8 months ago

Thank you so much Maboroshy! I've tested the new version and still need time but so far everything looks perfect. Thank you so much for helping to migrate several thousand notes! Feel free to leave your paypal or anything for donation.

Maboroshy commented 8 months ago

I've implemented a warning for ![](media/webpc-passthru.php) dead links. I found no reliable way to convert them. Only only one of your notes has them, maybe it's a single broken note.

I've also implemented unconverted tables warning. You notes has a few. I haven't found pandoc options to convert them.

I think I've resolved every mentioned issue. There's no need for donation but I appreciate the suggestion.