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


Groups > comp.lang.python > #103164

Weird python 2.7 import thing

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Dan Stromberg <drsalists@gmail.com>
Newsgroups comp.lang.python
Subject Weird python 2.7 import thing
Date Thu, 18 Feb 2016 17:40:22 -0800
Lines 68
Message-ID <mailman.31.1455846025.2289.python-list@python.org> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de F4TB9ggmjAjF5B3CxEQSWwoDzfOliFBMiM15P/VmOBPw==
Return-Path <drsalists@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'failing': 0.05; 'sys': 0.05; 'pypi': 0.07; "%s'": 0.09; 'directory)': 0.09; 'os.path': 0.09; 'skip:" 80': 0.09; 'subject:2.7': 0.09; 'python': 0.10; 'subject:python': 0.14; 'importing': 0.15; "skip:' 30": 0.15; '(when': 0.16; 'dummy': 0.16; 'egg': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'still,': 0.16; 'subject:import': 0.16; 'sys.path': 0.16; 'sys.path:': 0.16; 'to:name:python list': 0.16; 'odd': 0.18; 'working.': 0.18; 'load': 0.20; 'received:209.85.214.174': 0.22; 'produces': 0.22; "skip:' 40": 0.22; 'trying': 0.22; 'needed.': 0.23; 'import': 0.24; '(most': 0.24; "doesn't": 0.26; 'installed': 0.26; 'error': 0.27; 'skip:# 10': 0.27; 'message-id:@mail.gmail.com': 0.27; 'module.': 0.27; "skip:' 10": 0.28; 'looks': 0.29; 'btw,': 0.29; 'way?': 0.29; 'raise': 0.29; 'that.': 0.30; "i'd": 0.31; 'probably': 0.31; 'anyone': 0.32; "can't": 0.32; 'traceback': 0.33; "skip:' 20": 0.34; 'thanks!': 0.34; 'file': 0.34; 'skip:d 20': 0.34; 'received:google.com': 0.35; "isn't": 0.35; 'skip:p 30': 0.35; 'but': 0.36; 'skip:i 20': 0.36; 'needed': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'expect': 0.37; '12,': 0.37; 'hundreds': 0.37; 'detail': 0.38; 'received:209': 0.38; 'skip:s 40': 0.38; 'skip:o 20': 0.38; 'why': 0.39; 'test': 0.39; 'does': 0.39; 'application': 0.39; 'received:209.85.214': 0.39; 'rather': 0.39; 'to:addr:python.org': 0.40; 'share': 0.61; 'skip:u 10': 0.61; 'discuss': 0.61; 'times': 0.63; 'experience.': 0.66; 'today.': 0.67; 'special': 0.73; '2.7.': 0.84; 'pip': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=5o5m0fBe7EjEzfYPG/xE9LlftOp2AZ2FGiLtrDYUVz8=; b=uPss9nfgHQCgEWkKAr7IGUcnTKF0vnkuMLxvunLlrva2Wq2t2Q+CQjs4IxoOzuVhRg rgIDiYOeRz2AM8+mzkbVvQBvjh7T+FEpGnwm94rqd/7nbL6dJzx2U8aEejjUdnacnsZX CTmaGXbv+nDHVCyXD7BKl0TFiBiMZcyJD4BKpDaKy75pkNVyDZj4eajKdeigLnCK6cMb zJ89DnaCIkXEnhw4fhLn2Xb2KyNPzdtn0qJ7Eb1K5hRO6PGyyaC2VbbStVCHGng9lAZN uJanxrgb8f7MiEUJ5E+J79x5TDNCtVWhifJkoXfKPyVuCqlvwUkfffhiVX/eIzVLx33E VMSA==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=5o5m0fBe7EjEzfYPG/xE9LlftOp2AZ2FGiLtrDYUVz8=; b=YpOVMmqszZyni2CZAg0qwGnC0Qq8AC5iDxN7e/I2+M5s6uxPyOjVDVtJqNiQblhxsA T+Gku1UvXoK88LP0XC18cvjEo3XPaqHDQkZTkoIed8eHDAH18b5gk5a5IrTCEOLv/mWD I8S+9shq7qFL3iIcTyHWzLHYlUC/dlE9Mff1Wp3RoUlficIUehcjZ5BneynUesuPkApz 4fj0o/xa33nM7IFLU9IPNxqbRAR0w2NHOOZ5Yu9B31VJvYxhdHv6AKGJzQ1hl/a0QYRO clATyoRHKQQ+YHp7S19OFs5uVt0Sc8HCz5O3AmOg/CAqKS7ibPRHvlJU3tyorbyIxwXk pR9A==
X-Gm-Message-State AG10YOQmD8kSS8ACSrPNk6J/XUQ4Z96KTUIxXcH60sL+17RKZNLkfY/SkPJu5J9DCS2uCwe0C/m/h/djDwlttw==
X-Received by 10.182.108.201 with SMTP id hm9mr9136923obb.16.1455846022592; Thu, 18 Feb 2016 17:40:22 -0800 (PST)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21rc2
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:103164

Show key headers only | View raw


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!

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web