AttributeError: type object 'DataProvidersManager' has no attribute 'getInstance'

when I run the following code:"
import orekit
from import File
from import DataProvidersManager, DirectoryCrawler
from orekit import JArray
orekit_data_dir = ‘orekit-data’
datafile = File(orekit_data_dir)
if not datafile.exists():
print(‘Directory :’, datafile.absolutePath, ’ not found’)
DM = DataProvidersManager.getInstance()
crawler = DirectoryCrawler(datafile)
AttributeError: type object ‘DataProvidersManager’ has no attribute ‘getInstance’

Need your help, thanks a lot.

Hi @julian2020,

Welcome to the Orekit community !

With the Python wrapper you can use setup_orekit_curdir(orekit_data_dir) to initialize Orekit.
See this tutorial from Petrus for more info.

If you look into the code of setup_orekit_curdir you will find what you missed: the DataProvidersManager should be initialized with:

DM = DataContext.getDefault().getDataProvidersManager()

NB: The DataContext architecture was introduced by Evan in version 10.1 of Orekit.

Hi @MaximeJ,
Thanks for your help! I corrected the code by your instruction, now the error has gone. :smile: