Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in harvesting metadata from codemeta.json #275

Open
Aidajafarbigloo opened this issue Oct 2, 2024 · 4 comments
Open

Error in harvesting metadata from codemeta.json #275

Aidajafarbigloo opened this issue Oct 2, 2024 · 4 comments
Labels
1️ harvesting The harvesting step in the workflow

Comments

@Aidajafarbigloo
Copy link

Aidajafarbigloo commented Oct 2, 2024

Hello,

While extracting metadata from CodeMeta files, there was an issue with finding the file path, leading to this error:

Error while executing codemeta: . contains either no or more than 1 codemeta.json file. Aborting harvesting for this metadata source..

The issue was resolved by adjusting the file path in the _get_single_codemeta function in codemeta.py, which allowed the metadata harvesting to proceed successfully.

The path was updated as follows:

From:
files = glob.glob(str(path / "**" / "codemeta.json"), recursive=True)

To:
files = glob.glob(str(path / "codemeta.json"), recursive=True)

If this issue is approved, I'm happy to create a pull request and apply the change.

@zyzzyxdonta
Copy link
Contributor

zyzzyxdonta commented Oct 7, 2024

I'm not so sure about this. This is clearly supposed to find only a single file and fail if more than one file is found. The codemeta specification doesn't seem to mention where this file is to be placed, so it makes sense to search for it. 🤔 Of course, the error message could be more specific.

(That being said, if someone touches this code, the mentioned line could be simplified to files = path.glob("**/codemeta.json". Then the bits after that need to be changed as well to handle the returned generator object correctly.)

@zyzzyxdonta zyzzyxdonta added the 1️ harvesting The harvesting step in the workflow label Oct 7, 2024
@Aidajafarbigloo
Copy link
Author

I think the error occurs when installing Hermes in an environment (e.g.: I installed it on the SMECS project) and not cloning the project. I tested both: in the second case, where I harvested from codemeta.json (a test codemeta file which I created to harvest from in the cloned project), it worked fine, but in the first case, there was the mentioned error.

@zyzzyxdonta
Copy link
Contributor

That's because the SMECS repo (branch 114-add-codemetajson contains two codemeta.json files:

./static/codemeta.json
./codemeta.json

@Aidajafarbigloo
Copy link
Author

That's right, thank you for your assistance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1️ harvesting The harvesting step in the workflow
Projects
None yet
Development

No branches or pull requests

2 participants