Ke.
Ke.

Reputation: 2586

How to import the six library to python 2.5.2

I'm wondering how I can import the six library to python 2.5.2? It's not possible for me to install using pip, as it's a closed system I'm using.

I have tried to add the six.py file into the lib path. and then use "import six". However, it doesnt seem to be picking up the library from this path.

Upvotes: 0

Views: 414

Answers (2)

Łukasz Rogalski
Łukasz Rogalski

Reputation: 23233

According to project history, version 1.9.0 supports Python 2.5. Compatibility broke with 1.10.0 release.

Six supports every Python version since 2.5. It is contained in only one Python file, so it can be easily copied into your project. (The copyright and license notice must be retained.)

There is a commit in version control system which mentions change of minimum supported version.

Note that pip is able to install fixed version of package if you want to.

pip install six==1.9.0

Upvotes: 1

Martijn Pieters
Martijn Pieters

Reputation: 1123340

You can't use six on Python 2.5; it requires Python 2.6 or newer.

From the six project homepage:

Six supports every Python version since 2.6.

Trying to install six on Python 2.5 anyway fails as the included setup.py tries to import the six module, which tries to access objects not available in Python 2.5:

Traceback (most recent call last):    
  File "<string>", line 16, in <module>
  File "/private/tmp/test/build/six/setup.py", line 8, in <module>
    import six
  File "six.py", line 604, in <module>
    viewkeys = operator.methodcaller("viewkeys")
AttributeError: 'module' object has no attribute 'methodcaller'

Upvotes: 0

Related Questions