python-2.7

Python -- what is NOT in 2.7 that IS in 3.1? So many things have been back-ported, what is NOT?

I've been following the saga of Python 3.x and have watched the 3.x features gradually getting back-ported to the 2.x line. Most of the libraries I use haven't been ported and some (e.g. Twisted) seem covertly or overtly hostile to 3.x to varying degrees. At any rate, there has been very little movement towards compatible versions of...

How much faster is Python 2.7's new IO library compared to earlier versions?

The Python 2.7 update note says: A new version of the io library, rewritten in C for performance. I've played with Python 2.7 a bit, but I don't see any performance gain: >>> from timeit import Timer >>> t = Timer('f = open("E:\\db.txt", "r"); f.read(); f.close()') >>> t.timeit(10000) And the result: Python 2.6.5 -- 12....

A Python 2.7, 3.0 Question for Pythonistas - Best Practices?

I am learning to program in Python and we have version 2.7 installed at work. Whenever I try to dive deep into Python, I never liked the dea of diving into a deprecated version (2.7). My work is not ready for 3.0 just yet. My question is : I want to write code in 2.7 which can easily be converted to 3.0 using 2to3. Honestly, I want to s...

Is there no mysql connector for python 2.7 on windows

While I see a bunch of links/binaries for mysql connector for python 2.6, I don't see one for 2.7 To use django, should I just revert to 2.6 or is there a way out ? I'm using windows 7 64bit django - 1.1 Mysql 5.1.50 Any pointers would be great. ...

Working around Python bug in different versions.

I've come across a bug in Python (at least in 2.6.1) for the bytearray.fromhex function. This is what happens if you try the example from the docstring: >>> bytearray.fromhex('B9 01EF') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: fromhex() argument 1 must be unicode, not str This example works f...

how can I stop all tests from inside a test or setUp using python's unittest framework

I'm extending the python 2.7 unittest framework to do some function testing. One of the things I would like to do is to stop all the tests from running inside of a test, and inside of a setUpClass method. Sometimes if a test fails, the program is so broken it is no longer of any use to keep testing, so I want to stop the tests from runn...

How to uninstall Python 2.7 on a Mac OS X 10.6.4?

I want to completely remove Python 2.7 from my Mac OS X 10.6.4. I managed to remove the entry from the PATH variable by reverting my .bash_profile. But I also want to remove all directories, files, symlinks, and entries that got installed by the Python 2.7 install package. I've got the install package from http://www.python.org/. What di...

Can I use a multiprocessing Queue in a function called by Pool.imap?

I'm using python 2.7, and trying to run some CPU heavy tasks in their own processes. I would like to be able to send messages back to the parent process to keep it informed of the current status of the process. The multiprocessing Queue seems perfect for this but I can't figure out how to get it work. So, this is my basic working exampl...

How come Pylons is not recognized when I run 'import pylons' in Windows Vista command prompt?

When I try to import pylons in the virtual python environment I get the error C:\env\Scripts>python Python 2.7 (r27:82525, Jul 4 2010, 07:43:08) [MSC v.1500 64 bit (A MD64)] on win32 Type "help", "copyright", "credits" or "license" for more informati on. >>> import pylons Traceback (most recent call last): File "<stdin>", line 1, in ...

m2crypto: python 2.7 compatibility and which version of OpenSSL to use?

We've been using M2crypto with Python 2.6 for Windows (32-bit) for some time with great success. We used one of the user contributed setups to install M2crypto in our development environments. We would like to move to Python 2.7, but noticed there are no pre-built Python 2.7 setups for m2crypto. Questions: Is M2crypto 0.20.2 compatibl...

AES encryption library compatible with Python 2.7 for Windows

Any recommendations on an AES encryption library that's compatible with Python 2.7 for Windows? In the past we've used m2crypto with Python 2.6, but there's no version of m2crypto for Python 2.7 and our attempts to build a version from source have failed. Thank you, Malcolm ...

zlib module missing

I have compiled and installed python 2.7 on my ubuntu lucid. But I am unable to install setuptools for python 2.7 because the data decompression module zlib is not present. This is the exact error: Traceback (most recent call last): File "setup.py", line 94, in <module> scripts = scripts, File "/usr/local/lib/python2.7/distut...

how to launch an exe with a variable path, special characters and arguements python 2.7

Hello. I want to copy an installer file from a location where one of the folder names changes as per the build number This works for defining the path where the last folder name changes import glob import os dirname = "z:\\zzinstall\\*.install" filespec = "setup.exe" print glob.glob (os.path.join (dirname, filespec)) # the print...

Python 2.7 cannot import PyQt4

I've upgraded to Python 2.7 from Python 2.6 on Ubuntu Maverick Meerkat (10.10) and I'm unable to import PyQt4. austin@gerald:~$ python2.7 Python 2.7.0+ (r27:82500, Sep 15 2010, 18:04:55) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import PyQt4 Traceback (most recent call last): Fil...