| Eclipse plug-in for Plone/Zope/buildout based developmentPosted on March 29, 2010 by Mikko OhtamaaFiled Under buildout, eclipse, plone, pydev, python, zope Few days ago Fabio announced Django plug-in for Eclipse. There also exists an effort to make Eclipse integrate smoother with Plone / Zope / Buildout world. Please see PyPi page here. It is not nearly as polished as Fabio’s work, as Fabio being main author of PyDev and started as a collection of company internal tools. However if you mare making many buildouts, write code > 5 Python modules at once and don’t want to start terminal everytime you need to run buildout, this plug-in is for you. Also, it is not yet a real plug-in. It is a collection of PythonMonkey scripts. This means that to deploy the scripts you simply copy .py files them to scripts folder of any of your Eclipse projects. If you need to work on the codebase, you don’t need to start a separate Eclipse instance, but you can do it interactively through Eclipse console while you do other development. The script source code is well commented, so if you want to tune them for your own habits it should be easy. PyDev, Python and system default Unicode encoding problemPosted on January 24, 2010 by Mikko OhtamaaFiled Under aptana studio, eclipse, plone, pydev, technology Python 2 has a thing called “default encoding” to automagically encode Unicode strings when they are presented as byte strings. This is evil and has been discussed various times before. What could be even more evil? Something in your development environment messes this setting set for you, without telling you that. This way you never encounter Unicode problems on your development computer and when you roll out your seemingly working code to production, the world goes haywire. Evil. Evil. Evil. Thousands of curses and overworking hours to fix the problems. I encountered this problem. And this is the code I used to track the problem down in site.py: # Trap the bastard messing with the default encoding
# using a monkey patch
old_set_default_encoding = sys.setdefaultencoding
def aargh(x):
import pdb ; pdb.set_trace()
sys.setdefaultencoding = aargh
And the result was surprising:
Looks like the culprint was PyDev (Eclipse Python plug-in). The interfering source code is here. Looks like the reason was to co-operate with Eclipse console. However it has been done incorrectly. Instead of setting the console encoding, the encoding is set to whole Python run-time environment, messing up the target run-time where the development is being done. There is a possible fix for this problem. In Eclipse Run… dialog settings you can choose Console Encoding on Common tab. There is a possible value US-ASCII. I am not sure what Python 2 thinks “US-ASCII” encoding name, since the default is “ascii”. |
