0

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

TRex
  • 445
  • 5
  • 14

1 Answers1

0

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.

DMSTA
  • 212
  • 3
  • 9
  • btw @DMSTA I have python3.6 on my Mac and it runs fine and my work was upgraded to 3.7. now I get a different error "'dict' object has no attribute 'iteritems'". It shows error in this line "433 overrides=','.join(['%s=%s' % (k, v) for k, v in self.overrides.items()])) any idea? does tie work on 3.7 or do I need to downgrade to 3.6? – TRex Apr 06 '20 at 15:24
  • I would open the file it's referring to and replace dict.iteritems with dict.items as this was renamed in Python 3. My guess is it wasn't picked up by the conversion. Potentially a few others but you simply need to just edit them manually – DMSTA Apr 06 '20 at 19:06
  • perfect thanks - works fine! appreciate your help again! – TRex Apr 06 '20 at 22:17
  • btw @DMSTA have you used the bbg function called Bcountperiods using tia and blpapi? – TRex Apr 08 '20 at 14:16
  • No sir, I have not. Are you having issues? – DMSTA Apr 09 '20 at 06:50
  • well am not sure how to use it tbh. I am able to use the bdp and bdh function but not sure how to use the Bcountperiods – TRex Apr 10 '20 at 23:59