Python ImportError:无法导入名称mpManager - 为什么会发生这种情况?没有循环导入

时间:2016-10-17 23:47:57

标签: python python-import

我有一个在pyspookystuff / mav / init .py下定义的包变量:

key

当我在另一个包中导入变量mpManager(pyspookystuff / mav / comm.py)时:

from __future__ import print_function

import logging
import multiprocessing

import time


# existing has to be thread safe


# class DronePoolDepletedException(PyspookyException):
#     pass

mpManager = multiprocessing.Manager()

....

抛出以下错误:

import json
import os

import dronekit
import re
import sys

from pyspookystuff.mav import utils, mpManager

为什么会发生这种情况以及如何解决?我正在使用Python 2.7

UPDATE :我在引发导入错误的行之前插入了sys.path发现行:

Traceback (most recent call last):
  File "/home/peng/.IntelliJIdea2016.2/config/plugins/python/helpers/pydev/_pydev_bundle/pydev_monkey_qt.py", line 71, in patched_import
    return original_import(name, *args, **kwargs)
  File "/home/peng/git/datapassport/spookystuff/mav/pyspookystuff/mav/comm/__init__.py", line 8, in <module>
    from pyspookystuff.mav import utils, mpManager
ImportError: cannot import name mpManager

这是直接运行print(sys.path) (绕过IntelliJ IDEA / Pycharm runner)的结果:

python -m unittest discover

看起来完全正常,是否有助于找到错误?

0 个答案:

没有答案