Git Product home page Git Product logo

Comments (3)

anancarv avatar anancarv commented on September 13, 2024

Hi @stefanseefeld
The download method is based on the Retrieve artifact endpoint from the artifactory API which retrieves an artifact from a specified destination. As you can see on the example in the README, the function expects the absolute path of the artifact, not the folder within in it resides.

artifact = art.artifacts.download("my-artifactory-repository/my/new/artifact/file.txt", "Desktop/my/local/directory")

In the trace you sent. It is written that some-path is a directory path instead of an actual artifact path

IsADirectoryError: [Errno 21] Is a directory: 'some-path/'

Downloading directories recursively is not yet implemented by this library and I'm not sure it's even implemented by Jfrog. However, you can use the Retrieve Folder or Repository Archive that retrieves an archive file (supports zip/tar/tar.gz/tgz) containing all the artifacts that reside under the specified path (folder or repository root). It requires Enable Folder Download to be set.

Let me know if you have any questions
Cheers

from python-artifactory.

stefanseefeld avatar stefanseefeld commented on September 13, 2024

Hi @anancarv , thank you for your prompt reply !
I have just looked at the code in pyartifactory.objects.ArtifactoryArtifact.download(). The first argument is the name of the artifact to be downloaded, the second argument is the name of a local directory into which to download it. Line 804 makes sure the local directory (and its parents) exist, so this is why in my case the directory was created. The real problem is in line 801:
local_filename = artifact_path.split("/")[-1]
In my case, that yields '', because my artifact name ends with '/' (i.e., is a directory). This means local_file_full_path will refer to an existing directory, rather than a not-yet-existing file-within-a-directory, and thus line 810 will trigger the exception I reported.

It thus turns out the expectation is that the first argument to the download() method is expected to refer to a file, not a directory, which the error should explain.

OK, so I now understand that downloading and uploading directories isn't working - yet, so I will write my own wrapper to support directory navigation (perhaps akin to os.listdir()).
Just out of curiosity: would you be interested in such a contribution to pyartifacts ? (I'm also writing a command-line tool akin to the Jfrog CLI, but supporting the above functionality.
(I'm working with a couple of "generic" artifact repositories which we use to store data files, and I would like to be able to access them from within Python (e.g. jupyter notebooks).

Thanks !

from python-artifactory.

anancarv avatar anancarv commented on September 13, 2024

You're welcome 😉.
Sure, it would be great to have this functionality in pyartifactory, I'm looking forward your contribution.

from python-artifactory.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.