OK, a few tips for those taking the plunge to Python 3. I installed via MacPorts Python 3.1. The biggest shock thus far is that setuptools and easy_install isn’t available for Python 3 (and apparently never will be). This was, as you may know, the easy way to install Python modules. It acts somewhat akin to how MacPorts does, but for Python modules. It was great. I gather though that the code was the kind of code that’s difficult at the best of times to maintain. With the language changes along with the lack of documentation and good comments the maintainers decided maintaining it was a lost cause. Which is quite sad.Getting appscript up and running was thus a tad trickier, although not significantly so. Just download the source release. Then at the command line (after uncompressing and cd to the top of the appscript source directory)
sudo python3.1 setup.py install
I did a few simple tests and thus far everything seems to work fine.
I did discover that when using the utility 2to3 to convert Python 2.x code to Python 3 code that you have to include the version name. Thus MacPorts installs in the Python 3.1 directory the command 2to3-3.1. There is also a 2to3-2.6 in the 2.6 directory. Why that is I’m not sure. It confused me to no end for a while.
Running the conversion on my programs worked fine. If you are converting the file with the -w option it creates a backup. I’m not quite sure how to handle everything just yet. We’ll see how it goes.
Note: this post is part 2 of a 3 post series. (Part 1 Part 2 Part 3)
Related posts:
.jpg)
Recent Comments