-2

It seems that saving files with long names leads to problems for some reason. I won't write code here since it is hard to reproduce, but below is an image that shows this issue.

Folder structure definitely exists, you can see that for some filenames it works just fine. But then for other names without any weird special characters it fails. code snipper

I have tried other variants like giving absolute path, but still it seems to fail. Is there maybe a fix to this, other than saving a file with a timestamp perhaps or some other kind of unique random naming?

EDIT
For more clarification, folder structure is the same for each of the 5 examples (everything up to the last \), I have only changed filename and for 3 examples it works fine but for other 2 it doesn't.

Karl Knechtel
  • 62,466
  • 11
  • 102
  • 153
DoctorEvil
  • 453
  • 3
  • 6
  • 18
  • https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-on-so-when-asking-a-question – Thierry Lathuille Sep 26 '21 at 17:16
  • I guess you put TD. But this is a problem that is tedious to replicate, image is there so that it is clear that I didn't mess up anything like not changing working directory or something. – DoctorEvil Sep 26 '21 at 17:19
  • 1
    But your image is of a block of text. Why not just copy the text and paste it into your question? – quamrana Sep 26 '21 at 17:21
  • Windows has filename length limits on some versions of the file systems. I'm wondering if your longest file names are too long for your filesystem,. since they are the ones failing. Are you able to manually create that path using the File Explorer? That would confirm if the filename length is the problem or not. – joanis Sep 26 '21 at 17:42
  • You should still post that code and the error message as text in the post, by the way. This question will probably get closed shortly as it stands, mostly because of the code and error as image. – joanis Sep 26 '21 at 17:45

1 Answers1

0

You are using path as DATA\\... but path should be either .\\DATA: which means path from current directory or, specify your Drive Name in starting like: C:\\...\\DATA...