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
5
votes
2 answers

Python - Cannot upgrade six, issue uninstalling previous version

When I run sudo pip install --upgrade six I run into the issue below: 2016-01-20 18:29:48|optim $ sudo pip install --upgrade six Collecting six Downloading six-1.10.0-py2.py3-none-any.whl Installing collected packages: six Found…
tscizzle
  • 11,191
  • 15
  • 54
  • 88
5
votes
1 answer

Why does six.py use custom class for finding MAXSIZE?

I was going through the code for six.py in the django utils, which, for non Jython implementations, tries, to find the MAXSIZE for the int. Now, the way this is done is interesting - instead of catching an exception on the statement itself, the…
Anshul Goyal
  • 73,278
  • 37
  • 149
  • 186
4
votes
3 answers

module 'six.moves' has no attribute 'collections_abc'

I have a script that connects to YouTube API version 3 and retrieves public data. This script is deployed in airflow, it was working fine for a month, today it failed with this message for the following line: def youtube_search(term,region): …
Jonas Palačionis
  • 4,591
  • 4
  • 22
  • 55
4
votes
2 answers

PyCharm from six.moves import queue: unresolved reference 'queue'

I have installed the module "six", and it can be found by the PyCharm Interpreter. PyCharm Interpreter: However, PyCharm reports that it cannot resolve reference 'queue' which should be imported from six. Unresolved reference queue:
user3272089
  • 51
  • 1
  • 5
4
votes
2 answers

How to tell if a class is abstract in Python 3?

I wrote a metaclass that automatically registers its classes in a dict at runtime. In order for it to work properly, it must be able to ignore abstract classes. The code works really well in Python 2, but I've run into a wall trying to make it…
todofixthis
  • 1,072
  • 1
  • 12
  • 25
4
votes
1 answer

Import issue with Python six library

inside my virtualenv I have a lot of libraries that use six as dependency but paramiko and python-keystoneclient raise this import error: ERROR:paramiko.transport:Unknown exception: cannot import name urllib_parse ERROR:paramiko.transport:Traceback…
alauri
  • 317
  • 1
  • 4
  • 17
4
votes
1 answer

What is a python 2/3 compatible alternative to the unicode() function?

Is there an alternative to the python 2 unicode() function that can be used in code that will work with both python 2 and 3, and will definitely produce unicode output in python 2? the unicode() function does not exist in python 3 six.u(u'xyz')…
Hamish Downer
  • 16,603
  • 16
  • 90
  • 84
3
votes
3 answers

PyInstaller maximum recursion error after pre-safe import module hook [six.moves]

I am trying to use PyInstaller to convert my python3.5 project into an .exe file My main file is SegTool.py This is my .spec file: # -*- mode: python -*- block_cipher = None a = Analysis(['SegTool.py'], pathex=['consts.py',…
Keren Meron
  • 139
  • 3
  • 14
3
votes
1 answer

Why the Python 2, 3 compatibility package is named `six`?

Six provides simple utilities for wrapping over differences between Python 2 and Python 3. 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…
Ivor Zhou
  • 1,241
  • 13
  • 22
3
votes
1 answer

Python 2+3 compatible code: Should I avoid six?

This guide, Writing code that runs under both Python2 and 3, states that Use the third party six module sparingly (i.e. only if necessary). One good use case is the reraise() method. Why is this? I thought the whole point of six was to make Python…
Toke Faurby
  • 5,788
  • 9
  • 41
  • 62
3
votes
1 answer

Wow does six.with_metaclass() work?

Hi Stackoverflow community I have been trying to understand how Django (and Wagtail's Stream-field) work under the hood. Doing that I learned about metaclasses and believe to have a handle on the principle. That said, exactly how SIX executes the…
Mike Nedelko
  • 709
  • 1
  • 8
  • 28
3
votes
1 answer

Import error on 'from six import raise_from'

I'm trying to use the gmusicapi(https://github.com/simon-weber/gmusicapi). However when I try the following line: from gmusicapi import Webclient I get the following error message: Traceback (most recent call last): File "", line 1, in…
vbry
  • 78
  • 1
  • 7
3
votes
1 answer

How to add custom renames in six?

According to the documentation, six supports adding custom renames to six.moves: six.add_move(item) Add item to the six.moves mapping. item should be a MovedAttribute or MovedModule instance. And: class six.MovedModule(name, old_mod,…
Björn Pollex
  • 75,346
  • 28
  • 201
  • 283
2
votes
1 answer

potential bug when upgrading to PyTorch 1.9 ImportError: cannot import name 'int_classes' from 'torch._six'

I installed PyTorch using $ pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html I get this error: (proxy) [jalal@goku proxynca_pp]$ CUDA_VISIBLE_DEVICES=0,1 python train.py…
Mona Jalal
  • 34,860
  • 64
  • 239
  • 408
2
votes
1 answer

Key error in six.moves with return sys.modules[fullname]

I am trying to put together an Azure function to run on an HTTP trigger. My problem is whenever I run the function I get a key error exception from the six module. It seems to be called when importing pandas and I cannot figure out why. Here is the…
Ben
  • 41
  • 5
1
2
3
9 10