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

Issue with import speasy #92

Closed cmoissar closed 1 year ago

cmoissar commented 1 year ago

Description

I do not manage to import speasy

What I Did

INPUT:

import speasy as spz

OUTPUT:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-96cca6dfb4c8> in <cell line: 1>()
----> 1 import speasy as spz

~/.local/lib/python3.10/site-packages/speasy/__init__.py in <module>
     16 from .products import SpeasyVariable, Catalog, Event, Dataset, TimeTable, MaybeAnyProduct
     17 from typing import List
---> 18 from .core.requests_scheduling.request_dispatch import get_data, list_providers, amda, cda, csa, ssc
     19 
     20 

~/.local/lib/python3.10/site-packages/speasy/core/requests_scheduling/__init__.py in <module>
      1 from .split_large_requests import SplitLargeRequests
----> 2 from .request_dispatch import get_data

~/.local/lib/python3.10/site-packages/speasy/core/requests_scheduling/request_dispatch.py in <module>
     19 TimeRangeCollectionT = Union[TimetableIndex, CatalogIndex, Iterable[Iterable[Union[TimeT]]]]
     20 
---> 21 amda = AMDA_Webservice()
     22 cda = CDA_Webservice()
     23 ssc = SSC_Webservice()

~/.local/lib/python3.10/site-packages/speasy/webservices/amda/ws.py in __init__(self, server_url)
     82         from ._impl import AmdaImpl
     83         self._impl = AmdaImpl(server_url=server_url)
---> 84         DataProvider.__init__(self, provider_name='amda')
     85 
     86     def __del__(self):

~/.local/lib/python3.10/site-packages/speasy/core/dataprovider.py in __init__(self, provider_name, provider_alt_names)
     45         for alt_name in self.provider_alt_names:
     46             flat_inventories.__dict__[alt_name] = self.flat_inventory
---> 47         self.update_inventory()
     48         PROVIDERS[provider_name] = self
     49 

~/.local/lib/python3.10/site-packages/speasy/core/dataprovider.py in update_inventory(self)
     61         with lock:
     62             new_inventory = self._inventory(provider_name=self.provider_name)
---> 63             if inventory_has_changed(tree.__dict__.get(self.provider_name, SpeasyIndex("", "", "")), new_inventory):
     64                 if self.provider_name in tree.__dict__:
     65                     tree.__dict__[self.provider_name].clear()

~/.local/lib/python3.10/site-packages/speasy/core/inventory/indexes.py in inventory_has_changed(orig, new)
    135 
    136 def inventory_has_changed(orig, new):
--> 137     if orig.__dict__.keys() != new.__dict__.keys():
    138         return True
    139     for orig_key, orig_value in orig.__dict__.items():

AttributeError: 'NoneType' object has no attribute '__dict__'

Thank you for your help, Clement

jeandet commented 1 year ago

@cmoissar AMDA server had an issue yesterday, it is resolved now. Sorry for the inconvenience. I'll look into something more resilient for the future, in the mean time, when you have such issue and you don't need to use the faulty webserver, you can set this environment variable SPEASY_CORE_DISABLED_PROVIDERS.

For example to disable amda: SPEASY_CORE_DISABLED_PROVIDERS="amda"