Wrong error message from `SaveScreenshot` when save directory doesn't exist

When I use the following line in python trace, pvpython complains that it has run out of disk space when the directory passed doesn’t exist. This is a misleading error message and hopefully straightforward to fix. I don’t know if anyone else is also getting this. Just wanted to report it here for developers to take notice.

SaveScreenshot(f'{screenshot_loc}/screenshot-{file_no:04d}.png', layout1, SaveAllViews=1,
    ImageResolution=[1102, 664],
    FontScaling='Scale fonts proportionally',
    SeparatorWidth=1,
    SeparatorColor=[0.937, 0.922, 0.906],
    OverrideColorPalette='',
    StereoMode='No change',
    TransparentBackground=0, 
    # PNG options
    CompressionLevel='0',
    MetaData=['Application', 'ParaView'])

Cc: @cory.quammen @mwestphal

Indeed, I reproduce. Could you open an issue @dutta-alankar ?

https://gitlab.kitware.com/paraview/paraview/-/issues

@mwestphal Done!

paraview/paraview#22445

The full message is the following:

vtkPNGWriter (0x5bc13f0e7bf0): Unable to open file /home/local/KHQ/spiros.tsalikis/Download/cantestTwo.png

ERROR: In vtkImageWriter.cxx, line 470
vtkPNGWriter (0x5bc13f0e7bf0): Ran out of disk space; deleting file(s) already written

First it says that it can not open that file, and about the disk space, but i will see what i can do.