简体   繁体   English

导入 tia 库以从 Bloomberg 中提取数据时出现错误消息

[英]Error message while importing tia library to extract data from Bloomberg

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?我正在尝试使用 tia 库将彭博数据直接提取到数据框中,一直在关注此线程如何将数据从彭博 API 存储到 Pandas 数据框中?

now, when I try and import tia using the below command import tia.bbg.datamgr as dm现在,当我尝试使用以下命令import tia.bbg.datamgr as dm tia 时, 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谢谢

You are working with Python 3. At the moment, TIA is only compatible with Python 2.您正在使用 Python 3。目前,TIA 仅与 Python 2 兼容。

The error you are seeing is because in TIA files, print is without parentheses which is Python 2 style.您看到的错误是因为在 TIA 文件中,print 没有括号,这是 Python 2 样式。

Here https://github.com/bpsmith/tia/issues/11 has a Python 3 conversion.这里https://github.com/bpsmith/tia/issues/11有一个 Python 3 转换。 I've been using this recently and it's pretty good.我最近一直在使用这个,它非常好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM