WSL: ImportError: cannot import name 'textblob' - python

I have installed NLTK and TextBlob on Python3 on WSL. No matter what I do, I always obtain the same error. Indeed, trying to install shows that all packages are installed
$ sudo pip3 install -U textblob
The directory '/home/jlchulilla/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/jlchulilla/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already up-to-date: textblob in /usr/local/lib/python3.6/dist-packages
Requirement already up-to-date: nltk>=3.1 in /usr/local/lib/python3.6/dist-packages (from textblob)
Requirement already up-to-date: six in /usr/local/lib/python3.6/dist-packages (from nltk>=3.1->textblob)
But when I try to update corpora or use from textblob import TextBlob, this is the error message:
$ python3 -m textblob.download_corpora
Traceback (most recent call last):
File "/usr/lib/python3.6/subprocess.py", line 140, in <module>
import threading
File "/usr/lib/python3.6/threading.py", line 7, in <module>
from traceback import format_exc as _format_exc
File "/usr/lib/python3.6/traceback.py", line 5, in <module>
import linecache
File "/usr/lib/python3.6/linecache.py", line 11, in <module>
import tokenize
File "/mnt/c/Users/jlchu/Dropbox/oando/COVID-19/Supermercados online y covid_csv/prácticas NLTK/tokenize.py", line 1, in <module>
from textblob import textblob
ImportError: cannot import name 'textblob'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.6/runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "/usr/local/lib/python3.6/dist-packages/textblob/__init__.py", line 2, in <module>
from .blob import TextBlob, Word, Sentence, Blobber, WordList
File "/usr/local/lib/python3.6/dist-packages/textblob/blob.py", line 28, in <module>
import nltk
File "/usr/local/lib/python3.6/dist-packages/nltk/__init__.py", line 99, in <module>
from nltk.internals import config_java
File "/usr/local/lib/python3.6/dist-packages/nltk/internals.py", line 11, in <module>
import subprocess
File "/usr/lib/python3.6/subprocess.py", line 142, in <module>
import dummy_threading as threading
File "/usr/lib/python3.6/dummy_threading.py", line 45, in <module>
import threading
File "/usr/lib/python3.6/threading.py", line 7, in <module>
from traceback import format_exc as _format_exc
File "/usr/lib/python3.6/traceback.py", line 5, in <module>
import linecache
File "/usr/lib/python3.6/linecache.py", line 11, in <module>
import tokenize
File "/mnt/c/Users/jlchu/Dropbox/oando/COVID-19/Supermercados online y covid_csv/prácticas NLTK/tokenize.py", line 1, in <module>
from textblob import textblob
ImportError: cannot import name 'textblob'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3.6/subprocess.py", line 140, in <module>
import threading
File "/usr/lib/python3.6/threading.py", line 7, in <module>
from traceback import format_exc as _format_exc
ImportError: cannot import name 'format_exc'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 62, in apport_excepthook
import re, traceback
File "/usr/lib/python3.6/traceback.py", line 5, in <module>
import linecache
File "/usr/lib/python3.6/linecache.py", line 11, in <module>
import tokenize
File "/mnt/c/Users/jlchu/Dropbox/oando/COVID-19/Supermercados online y covid_csv/prácticas NLTK/tokenize.py", line 1, in <module>
from textblob import textblob
File "/usr/local/lib/python3.6/dist-packages/textblob/__init__.py", line 2, in <module>
from .blob import TextBlob, Word, Sentence, Blobber, WordList
File "/usr/local/lib/python3.6/dist-packages/textblob/blob.py", line 28, in <module>
import nltk
File "/usr/local/lib/python3.6/dist-packages/nltk/__init__.py", line 99, in <module>
from nltk.internals import config_java
File "/usr/local/lib/python3.6/dist-packages/nltk/internals.py", line 11, in <module>
import subprocess
File "/usr/lib/python3.6/subprocess.py", line 142, in <module>
import dummy_threading as threading
File "/usr/lib/python3.6/dummy_threading.py", line 45, in <module>
import threading
File "/usr/lib/python3.6/threading.py", line 7, in <module>
from traceback import format_exc as _format_exc
ImportError: cannot import name 'format_exc'
Original exception was:
Traceback (most recent call last):
File "/usr/lib/python3.6/subprocess.py", line 140, in <module>
import threading
File "/usr/lib/python3.6/threading.py", line 7, in <module>
from traceback import format_exc as _format_exc
File "/usr/lib/python3.6/traceback.py", line 5, in <module>
import linecache
File "/usr/lib/python3.6/linecache.py", line 11, in <module>
import tokenize
File "/mnt/c/Users/jlchu/Dropbox/oando/COVID-19/Supermercados online y covid_csv/prácticas NLTK/tokenize.py", line 1, in <module>
from textblob import textblob
ImportError: cannot import name 'textblob'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.6/runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "/usr/local/lib/python3.6/dist-packages/textblob/__init__.py", line 2, in <module>
from .blob import TextBlob, Word, Sentence, Blobber, WordList
File "/usr/local/lib/python3.6/dist-packages/textblob/blob.py", line 28, in <module>
import nltk
File "/usr/local/lib/python3.6/dist-packages/nltk/__init__.py", line 99, in <module>
from nltk.internals import config_java
File "/usr/local/lib/python3.6/dist-packages/nltk/internals.py", line 11, in <module>
import subprocess
File "/usr/lib/python3.6/subprocess.py", line 142, in <module>
import dummy_threading as threading
File "/usr/lib/python3.6/dummy_threading.py", line 45, in <module>
import threading
File "/usr/lib/python3.6/threading.py", line 7, in <module>
from traceback import format_exc as _format_exc
File "/usr/lib/python3.6/traceback.py", line 5, in <module>
import linecache
File "/usr/lib/python3.6/linecache.py", line 11, in <module>
import tokenize
File "/mnt/c/Users/jlchu/Dropbox/oando/COVID-19/Supermercados online y covid_csv/prácticas NLTK/tokenize.py", line 1, in <module>
from textblob import textblob
ImportError: cannot import name 'textblob'
I cannot understand where is the problem. Any help would be really appreciated
Edit: When I try to import any other module of NLTK library, same error happens. It's like if previous calling to 'tokenize' would have blocked the module or something
$ python3
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from nltk.stem.porter import PorterStemmer
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/nltk/__init__.py", line 99, in <module>
from nltk.internals import config_java
File "/usr/local/lib/python3.6/dist-packages/nltk/internals.py", line 11, in <module>
import subprocess
File "/usr/lib/python3.6/subprocess.py", line 140, in <module>
import threading
File "/usr/lib/python3.6/threading.py", line 7, in <module>
from traceback import format_exc as _format_exc
File "/usr/lib/python3.6/traceback.py", line 5, in <module>
import linecache
File "/usr/lib/python3.6/linecache.py", line 11, in <module>
import tokenize
File "/mnt/c/Users/jlchu/Dropbox/oando/COVID-19/Supermercados online y covid_csv/prácticas NLTK/tokenize.py", line 1, in <module>
from textblob import TextBlob
File "/usr/local/lib/python3.6/dist-packages/textblob/__init__.py", line 2, in <module>
from .blob import TextBlob, Word, Sentence, Blobber, WordList
File "/usr/local/lib/python3.6/dist-packages/textblob/blob.py", line 35, in <module>
from textblob.base import (BaseNPExtractor, BaseTagger, BaseTokenizer,
File "/usr/local/lib/python3.6/dist-packages/textblob/base.py", line 44, in <module>
class BaseTokenizer(with_metaclass(ABCMeta), nltk.tokenize.api.TokenizerI):
AttributeError: module 'nltk' has no attribute 'tokenize'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3.6/subprocess.py", line 140, in <module>
import threading
File "/usr/lib/python3.6/threading.py", line 7, in <module>
from traceback import format_exc as _format_exc
ImportError: cannot import name 'format_exc'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 62, in apport_excepthook
import re, traceback
File "/usr/lib/python3.6/traceback.py", line 5, in <module>
import linecache
File "/usr/lib/python3.6/linecache.py", line 11, in <module>
import tokenize
File "/mnt/c/Users/jlchu/Dropbox/oando/COVID-19/Supermercados online y covid_csv/prácticas NLTK/tokenize.py", line 1, in <module>
from textblob import TextBlob
File "/usr/local/lib/python3.6/dist-packages/textblob/__init__.py", line 2, in <module>
from .blob import TextBlob, Word, Sentence, Blobber, WordList
File "/usr/local/lib/python3.6/dist-packages/textblob/blob.py", line 28, in <module>
import nltk
File "/usr/local/lib/python3.6/dist-packages/nltk/__init__.py", line 99, in <module>
from nltk.internals import config_java
File "/usr/local/lib/python3.6/dist-packages/nltk/internals.py", line 11, in <module>
import subprocess
File "/usr/lib/python3.6/subprocess.py", line 142, in <module>
import dummy_threading as threading
File "/usr/lib/python3.6/dummy_threading.py", line 45, in <module>
import threading
File "/usr/lib/python3.6/threading.py", line 7, in <module>
from traceback import format_exc as _format_exc
ImportError: cannot import name 'format_exc'
Original exception was:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/nltk/__init__.py", line 99, in <module>
from nltk.internals import config_java
File "/usr/local/lib/python3.6/dist-packages/nltk/internals.py", line 11, in <module>
import subprocess
File "/usr/lib/python3.6/subprocess.py", line 140, in <module>
import threading
File "/usr/lib/python3.6/threading.py", line 7, in <module>
from traceback import format_exc as _format_exc
File "/usr/lib/python3.6/traceback.py", line 5, in <module>
import linecache
File "/usr/lib/python3.6/linecache.py", line 11, in <module>
import tokenize
File "/mnt/c/Users/jlchu/Dropbox/oando/COVID-19/Supermercados online y covid_csv/prácticas NLTK/tokenize.py", line 1, in <module>
from textblob import TextBlob
File "/usr/local/lib/python3.6/dist-packages/textblob/__init__.py", line 2, in <module>
from .blob import TextBlob, Word, Sentence, Blobber, WordList
File "/usr/local/lib/python3.6/dist-packages/textblob/blob.py", line 35, in <module>
from textblob.base import (BaseNPExtractor, BaseTagger, BaseTokenizer,
File "/usr/local/lib/python3.6/dist-packages/textblob/base.py", line 44, in <module>
class BaseTokenizer(with_metaclass(ABCMeta), nltk.tokenize.api.TokenizerI):
AttributeError: module 'nltk' has no attribute 'tokenize'

Related

ImportError: cannot import name 'get_distribution'

Python version: 3.6.8
SpaCy version: 2.1.4
Just try to import spacy:
Traceback (most recent call last):
File "src/discovery/pipeline/news/news_pipeline.py", line 9, in <module>
from src.discovery.modules.news.pipeline.auginewspipeline import AugINewsPipeline
File "/local/apps/discopyusr1/discovery-python/src/discovery/modules/news/pipeline/auginewspipeline.py", line 10, in <module>
from src.discovery.modules.news.pipeline.feature_extraction.featureextractor import FeatureExtracter
File "/local/apps/discopyusr1/discovery-python/src/discovery/modules/news/pipeline/feature_extraction/featureextractor.py", line 2, in <module>
import spacy
File "/usr/local/lib64/python3.6/site-packages/spacy/__init__.py", line 12, in <module>
from .cli.info import info as cli_info
File "/usr/local/lib64/python3.6/site-packages/spacy/cli/__init__.py", line 1, in <module>
from .download import download # noqa: F401
File "/usr/local/lib64/python3.6/site-packages/spacy/cli/download.py", line 11, in <module>
from .link import link
File "/usr/local/lib64/python3.6/site-packages/spacy/cli/link.py", line 9, in <module>
from .. import util
File "/usr/local/lib64/python3.6/site-packages/spacy/util.py", line 17, in <module>
from jsonschema import Draft4Validator
File "/usr/local/lib/python3.6/site-packages/jsonschema/__init__.py", line 32, in <module>
from pkg_resources import get_distribution
ImportError: cannot import name 'get_distribution'
install pkg-resources, that should fix it.
pip install pkg-resource. Make sure pip is up to date

ABI incompatibility while importing `scipy.sparse`

I'm running a script in a virtual environment on a new machine. Running the script gives me the following traceback.
Traceback:
Traceback (most recent call last):
File "zoneMapRGB.py", line 11, in <module>
from skimage import io, color
File "/opt/python/3.6/lib/python3.6/site-packages/skimage/io/__init__.py", line 11, in <module>
from ._io import *
File "/opt/python/3.6/lib/python3.6/site-packages/skimage/io/_io.py", line 7, in <module>
from ..color import rgb2grey
File "/opt/python/3.6/lib/python3.6/site-packages/skimage/color/__init__.py", line 1, in <module>
from .colorconv import (convert_colorspace,
File "/opt/python/3.6/lib/python3.6/site-packages/skimage/color/colorconv.py", line 368, in <module>
rgb_from_xyz = linalg.inv(xyz_from_rgb)
File "/opt/python/3.6/lib/python3.6/site-packages/scipy/linalg/basic.py", line 947, in inv
a1 = _asarray_validated(a, check_finite=check_finite)
File "/opt/python/3.6/lib/python3.6/site-packages/scipy/_lib/_util.py", line 228, in _asarray_validated
import scipy.sparse
File "/opt/python/3.6/lib/python3.6/site-packages/scipy/sparse/__init__.py", line 229, in <module>
from .csr import *
File "/opt/python/3.6/lib/python3.6/site-packages/scipy/sparse/csr.py", line 15, in <module>
from ._sparsetools import csr_tocsc, csr_tobsr, csr_count_blocks, \
ImportError: /opt/matlab/extern/engines/python/dist/matlab/engine/glnxa64/../../../../../../../sys/os/glnxa64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /opt/python/3.6/lib/python3.6/site-packages/scipy/sparse/_sparsetools.cpython-36m-x86_64-linux-gnu.so)
It seems scipy is trying to get libstdc++.so.6 from a matlab folder instead of the python directory. Is there any way to correct this behavior?

numpy suddenly started failing to import

I have anaconda installed. Running python 2.7. I have uninstalled, reinstalled, and upgraded numpy to 1.11.0, uninstalled and reinstalled pandas, and I still get this traceback when I try to import numpy:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/nicole/anaconda/lib/python2.7/site-packages/numpy-1.11.0-py2.7-macosx-10.5-x86_64.egg/numpy/__init__.py", line 180, in <module>
from . import add_newdocs
File "/Users/nicole/anaconda/lib/python2.7/site-packages/numpy-1.11.0-py2.7-macosx-10.5-x86_64.egg/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/Users/nicole/anaconda/lib/python2.7/site-packages/numpy-1.11.0-py2.7-macosx-10.5-x86_64.egg/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/Users/nicole/anaconda/lib/python2.7/site-packages/numpy-1.11.0-py2.7-macosx-10.5-x86_64.egg/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/Users/nicole/anaconda/lib/python2.7/site-packages/numpy-1.11.0-py2.7-macosx-10.5-x86_64.egg/numpy/core/__init__.py", line 58, in <module>
from numpy.testing.nosetester import _numpy_tester
File "/Users/nicole/anaconda/lib/python2.7/site-packages/numpy-1.11.0-py2.7-macosx-10.5-x86_64.egg/numpy/testing/__init__.py", line 12, in <module>
from . import decorators as dec
File "/Users/nicole/anaconda/lib/python2.7/site-packages/numpy-1.11.0-py2.7-macosx-10.5-x86_64.egg/numpy/testing/decorators.py", line 21, in <module>
from .utils import SkipTest
File "/Users/nicole/anaconda/lib/python2.7/site-packages/numpy-1.11.0-py2.7-macosx-10.5-x86_64.egg/numpy/testing/utils.py", line 15, in <module>
from tempfile import mkdtemp, mkstemp
File "/Users/nicole/anaconda/lib/python2.7/tempfile.py", line 35, in <module>
from random import Random as _Random
File "random/__init__.py", line 99, in <module>
from .mtrand import *
File "numpy.pxd", line 92, in init mtrand (numpy/random/mtrand/mtrand.c:37726)
It was working fine last night, which is really frustrating. Thank you for any insight.

scrapy startproject error

I am running into the following error while using the command scrapy startproject to create a project. I am running Python 2.7.6 through canopy on Ubuntu 14.04 (64 bit). I have installed all the required dependencies still I cannot find a solution to this. Can anyone help me with this?
Python27\Scripts>scrapy startproject ps_localize
Traceback (most recent call last):
File "/home/Enthought/Canopy_64bit/User/bin/scrapy", line 7, in <module>
from scrapy.cmdline import execute
File "/home/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/scrapy/cmdline.py", line 9, in <module>
from scrapy.crawler import CrawlerProcess
File "/home/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/scrapy/crawler.py", line 3, in <module>
from twisted.internet import reactor, defer
File "/home/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/twisted/internet/reactor.py", line 38, in <module>
from twisted.internet import default
File "/home/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/twisted/internet/default.py", line 56, in <module>
install = _getInstallFunction(platform)
File "/home/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/twisted/internet/default.py", line 44, in _getInstallFunction
from twisted.internet.epollreactor import install
File "/home/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/twisted/internet/epollreactor.py", line 24, in <module>
from twisted.internet import posixbase
File "/home/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/twisted/internet/posixbase.py", line 23, in <module>
from twisted.internet import error, udp, tcp
File "/home/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/twisted/internet/tcp.py", line 29, in <module>
from twisted.internet._newtls import (
File "/home/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/twisted/internet/_newtls.py", line 21, in <module>
from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol
File "/home/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/twisted/protocols/tls.py", line 41, in <module>
from OpenSSL.SSL import Error, ZeroReturnError, WantReadError
File "/home/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/home/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/OpenSSL/rand.py", line 11, in <module>
from OpenSSL._util import (
File "/home/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/OpenSSL/_util.py", line 7, in <module>
binding = Binding()
File "/home/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 114, in __init__
self._ensure_ffi_initialized()
File "/home/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 126, in _ensure_ffi_initialized
cls._modules,
File "/home/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/cryptography/hazmat/bindings/utils.py", line 31, in load_library_for_binding
lib = ffi.verifier.load_library()
File "/home/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/cffi/verifier.py", line 97, in load_library
return self._load_library()
File "/home/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/cffi/verifier.py", line 207, in _load_library
return self._vengine.load_library()
File "/home/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/cffi/vengine_cpy.py", line 155, in load_library
raise ffiplatform.VerificationError(error)
cffi.ffiplatform.VerificationError: importing '/home/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/cryptography/_Cryptography_cffi_a269d620xd5c405b7.so': /home/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/cryptography/_Cryptography_cffi_a269d620xd5c405b7.so: undefined symbol: EC_KEY_clear_flags

import module failed

The version I used is python2.7, error occurs when I used script, but it works in command line.
from twisted.internet import protocol, reactor
and the errors:
ravjqpejcnngpig.eqo/re/fgh/ocr
Traceback (most recent call last):
File "./tsTclntTW.py", line 5, in <module>
from twisted.internet import protocol, reactor
File "/usr/local/lib/python2.7/dist-packages/twisted/__init__.py", line 18, in <module>
from zope.interface import Interface
File "/usr/local/lib/python2.7/dist-packages/zope.interface-4.0.1-py2.7-linux-x86_64.egg/zope/__init__.py", line 3, in <module>
import pkg_resources
File "/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 698, in <module>
self.callbacks.append(callback)
File "/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 701, in Environment
File "/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 96, in get_supported_platform
distutils.util.get_platform() normally reports the minimum version
File "/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 222, in get_build_platform
# fallback for MacPorts
File "/usr/lib/python2.7/distutils/util.py", line 65, in get_platform
osname = string.lower(osname)
AttributeError: 'module' object has no attribute 'lower'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 64, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python2.7/dist-packages/apport/__init__.py", line 1, in <module>
from apport.report import Report
File "/usr/lib/python2.7/dist-packages/apport/report.py", line 18, in <module>
import problem_report
File "/usr/lib/python2.7/dist-packages/problem_report.py", line 16, in <module>
from email.mime.multipart import MIMEMultipart
File "/usr/lib/python2.7/email/mime/multipart.py", line 9, in <module>
from email.mime.base import MIMEBase
File "/usr/lib/python2.7/email/mime/base.py", line 9, in <module>
from email import message
File "/usr/lib/python2.7/email/message.py", line 16, in <module>
import email.charset
File "/usr/lib/python2.7/email/charset.py", line 14, in <module>
import email.quoprimime
File "/usr/lib/python2.7/email/quoprimime.py", line 48, in <module>
from string import hexdigits
ImportError: cannot import name hexdigits
Original exception was:
Traceback (most recent call last):
File "./tsTclntTW.py", line 5, in <module>
from twisted.internet import protocol, reactor
File "/usr/local/lib/python2.7/dist-packages/twisted/__init__.py", line 18, in <module>
from zope.interface import Interface
File "/usr/local/lib/python2.7/dist-packages/zope.interface-4.0.1-py2.7-linux-x86_64.egg/zope/__init__.py", line 3, in <module>
import pkg_resources
File "/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 698, in <module>
self.callbacks.append(callback)
File "/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 701, in Environment
File "/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 96, in get_supported_platform
distutils.util.get_platform() normally reports the minimum version
File "/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 222, in get_build_platform
# fallback for MacPorts
File "/usr/lib/python2.7/distutils/util.py", line 65, in get_platform
osname = string.lower(osname)
AttributeError: 'module' object has no attribute 'lower'
I have re-installed the Python I used and it doesn't work, I'm in Ubuntu 12.04. Also I have do
grep ravjqpejcnngpig.eqo/re/fgh/ocr . -R -n
under /usr/lib/python2.7 but nothing returned.
Perhaps you have a module named string in your project, and it shadows the library module of the same name.
EDIT: To find out, add this to your script just before the failing import statement:
import string
print string.__file__

Categories