Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • Eikon Data APIs /

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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

avatar image
Question by james123 · Apr 24, 2021 at 01:56 PM · eikoneikon-data-apiworkspacepythonworkspace-data-apirefinitiv-dataplatform-eikoncodebookdask

AttributeError with get_news_story() in CODEBK with Dask

I am having a problem with Dask in CODEBK. Specifically, if I call get_news_story() from the Eikon API in a Dask worker I get the following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-74-f3a00d0c8ed3> in <module>
     21      22 for f in as_completed(fut):
---> 23     stories[f.result().id] = f.result()

/opt/conda/lib/python3.7/site-packages/distributed/client.py in result(self, timeout)
    223         if self.status == "error":
    224             typ, exc, tb = result
--> 225             raise exc.with_traceback(tb)
    226         elif self.status == "cancelled":
    227             raise result 
<ipython-input-74-f3a00d0c8ed3> in __init__()
      9     def __init__(self, idIn):
     10         self.id = idIn;
---> 11         tmp = ek.get_news_story(self.id, raw_output=True)
     12         self.headline = tmp['story']['headlineHtml']
     13         self.story = tmp['story']['storyHtml']

/opt/conda/lib/python3.7/site-packages/refinitiv/dataplatform/legacy/news_request.py in get_news_story()
    196            print (story)
    197     """
--> 198     logger = DefaultSession.get_default_session().logger()
    199     200     # check parameters type and values

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

The following code in CODEBK should replicate the issue.

import refinitiv.dataplatform.eikon as ek

ek.set_app_key('DEFAULT_CODE_BOOK_APP_KEY')

from dask.distributed import Client, as_completed

client = Client("tcp://127.0.0.1:41045")

class story:

    def __init__(self, idIn):         self.id = idIn;         tmp = ek.get_news_story(self.id, raw_output=True)         self.headline = tmp['story']['headlineHtml']         self.story = tmp['story']['storyHtml'] stories = {} fut = [] currentHeadlines = ek.get_news_headlines(query='Language:LEN', count=10) for col, row in currentHeadlines.iterrows():     storyId = row['storyId']     fut.append(client.submit(story, storyId))

for f in as_completed(fut):

    stories[f.result().id] = f.result()

People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

1 Reply

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by Jirapongse · Apr 26, 2021 at 06:31 AM

@james123

The error is similar to an issue when calling the get_news_story method without setting the application key.

I assume that Dask may not be able to access the ek object defined in the global.


1619418554761.png (49.6 KiB)
Comment

People who like this

0 Show 3 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

avatar image
james123 · Apr 26, 2021 at 12:19 PM 0
Share

@jirapongse.phuriphanvichai Thank you. I'll try scattering the ek object and see if that works.

avatar image
james123 · May 04, 2021 at 04:43 PM 0
Share

I still haven't got around to checking this. I will update here when I have

avatar image
james123 · May 24, 2021 at 09:45 AM 0
Share

Thanks, this helped.

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
11 People are following this question.

Related Questions

Trying to execute code from CODEBOOK to a python file, ERROR "Your request is prohibited because the request is on loopback from external IP."

CodeBook stuck reconnecting Kernel

Company trees don't match in Eikon online tool and the Eikon Proxy API

How to get all investors for a list of stocks, historically with the python API

Eikon Codebook - Matplotlib Bar Chart Open Interest by Strike

  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Electronic Trading
    • Generic FIX
    • Local Bank Node API
    • Trading API
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Intelligent Tagging
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open Calais
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • RDMS
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • Workspace SDK
    • Element Framework
    • Grid
  • World-Check Data File
  • 中文论坛
  • Explore
  • Tags
  • Questions
  • Badges