Questions tagged [six]

Six provides simple utilities for wrapping over differences between Python 2 and Python 3.

Six provides simple utilities for wrapping over differences between and . It is intended to support codebases that work on both Python 2 and 3 without modification. six consists of only one Python file, so it is painless to copy into a project.

147 questions
45
votes
3 answers

Python: Cannot uninstall 'six' while pip install tld

$ pip install tld Collecting tld Using cached https://files.pythonhosted.org/packages/fa/78/dbeaeb20db795c42deb81271fd65a35c040ce2e946024eaeef5c6b184176/tld-0.9-py2.py3-none-any.whl Collecting six>=1.9 (from tld) Using cached…
D09r
  • 1,411
  • 1
  • 12
  • 16
34
votes
4 answers

On OS X El Capitan I can not upgrade a python package dependent on the six compatibility utilities NOR can I remove six

I am trying to use scrape, but I have a problem. from six.moves import xmlrpc_client as xmlrpclib ImportError: cannot import name xmlrpc_client Then, I tried pip install --upgrade six scrape, but: Found existing installation: six 1.4.1 …
R.hui
  • 523
  • 1
  • 4
  • 8
25
votes
2 answers

Python import error: cannot import name 'six' from 'sklearn.externals'

I'm using numpy and mlrose, and all i have written so far is: import numpy as np import mlrose However, when i run it, it comes up with an error message: File "C:\Users\
Jack
  • 451
  • 1
  • 5
  • 10
22
votes
10 answers

Unable to upgrade python six package in mac osx 10.10.2

I am trying to install latest version of six python package but I have following issues. Can't get rid of six 1.4.1 in mac OSX 10.10.2 sudo pip install six --upgrade Requirement already up-to-date: six in /Library/Python/2.7/site-packages Cleaning…
Anish
  • 1,920
  • 11
  • 28
  • 48
21
votes
1 answer

Getting six and six.moves modules to autocomplete in PyCharm?

Is it possible to get imports for the six module to work in PyCharm? I realize the module does some playing with imports that confuses PyCharm but I was hoping there was some type of workaround. For example, I'd like the following to work properly…
kylehyde215
  • 1,216
  • 1
  • 11
  • 18
21
votes
2 answers

How to detect Python Version 2 or 3 in script?

I've written some scripts, which run either only with Version 2.x or some only with Version 3.x of Python. How can I detect inside the script, if it's started with fitting Python Version? Is there a command like: major, minor = getPythonVersion()
rundekugel
  • 1,118
  • 1
  • 10
  • 23
20
votes
2 answers

Scrapy: AttributeError: 'list' object has no attribute 'iteritems'

This is my first question on stack overflow. Recently I want to use linked-in-scraper, so I downloaded and instruct "scrapy crawl linkedin.com" and get the below error message. For your information, I use anaconda 2.3.0 and python 2.7.11. All the…
user124697
  • 325
  • 1
  • 3
  • 7
16
votes
3 answers

Python pip: ImportError cannot import name 'ensure_str' from 'six'. On multiple pip commands

I noticed that something was wrong when I first wanted to install the tqdm package for python3. Running pip install tqdm i revieved ImportError: cannot import name 'ensure_str' from 'six'…
cdath
  • 161
  • 1
  • 1
  • 5
12
votes
3 answers

How to install the Six module in Python2.7

I am using Python 2.7 and trying to use dateutil as follows: from dateutil import parser as _date_parser However, I get the following error: Traceback (most recent call last): File "", line 1, in from dateutil import…
Ravi
  • 3,223
  • 7
  • 37
  • 49
8
votes
1 answer

Writing cross-compatible Python 2/3: Difference between __future__, six, and future.utils?

I'm writing cross-compatible Python 2 and 3 code with some help from this cheatsheet. I've noticed there are different packages and modules that help to do this: the future package (e.g. future.utils etc), the six package, and the built in…
decvalts
  • 743
  • 10
  • 23
7
votes
5 answers

ImportError: No Module named six; six already installed

I'm running python 3.6 on Mac OS X El Capitan. I'm trying to run code that uses the six module, but am getting the following error: ImportError: No module named six. When I search for six it appears no problem, and I've made sure that the location…
Lucas13
  • 71
  • 1
  • 1
  • 3
7
votes
3 answers

Cannot import from Python six library

Cannot import anything from six. Both of these lines yield errors: from six.moves.urllib.request import urlretrieve --> Unresolved reference "urlretrieve" from six.moves import cPickle as pickle --> Unresolved reference "cPickle" OSX 10.11.5.…
Ron Cohen
  • 2,815
  • 5
  • 30
  • 45
5
votes
1 answer

Is six.text_type the same as text.decode('utf8')?

Given a function like: import six def convert_to_unicode(text): """Converts `text` to Unicode (if it's not already), assuming utf-8 input.""" if six.PY3: if isinstance(text, str): return text elif isinstance(text, bytes): …
alvas
  • 115,346
  • 109
  • 446
  • 738
5
votes
3 answers

ImportError: No module named moves

Versions Python : 2.7.14 six : 1.9.0 & 1.11.0(tried on both) OS : mac(10.13.3) & ubuntu(16.04) [tried on both] Error from six.moves import http_client ImportError: No module named moves Description In flask application which is running…
vinit payal
  • 1,201
  • 2
  • 13
  • 27
5
votes
3 answers

PyInstaller on 32-bit Linux - ImportError: The 'six' package is required

I'm making a program using Python2.7 and Kivy1.9.2-dev, and trying to package it with PyInstaller-3.0 for different systems as a single executable. The systems I'm trying to package it for are these: 64-bit Linux Mint 17.3 32-bit Linux Mint 17…
XArgon
  • 359
  • 4
  • 14
1
2 3
9 10