lxml installed, no attribute error again!

So my hosting has very kindly installed lxml for Python 2.7 for me.

That fixed my problem of having a mismatched version error and the error with no tree builder found.


There is however, still an error with my BlogPageIndex having an AttributeError that only shows up as ‘cannot save draft due to errors’ on my Wagtail interface.

also had the embarrassment of pronouncing Django wrong in a conversation. That quite possibly caused me Internal System Error with missing module ‘shy’.

Circular Dependency

So is the cause of my

AttributeError at /admin/login/

'module' object has no attribute 'compile'

a circular dependency within the modules?

Thie StackOverflow question shows an example of what you’d do to get :

AttributeError: 'module' object has no attribute 'blahblah'

In this case it was cause by circular dependency or mutual top-level imports. I suppose that’s a bit like causing this to happen within your files, where a calls b which calls a ….:


Let me try and see if this is what’s happening with my SassCompiler?

import sass
from compressor.filters.base import FilterBase

Sass is on my Path and Python Path (I checked by importing it in Python and then checking my sys.path).

FilterBase can be found in compressor filter’s

class FilterBase(object):

def __init__(self, content, filter_type=None, filename=None, verbose=0):
 self.type = filter_type
 self.content = content
 self.verbose = verbose or settings.COMPRESS_VERBOSE
 self.logger = logger
 self.filename = filename
def input(self, **kwargs):
 raise NotImplementedError
def output(self, **kwargs):
 raise NotImplementedError

from this we see a class field FilterBase and subclass Object.

Q: What are Field Classes?

  • The first class is the Python object that your users will manipulate. They will assign it to the model attribute, they will read from it for displaying purposes, things like that.
  • The second class is the Field subclass. This is the class that knows how to convert your first class back and forth between its permanent storage form and the Python form.

What’s an file?

Picture 19

It’s usually empty, though some times there’s some instructions in there that’s too high level for me right now.

Having an file tells python to ‘see’ the directory it is in as a python module. Hence all packages (applications) will have an file or several ones within each separate module .

Not having it, or having it in the wrong places will most likely throw an Unhandled Exception.


Q: If it’s empty anyway, can I just copy it into different directories?

I tried, and it doesn’t throw an error unless you copied it into a folder that isn’t meant to be a python module. Then you will get an Unhandled Exception shown in your browser.

Q: What about the pyc file that comes with it?

That woozy file __init__.pyc looks like this:


and is for computers to read. You can delete it (sometimes a .pyc file doesn’t update to reflect the changes in the py file and causes trouble), and a new .pyc file will be generated by your friend the computer when it next requires.


SassCompile on command line

Following this StackOverflow reply,

/bin/sh: django_libsass.SassCompiler: command not found

Indicates that Django Compressor is trying to run django_libsass.SassCompiler as a shell command, and the script is failing to run. -Kevin Mooney

So digging through the traceback, I found a line that referenced compressor.

Further digging into compressor reveals this line in


if "{outfile}" in self.command and not "outfile" in options:
ext = self.type and ".%s" % self.type or ""
self.outfile = NamedTemporaryFile(mode='r+', suffix=ext)
options["outfile"] =
command = fstr(self.command).format(**options)
proc = subprocess.Popen(command, shell=True, cwd=self.cwd,
stdout=self.stdout, stdin=self.stdin, stderr=self.stderr)
if self.infile is None:
filtered, err = proc.communicate(self.content.encode('utf8'))
filtered, err = proc.communicate()
except (IOError, OSError), e:
raise FilterError('Unable to apply %s (%r): %s' %
(self.__class__.__name__, self.command, e))

So being the brutish non-coder that I am, I simply turned that ‘off’ to :

command = fstr(self.command).format(**options)
proc = subprocess.Popen(command, shell=False, cwd=self.cwd,
stdout=self.stdout, stdin=self.stdin, stderr=self.stderr)

It definitely helped to stop the

Error during template rendering

In template /home/username/env/lib/python2.7/site-packages/wagtail/wagtailadmin/templates/wagtailadmin/skeleton.html, error at line 20
/bin/sh: django_libsass.SassCompiler: command not found

Although now I get a :

'module' object has no attribute 'compile'

Hmm… let’s see where to go next?

ln -s your modules

Note to self: Remember to create symblinks of your modules in the site-packages folder of your virtualenv!

As I’m on a shared hosting, packages that need to be globally installed like south, six and Pillow, will not appear in ~/env/lib/python2.7/site-packages

neither will they appear when you attempt a pip list or pip freeze

and if you attempt to pip install them, you will encounter gcc permission error.

(env) [~/env/lib/python2.7/site-packages]# ln -s /usr/lib/path/to/module

Check that your link is correct and it isn’t red text with a black background.

Will do a post on symlinks and their different colours and meanings.

If the links are not there or are wrong, you will most likely get an Unhandled Exception or maybe an Internal Server Error.

SSH Access

So I’ve picked a host: A SMALL ORANGE

Reasons for picking ASO will be listed in a separate post.

First thing I realise is that to setup Django, you have to have Shell access. What’s that? In my terms, that means hacking into the backside of the web with all its guts and stuff.

Picture 13

If you’re on a shared hosting, chances are, you will need to ask them to set up Shell access permission for you.

Following which you need a console of some sort to access Shell of course. The tech guy recommended Putty. But that’s for Windows only. So i’m using Terminal.

Yes! Terminal isn’t just for hacking into your Mac! It’s for hacking into other stuff as well.



to enter into your domain’s shell, key in ssh (or .co or .org etc.) The password is most likely the same password you use to enter into your domain’s cpanel.


dudecomputer:~ dude$ ssh