Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
21 0 0 0

Error: 'NoneType' object has no attribute 'jason'

Hi Team,


I'm running the following script in Codebook and works fine:

-----

import refinitiv.dataplatform as rdp

import plotly.graph_objects as go

import pandas as pd

import numpy as np


from datetime import datetime

from dateutil.relativedelta import relativedelta

rdp.open_desktop_session('0ca53051de6448719f1835e663f609e83efc0197')


def get_maturity(t, today):

tenor = datetime.strptime(t, '%Y-%m-%d') - today

return tenor.days/365


def date_6M(today):

date = today - relativedelta(months=6)

return datetime.strftime(date, '%Y-%m-%d')


def get_data(chain = '0#ESBMK='):

today = datetime.now()

df_rics,err = rdp.legacy.get_data(chain, 'MATUR_DATE')

rics = df_rics['Instrument'].tolist()

Maturity = list(map(lambda t: get_maturity(t, today), df_rics.MATUR_DATE))

df_history = rdp.legacy.get_timeseries(rics, fields='CLOSE', start_date=date_6M(today))

df_history.dropna(inplace=True)


trace = go.Surface(y=df_history.index, x=Maturity, z=df_history.values, name=chain, showscale=False)

yield_surface = go.Figure()

yield_surface.add_trace(trace)

yield_surface.update_layout(template='plotly_dark', scene=dict(

xaxis=dict(title_text='Tenor', autorange='reversed'),

yaxis=dict(title_text='Date'),

zaxis=dict(title_text='Yield, %')

),

margin=dict(l=5, r=5, b=10, t=10),

)

return yield_surface


get_data("0#ESBMK=")


----

But when I move to Jupyter Notebook usen a APPKEY token is showing the error below:


microsoftteams-image-6.png

python#technologycodebookjupyter-notebook
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Upvotes
Accepted
80.3k 259 52 75

@juan.santanera

Thank you for reaching out to us.

I can run the code properly on my Jupyter Notebook.

1695266792344.png

Please enable the debug log and then share the log when the problem occurred. You can enable the debug log by using the following code.

...
rdp.configure.config["logs.level"] = "debug" 
rdp.configure.config["logs.transports.console.enabled"]=True
rdp.open_desktop_session('<app key>')
...



1695266792344.png (206.8 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.