Error while running set_app_id("xxxx")

Hi everyone! I'm trying to connect Reuters using python (with spyder), following the Eikon Data API quick start guide for Windows. I already created an App Key.
I use the following code:
import sys
import os
import eikon as ek
from eikon import Profile as profile
ek.set_app_id('xxxx')
And the last line gives me the following error:
File "C:\Users\AppData\Local\Continuum\anaconda3\lib\site-packages\eikon\Profile.py", line 270, in <listcomp>
for app_name in app_names if os.path.isdir(user_data_dir(app_name, app_author, roaming=True))]
NameError: name 'os' is not defined
Could someone please help me solving this problem?
Thanks!
Best Answer
-
As I expected the library published on Github is not an official release from Refinitiv, as stated in the disclaimer in the readme.
I can't say I have an explanation for the latest AttributeError you experienced. It makes no sense to me. The error means that deprecation module is available, but there's no function named 'deprecated' in that module. Assuming you installed the latest version 2.0.6 of the module, 'deprecated' function must be there. You should be able to see it by opening deprecation.py file in site packages folder. You can also verify it by runningimport deprecation
I'm afraid I'm at a loss as to what might be the root cause here. And I'm out of suggestions for what you could try to work around it short of rebuilding your development environment.
help(deprecation.deprecated)
0
Answers
-
This is rather puzzling. Could you provide the full stack trace for the error?
Importing Profile module from eikon library is unnecessary. Not that it should cause the problem you experienced, but what if you only keep the bare necessities and remove all other imports? Try executing just the two lines below. Do you get the same error?import eikon as ek
ek.set_app_id('xxxx')0 -
Thanks for your answer. I tried the above two line scripts and I get the same error. I tried to solve the problem by importing os, setting the directory, importing appdirs. The full stack trace for the error:
import eikon as ek
ek.set_app_id('xxxx')
Traceback (most recent call last):File "<ipython-input-105-ab41b27985c7>", line 2, in <module>
ek.set_app_id('xxxx')File "C:\Users\1938809\AppData\Local\Continuum\anaconda3\lib\site-packages\eikon\Profile.py", line 32, in set_app_id
get_profile().set_application_id(app_id)File "C:\Users\1938809\AppData\Local\Continuum\anaconda3\lib\site-packages\eikon\Profile.py", line 141, in set_application_id
self.set_port_number(identify_scripting_proxy_port(self.session, self.application_id))File "C:\Users\1938809\AppData\Local\Continuum\anaconda3\lib\site-packages\eikon\Profile.py", line 270, in identify_scripting_proxy_port
for app_name in app_names if os.path.isdir(user_data_dir(app_name, app_author, roaming=True))]File "C:\Users\1938809\AppData\Local\Continuum\anaconda3\lib\site-packages\eikon\Profile.py", line 270, in <listcomp>
for app_name in app_names if os.path.isdir(user_data_dir(app_name, app_author, roaming=True))]NameError: name 'os' is not defined
I have to say that I have tried to install eikon package (and others) using command and conda prompt without any success. In this device the only way I have to install packages is to download them from github and manually to put them in
C:\Users\1938809\AppData\Local\Continuum\anaconda3\Lib\site-packages folder. However I have no error while I import eikon.
0 -
I can't say I have an explanation for the error you encountered. It makes no sense to me. Which version of eikon library did you install? You can find out by calling ek.__version__.
set_app_id command is deprecated. Try replacing it with set_app_key. Still the same error?
Do I understand correctly that you have no problem using os module in your code? E.g. the following works fine for you?import os
os.environ['HOME']0 -
Hi,
-eikon version installed is 0.1.12, the one available on github
-I tried to download this packages files (eikon 1.0.1): https://pypi.org/project/eikon/#files. And I get this error while importing eikon:
import eikon as ek
Traceback (most recent call last):File "<ipython-input-3-7b8635881a63>", line 1, in <module>
import eikon as ekFile "C:\Users\1938809\AppData\Local\Continuum\anaconda3\lib\site-packages\eikon\__init__.py", line 12, in <module>
from .Profile import set_app_key, get_app_key,\File "C:\Users\1938809\AppData\Local\Continuum\anaconda3\lib\site-packages\eikon\Profile.py", line 13, in <module>
import deprecationModuleNotFoundError: No module named 'deprecation'
-Replacing set_app_id by set_app_key gives me this error:
ek.set_app_key('xxxx')
Traceback (most recent call last):File "<ipython-input-19-98c3c348597c>", line 1, in <module>
ek.set_app_key('xxxx')AttributeError: module 'eikon' has no attribute 'set_app_key'
-No problem using os module in my computer.
I can set the directory using os.chdir("...")
And, as I'm on Windows the above code works property
In[17]:os.environ['USERPROFILE']
Out[17]: 'C:\\Users\\1938809'0 -
I'm not aware of Eikon Data APIs library for Python having been made available on Github. If you could provide a link, I'll take a look and see if it was posted by Refinitiv. But in any case version 0.1.12 is old and shouldn't be used any more. I suggest we focus on installing the latest version 1.0.1. ModuleNotFoundError you experienced after manually installing eikon library v1.0.1 is not unexpected. When you manually install a package downloaded from PyPI you also have to manually install all the dependencies you don't already have installed, then the dependencies of the dependencies and then the dependencies of the dependencies of the dependencies and so on. This is painful, but there's no way around it if you cannot use PIP or conda to automatically install all the dependencies at once. Here's the deprecation module you're missing.
https://pypi.org/project/deprecation/0 -
GitHub link: https://github.com/dhirschfeld/eikon
Ok, now I installed eikon 1.0.1. And the deprecation package. Got the following error:
import deprecation
import eikon as ek
Traceback (most recent call last):File "<ipython-input-5-7b8635881a63>", line 1, in <module>
import eikon as ekFile "C:\Users\1938809\AppData\Local\Continuum\anaconda3\lib\site-packages\eikon\__init__.py", line 12, in <module>
from .Profile import set_app_key, get_app_key,\File "C:\Users\1938809\AppData\Local\Continuum\anaconda3\lib\site-packages\eikon\Profile.py", line 16, in <module>
@deprecation.deprecated(deprecated_in="0.1.12", removed_in="1.1.0",AttributeError: module 'deprecation' has no attribute 'deprecated'
0
Categories
- All Categories
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 33 Data Model Discovery
- 682 Datastream
- 1.4K DSS
- 613 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 248 ETA
- 552 WebSocket API
- 37 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.8K Refinitiv Data Platform
- 625 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 26 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 191 TREP Infrastructure
- 228 TRKD
- 915 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 83 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛