Skip to content

Commit

Permalink
debug 3
Browse files Browse the repository at this point in the history
  • Loading branch information
SteffenBrinckmann committed Oct 31, 2023
1 parent db91ba7 commit e06c33a
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions .github/workflows/validator_pypi_rocrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,33 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install rocrate
- name: Test with pytest
- name: validate
run: |
from pathlib import Path
import os
from zipfile import ZIP_DEFLATED
from zipfile import Path as ZPath
from zipfile import ZipFile
from rocrate.rocrate import ROCrate
from rocrate.model.entity import Entity
from rocrate.model.contextentity import ContextEntity
cwd = Path('.')
print(cwd)
for fileName in cwd.glob('*.eln'):
print(f'Try to parse: {fileName.name}')
with ZipFile(fileName, 'r', compression=ZIP_DEFLATED) as elnFile:
p = ZPath(elnFile)
dirName = sorted(p.iterdir())[0]
try:
dirpath = Path(tempfile.mkdtemp())
elnFile.extractall(dirpath)
temppath= dirpath.joinpath(dirName.name)
crate = ROCrate(temppath)
print('\nList content according to https://pypi.org/project/rocrate/')
for e in crate.get_entities():
print(e.id, e.type)
except ValueError:
print("**ERROR: Could not parse content\n"+traceback.format_exc()+'\n\n')
for root, _, files in os.walk(".", topdown=False):
for name in files:
fileName = os.path.join(root, name)
print(f'Try to parse: {fileName}')
with ZipFile(fileName, 'r', compression=ZIP_DEFLATED) as elnFile:
p = ZPath(elnFile)
dirName = sorted(p.iterdir())[0]
try:
dirpath = Path(tempfile.mkdtemp())
elnFile.extractall(dirpath)
temppath= dirpath.joinpath(dirName.name)
crate = ROCrate(temppath)
print('\nList content')
for e in crate.get_entities():
print(e.id, e.type)
except ValueError:
print("**ERROR: Could not parse content\n"+traceback.format_exc()+'\n\n')
shell: python


0 comments on commit e06c33a

Please sign in to comment.