Dvc: Incorrect error message when importing to non-existent folder

Created on 15 Feb 2020  路  3Comments  路  Source: iterative/dvc

Setup

dvc 0.84.0
Mac, installation via conda

Problem

When importing a file from a git repo into a subdirectory in the current repo, dvc fails with an incorrect error message if the subdirectory does not exist.

To demonstrate this problem, run the following:

## Setup a git repo to import from
mkdir source_repo
cd source_repo
git init
echo Some code > code.txt
git add .
git commit -m "Save some code to this demo repo"

## setup a DVC repo to import from the previous
cd -
mkdir import_repo
cd import_repo
git init
dvc init
git add .
git commit -m "This is a dvc repo that will import some code"

echo --------------------------
echo The next command will fail with an incorrect error message
echo --------------------------
read -rsp $'Press any key to continue...\n' -n1 key

## Attempt an import which will fail
# This command will fail:
dvc import -o some_dir/code.txt ../source_repo code.txt

mkdir some_dir

echo --------------------------
echo Now we have made the output directory, it will succeed
echo --------------------------
read -rsp $'Press any key to continue...\n' -n1 key

dvc import -o some_dir/code.txt ../source_repo code.txt

Expected behavior

Error message stating that the output directory does not exist

Actual behaviour

This error message:

ERROR: failed to import 'code.txt' from '../source_repo'. - The path 'code.txt' does not exist in the target repository '../source_repo' neither as an output nor a git-handled file.

Note that code.txt does exist and is committed to git. DVC successfully imports it if the subdirectory some_dir exists.

bug c8-full-day p1-important

All 3 comments

Hi @charlesbaynham ! Thanks for reporting this issue! I am able to reproduce a similar issue with:

dvc import https://github.com/iterative/dvc scripts/innosetup/dvc.ico -o nonexistent_dir/dvc.ico

But dvc get seems to work fine with the same arguments, so some of our logic has diverged there.
Looking into it...

@charlesbaynham We've done some adjustments to import logic and now I'm getting a different error from your script:

+ dvc import -o some_dir/code.txt ../source_repo code.txt                                                                                              
ERROR: failed to import 'code.txt' from '../source_repo'. - stage working or file path '/home/efiop/git/dvc/myrepo/import_repo/some_dir' does not exist

which has a typo (will send a fix soon), but is now pointing out that the directory doesn't, which is expected behaviour now.

Thank you @efiop ! DVC is great by the way, I'm enjoying using it a lot

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dnabanita7 picture dnabanita7  路  3Comments

robguinness picture robguinness  路  3Comments

dmpetrov picture dmpetrov  路  3Comments

siddygups picture siddygups  路  3Comments

shcheklein picture shcheklein  路  3Comments