nnpdf icon indicating copy to clipboard operation
nnpdf copied to clipboard

vp-upload . should infer the right filenames

Open Zaharid opened this issue 4 years ago • 0 comments

I was trying to upload a PDF from the folder I was in and got

$ vp-upload .
[INFO]: Detected pdf input
[INFO]: Checking SSH connection to [email protected].
[INFO]: Connection seems OK.
[ERROR]: A pdf with the same name already exists on the server. To overwrite it use the --force flag, as in `vp-upload <pdf_name> --force.
Traceback (most recent call last):
  File "/home/zah/anaconda3/bin/vp-upload", line 33, in <module>
    sys.exit(load_entry_point('validphys', 'console_scripts', 'vp-upload')())
  File "/home/zah/nngit/nnpdf/validphys2/src/validphys/scripts/vp_upload.py", line 80, in main
    pass
  File "/home/zah/anaconda3/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "/home/zah/nngit/nnpdf/validphys2/src/validphys/uploadutils.py", line 249, in upload_or_exit_context
    yield
  File "/home/zah/anaconda3/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "/home/zah/nngit/nnpdf/validphys2/src/validphys/uploadutils.py", line 242, in upload_context
    res = self.upload_output(output_path, force)
  File "/home/zah/nngit/nnpdf/validphys2/src/validphys/uploadutils.py", line 227, in upload_output
    raise UploadError
validphys.uploadutils.UploadError

That PDF didn't exist, and if I had followed the suggestion and used --force that would presumably have had overwritten . which is a terrible idea.

We should both resolve the folder name as well as possible (i.e. from the absolute path) and print what the conflicting name is.

Zaharid avatar Dec 17 '21 11:12 Zaharid