I'm trying to jump ahead several releases and getting this error.
print(api.status)
^^^^^^^^^^
AttributeError: 'Api' object has no attribute 'status'
Any ideas?
For context, here my draft pull request: https://github.com/IQSS/dataverse-sample-data/pull/44
Here's the line it's failing on: https://github.com/IQSS/dataverse-sample-data/blob/cc6eb12f3a51e93546c5164ddc4ae851e56c3dac/create_sample_data.py#L17
Hm it seems like the status attribute has been remove a couple releases ago. At least I cant locate it in 0.3.1 so far.
Do you know what the purpose of this one was?
No. I'm way behind. Sounds like it happened way before 0.3.2. Thanks!
This was on 0.2.1
try:
resp = get(url)
if resp:
self.status = resp.json()['status']
I got "create dataverse" working: https://github.com/IQSS/dataverse-sample-data/pull/44/commits/ad23316e20de1dd6d8d585c7a1b9dae12ee466d3
To get this status
pydv 2.1 wold call https://demo.dataverse.org/api/info/server
{"status":"OK","data":{"message":"demo.dataverse.org"}}
and return the status
Gotcha. I replaced it with print(api.get_info_version())
Should we add status back to the Api class? I feel its a good gateway to check the connection.
If set upon initialisation it would be an indicator for connection problems
Meh, not sure.
Ok, I just marked https://github.com/IQSS/dataverse-sample-data/pull/44 as ready for review. Both my create and destroy scripts work and that's all I really use.
@Juan Pablo Tosca Villanueva maybe you can take a look. I don't know if you use any other scripts.
I switched to pyDataverse's get_dataset_lock, which is nice. Previously I was using requests for that.
The script I added works fine, it doesn't use pyDV directly. I tested making a dataset with 20 images and worked fine :smile:
oh
Wait
Traceback (most recent call last):
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 69, in map_httpcore_exceptions
yield
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 233, in handle_request
resp = self._pool.handle_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpcore/_sync/connection_pool.py", line 216, in handle_request
raise exc from None
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpcore/_sync/connection_pool.py", line 196, in handle_request
response = connection.handle_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpcore/_sync/connection.py", line 101, in handle_request
return self._connection.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpcore/_sync/http11.py", line 143, in handle_request
raise exc
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpcore/_sync/http11.py", line 113, in handle_request
) = self._receive_response_headers(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpcore/_sync/http11.py", line 186, in _receive_response_headers
event = self._receive_event(timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpcore/_sync/http11.py", line 224, in _receive_event
data = self._network_stream.read(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpcore/_backends/sync.py", line 124, in read
with map_exceptions(exc_map):
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 158, in __exit__
self.gen.throw(value)
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ReadTimeout: timed out
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/create_sample_data.py", line 77, in <module>
resp = api.upload_datafile(dataset_pid, df_filename, df.json())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/pyDataverse/api.py", line 1816, in upload_datafile
return self.post_request(
^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/pyDataverse/api.py", line 174, in post_request
return self._sync_request(
^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/pyDataverse/api.py", line 295, in _sync_request
resp = method(**kwargs, follow_redirects=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpx/_api.py", line 319, in post
return request(
^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpx/_api.py", line 106, in request
return client.request(
^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpx/_client.py", line 827, in request
return self.send(request, auth=auth, follow_redirects=follow_redirects)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpx/_client.py", line 914, in send
response = self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpx/_client.py", line 942, in _send_handling_auth
response = self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpx/_client.py", line 979, in _send_handling_redirects
response = self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpx/_client.py", line 1015, in _send_single_request
response = transport.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 232, in handle_request
with map_httpcore_exceptions():
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 158, in __exit__
self.gen.throw(value)
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 86, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ReadTimeout: timed out
So I was able to generate my custom dataset as I said but when I ran python create_sample_data.py the script crashed before it could finish
Does it work with this?
sample_data = [
'data/dataverses/open-source-at-harvard/open-source-at-harvard.json',
'data/dataverses/open-source-at-harvard/datasets/open-source-at-harvard/open-source-at-harvard.json',
]
And what data lines are you using?
:thinking:
I normally just run python create_sample_data.py with no parameters or anything, is this something I have to add somewhere?
I am going to run a quick test without the generated files
Sorry, I'm talking about the lines in dvconfig.py, the config file.
I only tested those two lines.
Oh, I am testing the full thing :rolling_on_the_floor_laughing:
sample_data = [
'data/dataverses/pums/pums.json',
'data/dataverses/pums/datasets/2000pums5/2000pums5.json',
'data/dataverses/dataverseno/dataverseno.json',
'data/dataverses/open-source-at-harvard/open-source-at-harvard.json',
'data/dataverses/open-source-at-harvard/dataverses/dataverse-project/dataverse-project.json',
'data/dataverses/open-source-at-harvard/dataverses/dataverse-project/datasets/dataverse-irc-metrics/dataverse-irc-metrics.json',
'data/dataverses/ecastro/ecastro.json',
'data/dataverses/ecastro/datasets/this-is-my-test-dataset/this-is-my-test-dataset.json',
'data/dataverses/manchester/manchester.json',
'data/dataverses/manchester/datasets/test-dataset/test-dataset.json',
'data/dataverses/dataverse-performance-demo/dataverse-performance-demo.json',
'data/dataverses/dataverse-performance-demo/datasets/performance-test/performance-test.json',
'data/dataverses/HCPDS/HCPDS.json',
'data/dataverses/HCPDS/datasets/reproductive-health-laws-around-the-world/reproductive-health-laws-around-the-world.json',
'data/dataverses/cms/cms.json',
'data/dataverses/cms/datasets/cmssampledata/cmssampledata.json',
'data/dataverses/scholcommlab/scholcommlab.json',
'data/dataverses/scholcommlab/datasets/diabeticconnect/diabeticconnect.json',
'data/dataverses/ubiquity-press/ubiquity-press.json',
'data/dataverses/ubiquity-press/dataverses/jopd/jopd.json',
'data/dataverses/ubiquity-press/dataverses/jopd/datasets/flynn-effect-in-estonia/flynn-effect-in-estonia.json',
'data/dataverses/ubiquity-press/dataverses/jopd/datasets/bafacalo/bafacalo.json',
'data/dataverses/open-source-at-harvard/datasets/open-source-at-harvard/open-source-at-harvard.json',
'data/dataverses/king/king.json',
'data/dataverses/king/datasets/cause-of-death/cause-of-death.json',
]
Gotcha. Which one is it failing on?
I just tested again without my custom files and got the same exception
I don't think we put on the output where is failing
Lock found for dataset id doi:10.5072/FK2/ZTEH0N... sleeping...
<Response [200]>
<Response [200 OK]>
<Response [200]>
<Response [200 OK]>
<Response [200]>
<Response [200 OK]>
<Response [200]>
<Response [200 OK]>
<Response [200]>
<Response [200 OK]>
<Response [200]>
<Response [200 OK]>
<Response [200]>
<Response [200 OK]>
<Response [200]>
<Response [200 OK]>
<Response [200]>
<Response [200 OK]>
<Response [200]>
Traceback (most recent call last):
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 69, in map_httpcore_exceptions
yield
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 233, in handle_request
resp = self._pool.handle_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpcore/_sync/connection_pool.py", line 216, in handle_request
raise exc from None
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpcore/_sync/connection_pool.py", line 196, in handle_request
response = connection.handle_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpcore/_sync/connection.py", line 101, in handle_request
return self._connection.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpcore/_sync/http11.py", line 143, in handle_request
raise exc
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpcore/_sync/http11.py", line 113, in handle_request
) = self._receive_response_headers(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpcore/_sync/http11.py", line 186, in _receive_response_headers
event = self._receive_event(timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpcore/_sync/http11.py", line 224, in _receive_event
data = self._network_stream.read(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpcore/_backends/sync.py", line 124, in read
with map_exceptions(exc_map):
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 158, in __exit__
self.gen.throw(value)
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ReadTimeout: timed out
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/create_sample_data.py", line 77, in <module>
resp = api.upload_datafile(dataset_pid, df_filename, df.json())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/pyDataverse/api.py", line 1816, in upload_datafile
return self.post_request(
^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/pyDataverse/api.py", line 174, in post_request
return self._sync_request(
^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/pyDataverse/api.py", line 295, in _sync_request
resp = method(**kwargs, follow_redirects=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpx/_api.py", line 319, in post
return request(
^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpx/_api.py", line 106, in request
return client.request(
^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpx/_client.py", line 827, in request
return self.send(request, auth=auth, follow_redirects=follow_redirects)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpx/_client.py", line 914, in send
response = self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpx/_client.py", line 942, in _send_handling_auth
response = self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpx/_client.py", line 979, in _send_handling_redirects
response = self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpx/_client.py", line 1015, in _send_single_request
response = transport.handle_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 232, in handle_request
with map_httpcore_exceptions():
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 158, in __exit__
self.gen.throw(value)
File "/Users/jptosca/REP/IQSS/dataverse-sample-data/venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 86, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ReadTimeout: timed out
It looks like "manchester" is failing consistently.
I think everything that has files is failing randomly because the time out
:thinking:
Last time failed earlier for me
Oh. Hmm.
Well, it could be unrelated to the pyDataverse upgrade. I rarely add all the data.
httpcore.ReadTimeout: timed out
When it's not late on a Friday night we can ask Jan what he thinks of that error. :grinning:
:thumbs_up:
"The default behavior is to raise a TimeoutException after 5 seconds of network inactivity." -- https://www.python-httpx.org/advanced/timeouts/
Probably caused by the sleep waiting for the dataset lockout? :flushed:
Maybe. I was thinking more that Dataverse is busy with processing data files and slow to respond.
This happened to me locally on a fresh installation
I think after one of the recent updates I started to see more sleeps and waiting for lock messages on the console
This is the line that is slow to respond:
resp = api.upload_datafile(dataset_pid, df_filename, df.json())
Maybe not related pyDataverse, but when uploading bulk data I have encountered similar issues. Have you tried uploading the file that fails individually?
In the python-dvuploader I compile all the data into a zip and upload that one, which has solved this issue for me.
Alternatively we may have to set the timeout in the request to None to never time out. Let me create a branch, so you can test it.
Just pushed it. Can you re-install using the following?
python -m pip install git+https://github.com/gdcc/pyDataverse.git@unlimited-timeout
I can test later tonight :rolling_on_the_floor_laughing: my
Wife picked me up so we are at the gym now
I am testing, seems to be fixed. Will post back as soon as it is done
raise mapped_exc(message) from exc
httpx.ReadTimeout: timed out
I'm confused. https://github.com/gdcc/pyDataverse/tree/unlimited-timeout is 7 commits behind master and no commits ahead.
Damn, I have committed it, but not pushed yet :cold_sweat:
@Juan Pablo Tosca Villanueva told ya
I do that all the time :crazy:
:upside_down:
Sorry :grimacing:
Luckily you've spotted it!
Ok, now we have the commit: https://github.com/gdcc/pyDataverse/commit/a524c1c91732a159f580750a7af30dab5eed04a0
Did python -m pip install git+https://github.com/gdcc/pyDataverse.git@unlimited-timeout work?
When I do pip freeze | grep pyDataverse I still see pyDataverse==0.3.2. :thinking:
The commit looks right, same as above: Resolved https://github.com/gdcc/pyDataverse.git to commit a524c1c91732a159f580750a7af30dab5eed04a0
The version has not yet been bumped to 0.3.3
Right, but I don't see the change in venv/lib/python3.12/site-packages/pyDataverse/api.py
I can delete my old venv if that helps.
What I typically do is to pull the branch and install the repository using
python -m pip install -e .
In this way, your installation will always be synced to what you have pulled from GitHub. I am not sure though if it works with venv.
Would switching to conda be an option? This allows you to use your envs globally
Buh. Let me try blowing away my venv. That's easier for me. :sweat_smile:
Ok, pip freeze now shows me this: pyDataverse @ git+https://github.com/gdcc/pyDataverse.git@a524c1c91732a159f580750a7af30dab5eed04a0. Good.
It is chugging along!
Yeah, I didn't create the full load of datasets, but I'd say it's fixed.
Should I create an issue?
Great to hear! Yea, feel free to create one. I will link a PR to it :smile:
Done! https://github.com/gdcc/pyDataverse/issues/187
Created a draft PR - https://github.com/gdcc/pyDataverse/pull/188
Added test to upload 50 files and it works with the fix. Just merged it :smile:
Did it fail without the fix? On 50 files?
Last updated: Nov 01 2025 at 14:11 UTC