proycon / codemetapy

A Python package for generating and working with codemeta
https://codemeta.github.io/
GNU General Public License v3.0
24 stars 5 forks source link

Error when parsing python projects #27

Closed broeder-j closed 1 year ago

broeder-j commented 1 year ago

Hi there. First thanks for your work. So far I could not make it work for any of my python projects with pyproject.toml using poetry as a build system. I always end up with this error below. So I tried if I can do it for codemetapy after a simple pip install of it and it fails in the same way.

I am on linux. Python 3.8.10

$codemetapy codemetapy > codemeta.json
Passed 1 files/sources but specified 0 input types! Automatically guessing types...
Detected input types: []
Traceback (most recent call last):
  File "/work/envs/db/bin/codemetapy", line 8, in <module>
    sys.exit(main())
  File "/work/envs/db/lib/python3.8/site-packages/codemeta/codemeta.py", line 136, in main
    g, res, args, contextgraph = build(**args.__dict__)
  File "/work/envs/db/lib/python3.8/site-packages/codemeta/codemeta.py", line 288, in build
    identifier = os.path.basename(inputsources[0][0]).lower()
IndexError: list index out of range
broeder-j commented 1 year ago

Ok, I made it work by specifying the input type -i python. I leave this open because maybe you would like to stop if no input types are detected instead of running into the later exception. Or you want to improve the type detection.

proycon commented 1 year ago

Thanks for the feedback! There was indeed something missing in the type detection. The above commit should fix it.