Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 #11

Open
fsuarezb opened this issue Aug 12, 2016 · 16 comments
Open

Python 3 #11

fsuarezb opened this issue Aug 12, 2016 · 16 comments

Comments

@fsuarezb
Copy link

Hey I am a big fan of this library, does someone know if there is going to be a release for python 3 at some point?

@shivaramkrs
Copy link

You can use it with Python 3, you have to make few modifications to few files. I am looking at only BBG data download and for that you need to put braces around print statements in v3api.py. Also change "basestring" to "str".

@toasteez
Copy link

I am also interested in this working for Python 3.x can we make a plan going forwards to get this working?

For Python 3.5 you also need to change iteritems to items.

@fsuarezb
Copy link
Author

I adapted the code to python 3.4 an works pretty well for Historical data.

@dpsugasa
Copy link

dpsugasa commented Apr 10, 2017

how were you able to get BLPAPI to work with Python 3.5?

****scratch that, i got it to work using 3.6

@zglin
Copy link

zglin commented May 18, 2017

@dpsugasa Is the code on your GH working for 3.6? did you issue a PR?

@dpsugasa
Copy link

dpsugasa commented May 19, 2017 via email

@STguerin
Copy link

@dpsugasa how did you install the blpapi on python 3.6? I spoke with the help desk and they only have a experimental release for 3.5, nothing yet for 3.6. Any help would be appreciated

@dpsugasa
Copy link

dpsugasa commented May 29, 2017 via email

@wangjuestam
Copy link

I am working with Python 3.6. After modifications as "put braces around print statements", "basestring" to "str" and " iteritems to items", I still get this 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?

@dpsugasa
Copy link

dpsugasa commented Jul 25, 2017 via email

@wangjuestam
Copy link

Thanks! I am able to run tia on python version 3 now.

@dpsugasa
Copy link

dpsugasa commented Jul 25, 2017 via email

@citynorman
Copy link

This does the trick nicely

  1. Go to the package directory (/c/Anaconda3/Lib/site-packages/tia/bbg)
  2. Run 2to3 v3api.py -w and 2to3 datamgr.py -w

But one of us nice people should fork and make an update...

@PaulMest
Copy link

PaulMest commented Oct 4, 2017

I've updated the whole project with 2to3 to be Python 3 compliant. It is NOT Python 2 compliant, however.

Python 3 compatible repo:

https://github.com/PaulMest/tia/

Install with

$ pip install git+git://github.com/PaulMest/tia.git@066549f834791b024c1d8eb595e0d18fa1e3c1c5#egg=tia

or

$ pip install git+https://github.com/PaulMest/tia.git@066549f834791b024c1d8eb595e0d18fa1e3c1c5#egg=tia

or put one of these into your requirements.txt file

# Using git/SSH
git+git://github.com/PaulMest/tia.git@066549f834791b024c1d8eb595e0d18fa1e3c1c5#egg=tia

# Using https
git+https://github.com/PaulMest/tia.git@066549f834791b024c1d8eb595e0d18fa1e3c1c5#egg=tia

@pksw2016
Copy link

pksw2016 commented Apr 6, 2020

hi I am still struggling with tia installation. running on python 3.6.10 I fixed all the print and basestring issues but get this error - any idea whats going on? is it to do with the 3.6.10 version?

Traceback (most recent call last):
File "", line 58, in
File "", line 48, in BDP
File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\datamgr.py", line 94, in getitem
return self.get_attributes(flds, **self.overrides)
File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\datamgr.py", line 90, in get_attributes
frame = self.mgr.get_attributes(self.sids, flds, **overrides)
File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\datamgr.py", line 148, in get_attributes
return self.terminal.get_reference_data(sids, flds, **overrides).as_frame()
File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\v3api.py", line 745, in get_reference_data
return self.execute(req)
File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\v3api.py", line 711, in execute
self.logger.info('executing request: %s' % repr(request))
File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\v3api.py", line 433, in repr
overrides=','.join(['%s=%s' % (k, v) for k, v in self.overrides.iteritems()]))
AttributeError: 'dict' object has no attribute 'iteritems'

@PaulMest
Copy link

hi I am still struggling with tia installation. running on python 3.6.10 I fixed all the print and basestring issues but get this error - any idea whats going on? is it to do with the 3.6.10 version?

Traceback (most recent call last): File "", line 58, in File "", line 48, in BDP File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\datamgr.py", line 94, in getitem return self.get_attributes(flds, **self.overrides) File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\datamgr.py", line 90, in get_attributes frame = self.mgr.get_attributes(self.sids, flds, **overrides) File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\datamgr.py", line 148, in get_attributes return self.terminal.get_reference_data(sids, flds, **overrides).as_frame() File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\v3api.py", line 745, in get_reference_data return self.execute(req) File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\v3api.py", line 711, in execute self.logger.info('executing request: %s' % repr(request)) File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\v3api.py", line 433, in repr overrides=','.join(['%s=%s' % (k, v) for k, v in self.overrides.iteritems()])) AttributeError: 'dict' object has no attribute 'iteritems'

@pksw2016 not sure if this is still relevant to you, but .iteritems() was replaced with .items() so you can just write:

overrides=','.join(['%s=%s' % (k, v) for k, v in self.overrides.items()]))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants