views:

36

answers:

1

I downloaded the Python 2.6.5 source, built it for OS 10.6.4 64-bit, and installed numerous dependencies. I opened a big project our team has been working on recently, ran the unit tests, and one of the tests failed because I had installed Python built using UCS-2 (I didn't know this was the default of OS X!)

In a nutshell: I didn't supply flag --enable-unicode=ucs4 when building Python. (as I discovered was necessary: http://copia.posterous.com/confusion-over-python-storage-form-for-unicod)

Now I want to correct this without losing everything I put in site-packages.

Is this possible? If so, how?

Thank you! Michaux

+1  A: 

You can save and restore /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages (e.g. as a .tar.bz2), but the restored .sos will not work properly if any of their entry points deal with Python Unicode objects -- so, those packages (containing any such .so files) you'll have to rebuild/reinstall once your new Python version is working! Hopefully that's a far cry from "everything" you've put in site-packages (fingers crossed).

Alex Martelli
I'm feeling brave tonight. I think I'll try your suggestion; however, before I do: do you foresee any complications given that I rely upon the SciPy, Numpy, libsvm, bsddb3, MySQL_python-1.2.3, and pyodbc in my site-packages? (Also, I've set my PATH to use the Python I installed into /usr/local/lib)Thanks again!
mkelley33
@mkelley, it depends -- do you care to send to any of those packages, or receive back from them, Unicode objects? If so, then they'll have to be rebuilt -- but if you only send and receive byte strings (or non-string data), then I would not expect that.
Alex Martelli
Thank you. I do plan to send Unicode objects to them. I have more to learn about how and why the .so files are involved. For now, I'm willing to risk that I might have to re-install the aforementioned dependencies (I made sure to document "how" I got them built and installed in the first place!) Thank you!
mkelley33
@mkelley, you're welcome -- point is, if you send or receive unicode in UCS-4 to/from an extension (`.so`) built with UCS-2, you'll at least be passing or getting the wrong data (and perhaps risking a crash, though offhand I'm not sure about the latter point).
Alex Martelli