Bumblebee9898
Bumblebee9898

Reputation: 71

Getting no module named _internals error while using Bloomberg API

I am currently using Python 2.7 and my OS is Windows 7. While attempting to use the Bloomberg API I am getting this error:

Traceback (most recent call last):
   File "datagrab.py", line 1, in <module>
     import blpapi, time, json
   File "C:\Python27\lib\blpapi\__init__.py", line 5, in <module>
     from .internals import CorrelationId
   File "C:\Python27\lib\blpapi\internals.py", line 50, in <module>
     _internals = swig_import_helper()
   File "C:\Python27\lib\blpapi\internals.py", line 42, in swig_import_helper
     import _internals
   ImportError: No module named _internals

I have set my path variable to point to blpapi3_64.dll and also updated my bloomberg terminal. I have also moved the local blpapi API to a different directory but still the problem exists.

I am kind of new to this API in general. So can someone please guide me?

Thank you in advance!

Upvotes: 5

Views: 3511

Answers (2)

Vlox
Vlox

Reputation: 729

I know this question is a bit stale, but in case people end up here like me. Do you have the C++ version of blpapi? it is a requirement for the python api as mentioned here: https://www.bloomberg.com/professional/support/api-library/

so download the C++ zip installer, extract somewhere, and then add it as an environment variable so that the python api can find it:

Environment variable name: BLPAPI_ROOT Value: C:\blp\blpapi_cpp_3.8.18.1 (THIS IS WHERE MINE IS INSTALLED, YOUR VALUE HERE MAY BE DIFFERENT)

Hope that helps!

Upvotes: 1

mgilbert
mgilbert

Reputation: 3645

From your question is sounds like maybe you have tried this, but just outlining one possible solution from the README in the Python Supported Release release available here.

Note that many Python installations add the current directory to the module search path. If the Python interpreter is invoked from the installer directory, such a configuration will attempt to use the (incomplete) local blpapi directory as a module. If the above import line fails with the message Import Error: No module named _internals, move to a different directory before invoking python.

Upvotes: 1

Related Questions