deepjyoti30/downloader-cli

ERROR 'is a directory'

matze19999 opened this issue · 9 comments

Everytime I try to download a file I get the error '{foldername} is a directory'.
des= the foldername I wan't to download the file to.

Where is the error?

image

Thanks!

des is the actual path where you want it to save the file. You're not downloading it into /downloads, you're trying to save it as /downloads

(incidentally, that's an odd place for a downloads folder 😉)

I think what you're trying to do would be a great feature request (@deepjyoti30?) but idk if this util can currently do it. However, if you cd into that directory and run it without the des param, that'll work.

Thanks for the explanation, I think I understood the docs wrong.

But would be nice if this would work anyways :)

The path is /downloads, because this is a docker container :)

I would never do this on my host system😅

@ChanceNCounter What you said is a valid explanation but since a few releases now, downloader-cli automatically extracts the name of the file if the directory is passed in the des field. You can check this line in the source code for referance.

The error that @matze19999 reported is very weird. I just tried the exact same thing (with a different download file URL) and passed a directory as the des field and the file was downloaded without any error. The name was extracted automatically as well.

@matze19999 We will need some more details about this error. Which machine are you in exactly? Did you try downloading using the dw command that exposed downloader-cli?

Also, can you try downloading some other file in the exact same way and see if the error still shows up? Try this file: https://github.com/yourkin/fileupload-fastapi/raw/a85a697cab2f887780b3278059a0dd52847d80f3/tests/data/test-5mb.bin

With your url and without the des parameter, I get this output:

image

Sounds pretty strange to me.

I never heard of the dw command. Can you help me with that?

I have full permission on the download folder btw.
I'm using the latest version of downloader-cli

I'm using a docker container with ubuntu:latest as base image

@matze19999 The dw command is basically how we expose the downloader-cli tool to be used directly from the commandline.

From the README:

usage: dw [-h] [-f | -c] [-e] [-q] [-b] [-v] SOURCE [TARGET]

positional arguments:
  SOURCE           URL of the file
  TARGET           target filepath (existing directories will be treated as
                   the target location)

optional arguments:
  -h, --help       show this help message and exit
  -f, -o, --force  overwrite if the file already exists
  -c, --resume     resume failed or cancelled download (partial sanity check)
  -e, --echo       print the filepath to stdout after downloading (other
                   output will be redirected to stderr)
  -q, --quiet      suppress filesize and progress info
  -b, --batch      Download files in batch. If this flag is passed the passed
                   source will be considered as a file with download links
                   seperated by a newline. This flag will be ignored if source
                   is a valid URL.
  -v, --version    show the program version number and exit

Also, @matze19999 What's the system you're running it on? What is the host OS and the what's the container image?

same error when using dw.

my host system is ubuntu server 21.04.
the container image is ubuntu:latest

this is the dockerfile I'm using
Dockerfile.txt

@matze19999 Thanks for the dockerfile. It doesn't indicate the presence of any directory named /downloads. It's hard to debug the error without logs. I'll try to reproduce the error using the dockerfile you shared.

Also, do you get the same error on the host OS? (Ubuntu)

@deepjyoti30 the folder isn't created, its mounted from the host system into the container. But this doesn't make a difference, it also doesn't work for folder I created inside the container.

But I found the error now (I feel a bit stupid):

I had to write "/downloads/", not "/downloads"

Otherwise, downloader-cli thinks I wanna save the filename with the filename /downloads, but this already exists and is a folder.

Sorry for my stupidity 😅