Weird python 2.7 import thing

Dan Stromberg drsalists at
Thu Feb 18 20:40:22 EST 2016

OK, I'd rather be on 3.x, but that's not going to happen today.

So 2.7.

I have added directories to my sys.path hundreds of times before
importing from them, and know what to expect from that.  I confess, I
don't have a lot of package or egg experience.

However, I have a somewhat special (apparently) directory that isn't working.

The traceback, when I try to import it, looks like:
Traceback (most recent call last):
  File "t", line 17, in <module>
    from InfinityUnixHost.activities.ICWrap import ICWrap
  File "/home/dstromberg/PycharmProjects/infinity_PY/src/InfinityUnixHost/activities/",
line 8, in <module>
    from InfinityUnixHost.IPGlobal import DB_POOL
  File "/home/dstromberg/PycharmProjects/infinity_PY/src/InfinityUnixHost/",
line 12, in <module>
    INTERNAL_VERSION = pkg_resources.require("InfinityUnixHost")[0].version
  File "/home/dstromberg/virtualenvs/dev/local/lib/python2.7/site-packages/pkg_resources/",
line 941, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/home/dstromberg/virtualenvs/dev/local/lib/python2.7/site-packages/pkg_resources/",
line 828, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'InfinityUnixHost'
distribution was not found and is required by the application

And a tiny test program that produces this error is:
#!/usr/bin/env python

import sys
import os.path

sys.path.insert(0, os.path.abspath('src'))
sys.path.insert(0, os.path.abspath('eggs/InfinityCore-6-py2.7.egg'))
#for directory in sys.path:
#       # print(directory)
#       if \
#                       os.path.exists(os.path.join(directory,
'InfinityUnixHost')) and \
#                       os.path.exists(os.path.join(directory,
'InfinityUnixHost/activities')) and \
#                       os.path.exists(os.path.join(directory,
#               print('found in %s' % directory)

# from InfinityUnixHost.activities.ICWrap import ICWrap
from InfinityUnixHost.activities.ICWrap import ICWrap
dummy = ICWrap

BTW, the commented-out for loop can see the file I am trying to import
(when uncommented), but still, the import machinery doesn't load the

I can't share much detail about the InfinityUnixHost internals
unfortunately, but we can probably discuss it as needed.

Does anyone know why import is failing in this odd way?  It's not even
an ImportError!

BTW, this is not a package I pip installed from pypi - it's an
internal-only project.


More information about the Python-list mailing list