Error message while importing tia library to extract data from Bloomberg

房东的猫 提交于 2021-02-11 14:49:17

问题


I am trying to use tia library to extract Bloomberg data directly to a data frame, been following this thread How do I store data from the Bloomberg API into a Pandas dataframe?

now, when I try and import tia using the below command import tia.bbg.datamgr as dm

I get this error msg

Traceback (most recent call last):
  File "/Users/prasadkamath/anaconda2/envs/Pk/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3319, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-17-7422282d1b65>", line 1, in <module>
    import tia.bbg.datamgr as dm
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/prasadkamath/anaconda2/envs/Pk/lib/python3.6/site-packages/tia/bbg/__init__.py", line 1, in <module>
    from tia.bbg.v3api import *
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/prasadkamath/anaconda2/envs/Pk/lib/python3.6/site-packages/tia/bbg/v3api.py", line 186
    print 'unhandled event: %s' % evt.EventType
                              ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print('unhandled event: %s' % evt.EventType)?

Anyone got clue how do I fix this?

thanks


回答1:


You are working with Python 3. At the moment, TIA is only compatible with Python 2.

The error you are seeing is because in TIA files, print is without parentheses which is Python 2 style.

Here https://github.com/bpsmith/tia/issues/11 has a Python 3 conversion. I've been using this recently and it's pretty good.



来源:https://stackoverflow.com/questions/60714707/error-message-while-importing-tia-library-to-extract-data-from-bloomberg

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!