0

I am new to Python and inherited this project that runs on one environment but doesn't on another. This is what I get...

Traceback (most recent call last):
  File "/Users/orengross/Development/Clyng/infra/tests/clyng/tests/cl_same_item_in_array_twice.py", line 6, in <module>
    from clyng.config.cl_testconfig import get_customer, Accounts, hostname
  File "/Users/orengross/Development/Clyng/infra/tests/clyng/config/cl_testconfig.py", line 4, in <module>
    from clyng.utils import clyngcustomeruser
  File "/Users/orengross/Development/Clyng/infra/tests/clyng/utils/clyngcustomeruser.py", line 5, in <module>
    from clyng.networking.network_wraper import NetworkWrapper
  File "/Users/orengross/Development/Clyng/infra/tests/clyng/networking/network_wraper.py", line 7, in <module>
    from clyng.utils.clyngutils import logger, normalise
  File "/Users/orengross/Development/Clyng/infra/tests/clyng/utils/clyngutils.py", line 13, in <module>
    from faker import Factory
  File "/Library/Python/2.7/site-packages/faker/__init__.py", line 4, in <module>
    from faker.factory import Factory
  File "/Library/Python/2.7/site-packages/faker/factory.py", line 10, in <module>
    from faker.config import DEFAULT_LOCALE, PROVIDERS, AVAILABLE_LOCALES
  File "/Library/Python/2.7/site-packages/faker/config.py", line 13, in <module>
    AVAILABLE_LOCALES = find_available_locales(PROVIDERS)
  File "/Library/Python/2.7/site-packages/faker/utils/loading.py", line 19, in find_available_locales
    provider_module = import_module(provider_path)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/Library/Python/2.7/site-packages/faker/providers/address/__init__.py", line 6, in <module>
    from .. import date_time
  File "/Library/Python/2.7/site-packages/faker/providers/date_time/__init__.py", line 10, in <module>
    from dateutil.tz import tzlocal
  File "/Library/Python/2.7/site-packages/dateutil/tz/__init__.py", line 1, in <module>
    from .tz import *
  File "/Library/Python/2.7/site-packages/dateutil/tz/tz.py", line 23, in <module>
    from ._common import tzname_in_python2, _tzinfo, _total_seconds
  File "/Library/Python/2.7/site-packages/dateutil/tz/_common.py", line 2, in <module>
    from six.moves import _thread
ImportError: cannot import name _thread

I would appreciate any help.

Moinuddin Quadri
  • 46,825
  • 13
  • 96
  • 126
OZG
  • 509
  • 7
  • 19
  • 1
    Possible duplicate of [Matplotlib issue on OS X ("ImportError: cannot import name \_thread")](http://stackoverflow.com/questions/27630114/matplotlib-issue-on-os-x-importerror-cannot-import-name-thread) – Rahul K P Nov 23 '16 at 11:06

1 Answers1

0

The last line of the error is an attempt to import the function _thread from the module six.moves.

The 'six' module is designed to allow a Python program to work across machines with either 2.x or 3.x Python base installed. In this case it is looking for instances of the keyword thread in Python 2.x code and replace them with _thread if the machine is running Python 3.x. Documentation for six.moves is here https://pypi.python.org/pypi/six

Suggestions for a fix

  1. check that the new machine has the six.moves module installed
  2. if the code and new machine are both running Python 2.x try removing that import instruction. Look for a line of code that says `from six.moves import _thread'

You may find that clearing the first error exposes others, it's often a case of working back through each error until you get it working.

CJC
  • 400
  • 4
  • 15