Note-Station-to-markdown icon indicating copy to clipboard operation
Note-Station-to-markdown copied to clipboard

OSError: [Errno 63] File name too long

Open cukabeka opened this issue 2 years ago • 5 comments

Hi,

I got this OSError: [Errno 63] File name too long on MacOS for a file named /media/b9e5d7dfb4f4315b201e813e77057476_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.jpeg

Anything possible to at least skip this then? Or better rename it somehow?

cukabeka avatar Jan 05 '23 23:01 cukabeka

Could you post the full text of an error. Looks like an easy fix.

Maboroshy avatar Jan 06 '23 10:01 Maboroshy

Great, thanks!

Here's the traceback:

    Traceback (most recent call last):
      File "/Users/data/nsx2md.py", line 232, in <module>
        while Path(parent_notebook.media_path / name).is_file():
      File "/opt/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/pathlib.py", line 1322, in is_file
        return S_ISREG(self.stat().st_mode)
      File "/opt/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/pathlib.py", line 1097, in stat
        return self._accessor.stat(self, follow_symlinks=follow_symlinks)
    OSError: [Errno 63] File name too long: '/media/b9e5d7dfb4f4315b201e813e77057476_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.jpeg'

cukabeka avatar Jan 07 '23 02:01 cukabeka

I've updated the script. Please, try the new version.

Maboroshy avatar Jan 08 '23 14:01 Maboroshy

Hi @Maboroshy thanks for looking into this. Still getting that error:

  Traceback (most recent call last):
    File "/Users/data/nsx2md.py", line 232, in <module>
      while Path(parent_notebook.media_path / name).is_file():
    File "/opt/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/pathlib.py", line 1322, in is_file
      return S_ISREG(self.stat().st_mode)
    File "/opt/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/pathlib.py", line 1097, in stat
      return self._accessor.stat(self, follow_symlinks=follow_symlinks)
  OSError: [Errno 63] File name too long: '/Users/data/media/b9e5d7dfb4f4315b201e813e77057476_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.jpeg'

From what I see, it's still exactly the same. I saw you reduced the name length, but for some reason this seems to not work in that case.

Over at reddit I found some snippet, but my PyKnowledge isn't ready for estimating whether that's useful.

cukabeka avatar Jan 12 '23 20:01 cukabeka

Interesting. I'll look into this.

Maboroshy avatar Jan 12 '23 20:01 Maboroshy

Fixed error in media files naming that caused the issue.

Maboroshy avatar Mar 20 '24 10:03 Maboroshy