Had this issue when you’ve been trying to run something like Funnelweb, and you hit an ImportError for BeautifulSoup? You’re definitely not alone, because I just hit the same issue. The answer is simple — just ensure that you don’t use BeautifulSoup 4 or above (this is still beta) — it uses a different namespace, specifically bs4. Thus, whilst you might have the BeautifulSoup egg satisfying your dependencies, any imports of this package are going to fail.
For me, I’m using buildout, so I just pinned my version of BeautifulSoup thusly:
[buildout] ... versions = versions [versions] BeautifulSoup = 3.2.0
Now, we stop using BeautifulSoup 4.0 and everything works again.
This is pretty trivial (and trivial to fix), but I’m chronicling it for my knowledge as much as anyone else’s. The issue is that a given Python egg is missing some form of files, most commonly the ‘docs’ directory in my experience, because the build wasn’t configured correctly.
Continue reading »
Update: You should check out wildcard.fixpersistentutilities – it’s a fantastic solution to problems like this. Many thanks to Nathan Van Gheem, the author of the add on. Check out the link and see how to install it (temporarily) on your Plone instance that needs its site manager cleaned up.
Leftovers are typically useful when they’re in your fridge at home. They mean you don’t have to mess around making lunch for the next day for work, and can just grab them, and walk right out the door. Now, leftovers in the zope.component SiteManager aren’t so nice, especially when some Plone products fail to remove what they’ve registered. The consequences of this are that you’ve got references left which will break things when you uninstall/remove the physical eggs/files. These leftovers would be ones would be mutated food that comes to kill you after you’ve thrown it in the bin, assuming we follow the same analogy. But how to fix them?
Continue reading »
Here’s an interesting error message I got stumped with for a good set of hours. The issue started with me using collective.autoreload with Plone and it does the trick, mostly. With any such ‘operation’ and live reloading of code for Python, you’ve got to expect that not everything will go according to plan. Most things do, but one issue I found presented with this error message:
Continue reading »
Welcome to the new year! It’s the start of another journey around the sun and the beginning of work for me. Whilst I’m the only one actually working around here today, I thought I’d take the chance and update with some useful info:
Troublesome Python eggs
Now, much to my amazement, when you’re creating/compiling/whatever Python eggs for Plone you need to actually specify the files you want included in the build. I suppose it’s fair enough, but thought it might have actually done it for me. No such luck!
The SOURCES.txt file in the egg-info folder needs to be updated accordingly. A command like find ‘pwd` -name "*.*" will do the trick and list out the files in the directory (assuming you start from the root of the egg). If there’s extra stuff in the folder, you’ll probably need to weed out the extraneous files (.pyc, git, svn, etc) before building the egg with:
david@computer: python2.4 setup.py build david@computer: python2.4 setup.py sdist bdist_egg
which gets our lovely setuptools to build (scramble?) the egg and place the source and egg into the dist folder. Providing the SOURCES.txt file was correct, then you’ll have the right files included. If you don’t, you’ll be in for trouble when you try and include the egg under ZCML etc because the files just don’t come along for the ride.
Serve with sides of bacon and toast, place into your favourite PyPi (cheese shop) and include with your buildout config.
Further reading
If you’re really bored, check out http://peak.telecommunity.com/DevCenter/setuptools for some good material on what Setuptools can do for you.
