Comments (3)
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.
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.
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)
- Add support dependency search HOT 1
- Dependency error: typing-extensions>=4.1.0 and typing_extensions<4.0.0 HOT 2
- Dependency issue with `typing_extensions` HOT 1
- Support Terraform package type HOT 1
- Setting/Updating artifact properties is uploaded with semicolons HOT 1
- How to support python 2.7 HOT 2
- pyart.permissions.get doesn't work for some permissions (but API does) HOT 1
- This REST API is available only in Artifactory Pro HOT 1
- pydantic v2 support HOT 9
- How to create Artifactory instance using only access token? HOT 2
- Creating a local repository using LocalRepository object throws Pydantic validation errors HOT 1
- Support new CreateToken API/allow setting custom scope HOT 2
- Can't list repositories on a private repo HOT 1
- Pydantic validation error when creating local repository in Artifactory HOT 1
- Support for AQL
- Failing validation of SimpleUser HOT 1
- Builds API missing HOT 2
- Include huggingfaceml as valid package type
- Create repo transmits "*****" as password (from SecretStr __str__()) HOT 1
- Upload with Checksum does not work --> creates empty file in artifactory HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-artifactory.