from zenodo_client import Creator, Metadata, ensure_zenodo
from my_secrets import ZENODO_API_KEY, ZENODO_SANDBOX_API_KEY
# Define the metadata that will be used on initial upload
data = Metadata(
title='Test Upload 3',
upload_type='dataset',
description='test description',
creators=[
Creator(
name='Hoyt, Charles Tapley',
affiliation='Harvard Medical School',
orcid='0000-0003-4423-4370',
),
],
)
sandbox = True
key = ZENODO_SANDBOX_API_KEY if sandbox else ZENODO_API_KEY
res = ensure_zenodo(
key,
data=data,
paths=[
"data/processed/particle_packing/sobol_probability_filter.csv",
# "data/processed/particle_packing/sobol_regression.csv",
],
sandbox=sandbox, # remove this when you're ready to upload to real Zenodo
access_token=key,
)
from pprint import pprint
pprint(res.json())
Exception has occurred: NoSectionError (note: full exception trace is shown but execution is paused at: _run_module_as_main)
No section: 'zenodo'
File "C:\Users\sterg\miniconda3\envs\matsciopt\Lib\configparser.py", line 900, in set
sectdict = self._sections[section]
During handling of the above exception, another exception occurred:
File "C:\Users\sterg\miniconda3\envs\matsciopt\Lib\configparser.py", line 902, in set
raise NoSectionError(section) from None
File "C:\Users\sterg\miniconda3\envs\matsciopt\Lib\configparser.py", line 1204, in set
super().set(section, option, value)
File "C:\Users\sterg\miniconda3\envs\matsciopt\Lib\site-packages\pystow\config_api.py", line 162, in write_config
cfp.set(module, key, value)
File "C:\Users\sterg\miniconda3\envs\matsciopt\Lib\site-packages\zenodo_client\api.py", line 44, in ensure_zenodo
pystow.write_config("zenodo", key, str(res.json()["id"]))
File "C:\Users\sterg\Documents\GitHub\sparks-baird\matsci-opt-benchmarks\scripts\particle_packing\zenodo_upload.py", line 20, in <module>
res = ensure_zenodo(
File "C:\Users\sterg\miniconda3\envs\matsciopt\Lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\sterg\miniconda3\envs\matsciopt\Lib\runpy.py", line 197, in _run_module_as_main (Current frame)
return _run_code(code, main_globals, None,
@cthoyt using the first example from the docs, except also passing
access_token
per https://github.com/cthoyt/zenodo-client/issues/7.