Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
965 views
in Technique[技术] by (71.8m points)

eclipse - Python 2.7 with Bloomberg API import blpapi failure

This is my development environment:

  • Windows 7 on a 64-bit HP Pavilion laptop
  • Python 2.7, 32-bit in folder C:python27
  • Development environment is Eclipse with PyDev, but this doesn't seem to matter, because I get the same kind of failure whether I use Anaconda or Notepad++.
  • Python 2.7 Binary Installer for Windows - 32-bit v3.5.3 Having set the Environment PATH in Windows for Python, the BLPAPI does find and install into the C:Python27 directory, creating C:Python27Libsite-packageslpapi.

Previous to my 32-bit installation of Python and BLPAPI I tried the 64-bit Python 2.7 with the 64-bit BLPAPI installation, but the results are the same for 64- or 32-bit.

My Python script fails on this one line: import blpapi

PyDev produces this error code:

Traceback (most recent call last):
  File "C:UsersGregworkspace2BloombergsrcTestImport.py", line 1, in <module>
    import blpapi
  File "C:Python27libsite-packageslpapi\__init__.py", line 5, in <module>
    from .internals import CorrelationId
  File "C:Python27libsite-packageslpapiinternals.py", line 50, in <module>
    _internals = swig_import_helper()
  File "C:Python27libsite-packageslpapiinternals.py", line 46, in swig_import_helper
_mod = imp.load_module('_internals', fp, pathname, description)
ImportError: DLL load failed: The specified module could not be found.
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I encountered a similar problem, and spent some time troubleshooting the issue with Bloomberg helpdesk. Here's what I learnt:

The ImportError is the result of Bloomberg not being able to find the "blpapi3_32.dll" DLL file. This DLL file can be located under the in or lib folder of Bloomberg's C/C++ library, which is at the same location where you got your Python executable. So go download that library (v3.7.5.1 as of this writing), and have your system's "Path" environment variable include that location. This should resolve the issue.

PS you can access the PATH variable via Start > right-clicking "Computer" > Properties > Advanced System Settings > Advanced (tab) > Environment Variables > look for the "Path" variable under "System variables". Edit this variable to include the location of the DLL file, e.g. if the original Path variable is "C:Python27Libsite-packagesPyQt4", then new Path variable should be "C:Python27Libsite-packagesPyQt4;C:lpAPIlpapi_cpp_3.7.5.1in"


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...