Problem with calling Citrine_key

Dear Team,

I am getting following error during the function you called CitrineDataRetrieval.

KeyError                                  Traceback (most recent call last)
<ipython-input-4-be0b8a9a6529> in <module>()
----> 1 df_citrine = CitrineDataRetrieval().get_dataframe(formula='Si', property='band gap', data_type='EXPERIMENTAL')
      2 df_mp = MPDataRetrieval().get_dataframe(criteria='Si', properties=['band_gap'])

~/.local/lib/python3.6/site-packages/matminer/data_retrieval/retrieve_Citrine.py in __init__(self, api_key)
     41                 you've set the CITRINE_KEY environment variable
     42         """
---> 43         api_key = api_key if api_key else os.environ["CITRINE_KEY"]
     44         self.client = CitrinationClient(api_key, "https://citrination.com")
     45

/usr/lib/python3.6/os.py in __getitem__(self, key)
    667         except KeyError:
    668             # raise KeyError with the original key value
--> 669             raise KeyError(key) from None
    670         return self.decodevalue(value)
    671

KeyError: 'CITRINE_KEY'

It would be very nice if you can let me know how to solve this following error.

Thank you

With kind regards
Uday Gajera

Hi Uday,

to use the CitrineDataRetrieval class you either need to feed your https://citrine.io/ API key when you instantiate the class or just set the environment variable CITRINE_KEY. For example in Mac or Linux you set your environment variable inside your .bashrc file.

To get API key for any website such as citrine.io, you would need to register to their website and follow their API documentation to get your API key (a string such as “abcd”).

Best,

Alireza

···

On Wednesday, September 26, 2018 at 8:10:47 AM UTC-7, uday gajera wrote:

Dear Team,

I am getting following error during the function you called CitrineDataRetrieval.

KeyError                                  Traceback (most recent call last)
<ipython-input-4-be0b8a9a6529> in <module>()
----> 1 df_citrine = CitrineDataRetrieval().get_dataframe(formula='Si', property='band gap', data_type='EXPERIMENTAL')
      2 df_mp = MPDataRetrieval().get_dataframe(criteria='Si', properties=['band_gap'])

~/.local/lib/python3.6/site-packages/matminer/data_retrieval/retrieve_Citrine.py in __init__(self, api_key)
     41                 you've set the CITRINE_KEY environment variable
     42         """
---> 43         api_key = api_key if api_key else os.environ["CITRINE_KEY"]
     44         self.client = CitrinationClient(api_key, "[https://citrination.com](https://citrination.com)")
     45

/usr/lib/python3.6/os.py in __getitem__(self, key)
    667         except KeyError:
    668             # raise KeyError with the original key value
--> 669             raise KeyError(key) from None
    670         return self.decodevalue(value)
    671

KeyError: 'CITRINE_KEY'


It would be very nice if you can let me know how to solve this following error.


Thank you


With kind regards
Uday Gajera