SciQLop / speasy

Space Physics made EASY! A simple Python package to deal with main Space Physics WebServices (CDA,SSC,AMDA,..)
Other
24 stars 7 forks source link

Setting config username/password subsequently causes crash #70

Closed RichardHitier closed 1 year ago

RichardHitier commented 1 year ago

Description

Code crashes after setting username/password config

What I Did

I want to log in amda, so i

>>> from speasy import config 
>>> config.amda.username.set('myusername')
>>> config.amda.password.set('mypassword')

Then I ran code and it crashed after

import speasy as spz

Traceback (most recent call last):
  File "~/MyProject/trySpeasy.py", line 4, in <module>
    import speasy as spz
  File "~/MyProject/venv/lib/python3.10/site-packages/speasy/__init__.py", line 18, in <module>
    from .core.requests_scheduling.request_dispatch import get_data, list_providers, amda, cda, csa, ssc
  File "~/MyProject/venv/lib/python3.10/site-packages/speasy/core/requests_scheduling/__init__.py", line 2, in <module>
    from .request_dispatch import get_data
  File "~/MyProject/venv/lib/python3.10/site-packages/speasy/core/requests_scheduling/request_dispatch.py", line 21, in <module>
    amda = AMDA_Webservice()
  File "~/MyProject/venv/lib/python3.10/site-packages/speasy/webservices/amda/ws.py", line 84, in __init__
    DataProvider.__init__(self, provider_name='amda')
  File "~/MyProject/venv/lib/python3.10/site-packages/speasy/core/dataprovider.py", line 47, in __init__
    self.update_inventory()
  File "~/MyProject/venv/lib/python3.10/site-packages/speasy/core/dataprovider.py", line 67, in update_inventory
    self._update_private_inventory(tree.__dict__[self.provider_name])
  File "~/MyProject/venv/lib/python3.10/site-packages/speasy/core/dataprovider.py", line 57, in _update_private_inventory
    return self.build_private_inventory(root)
  File "~/MyProject/venv/lib/python3.10/site-packages/speasy/webservices/amda/ws.py", line 93, in build_private_inventory
    return self._impl.build_private_inventory(root)
  File "~/MyProject/venv/lib/python3.10/site-packages/speasy/webservices/amda/_impl.py", line 91, in build_private_inventory
    self._update_private_lists(TimeTables=root.TimeTables, Catalogs=root.Catalogs, root=root)
  File "~/MyProject/venv/lib/python3.10/site-packages/speasy/webservices/amda/_impl.py", line 68, in _update_private_lists
    meta=user_param.ws.paramList.__dict__)
AttributeError: 'SpeasyIndex' object has no attribute 'ws'
RichardHitier commented 1 year ago

this doesn't occur any more after I have created my own "derived parameter" in AMDA, thus creating a workspace I guess.

jeandet commented 1 year ago

@RichardHitier thanks for the bug report, I think I found the reason of this error, can you confirm that you have 0 user parameter defined on this AMDA session?

@brenard-irap if this is actually the reason, this means that the XML file miss the ws/paramList nodes when empty, I wonder if this should't be considered as an AMDA bug instead?

Actually I don't have an AMDA session where I can easily test this since my personal session is used for Speasy unit tests so I don't want to mess it up.

jeandet commented 1 year ago

@RichardHitier OK, so you was faster than me ;)

RichardHitier commented 1 year ago

Tky for your answer. I will go on like this now.

jeandet commented 1 year ago

@RichardHitier do you have also private catalogs and timetables? I would like to verify if there is a kind of unified behavior on AMDA side.

RichardHitier commented 1 year ago

no catalog, nor timetable

brenard-irap commented 1 year ago

Thanks Richard for the feedback. This is now fixed in AMDA side.

jeandet commented 1 year ago

@brenard-irap Awesome! So we can close the issue?

brenard-irap commented 1 year ago

Yes, you can close the issue.

RichardHitier commented 1 year ago

Thank you both :)