Fix misuse of length on arrays

Use scalar instead.
Fix py3k compatibility

print needs parentheses in py3k.
Make css.py agnostic regarding python install path
Make sheets.sh fail on errors
Limit sheets on res less than 300x300

Bigger ones consume too much memory during generation on a memoryfs
/tmp and they don't make sense for production either (files too big
for web deployment). Better to use separate files for each flags in
thoses cases.