Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #103164 > unrolled thread

Weird python 2.7 import thing

Started byDan Stromberg <drsalists@gmail.com>
First post2016-02-18 17:40 -0800
Last post2016-02-18 17:40 -0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  Weird python 2.7 import thing Dan Stromberg <drsalists@gmail.com> - 2016-02-18 17:40 -0800

#103164 — Weird python 2.7 import thing

FromDan Stromberg <drsalists@gmail.com>
Date2016-02-18 17:40 -0800
SubjectWeird python 2.7 import thing
Message-ID<mailman.31.1455846025.2289.python-list@python.org>
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/ICWrap.py",
line 8, in <module>
    from InfinityUnixHost.IPGlobal import DB_POOL
  File "/home/dstromberg/PycharmProjects/infinity_PY/src/InfinityUnixHost/IPGlobal.py",
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/__init__.py",
line 941, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/home/dstromberg/virtualenvs/dev/local/lib/python2.7/site-packages/pkg_resources/__init__.py",
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,
'InfinityUnixHost/activities/ICWrap.py')):
#               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
module.

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.

Thanks!

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web