klen / python-scss

Python scss parser.
http://packages.python.org/scss/
GNU Lesser General Public License v3.0
67 stars 12 forks source link

AttributeError: 'str' object has no attribute 'data' #32

Open zzzeek opened 10 years ago

zzzeek commented 10 years ago

seeing as all the open tickets are two years old I'm getting the impression this is a dead project, but just in case it's not, this seems like a really basic parsing issue, replicates with the latest git master, I'm new to sass so not sure if I'm doing something wrong. The script below compiles fine if you remove one or the other of ".content" or ".footer". But both of them, both with the @extend, boom (plus lots of other variants):

.pagetext {
    color: #FFF;
}

.content {
    @extend .pagetext;
    font-size: 2em;
}

.footer {
    @extend .pagetext;
    font-size: 1em;
}

output:

$ python -m scss.tool ~/path_to_my/_sass/test.scss 
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/src/python-scss/scss/tool.py", line 191, in <module>
    main()
  File "/usr/local/src/python-scss/scss/tool.py", line 185, in main
    outfile.write(s.load(infile))
  File "scss/parser.py", line 352, in load
    self.parse(nodes)
  File "scss/parser.py", line 312, in parse
    map(lambda n: n.parse(self) if isinstance(n, Node) else None, nodes)
  File "scss/parser.py", line 312, in <lambda>
    map(lambda n: n.parse(self) if isinstance(n, Node) else None, nodes)
  File "scss/parser.py", line 62, in parse
    super(Ruleset, self).parse(target)
  File "scss/base.py", line 56, in parse
    n.parse(self)
  File "scss/control.py", line 126, in parse
    rule.name.extend(target.name)
  File "scss/parser.py", line 131, in extend
    self.data = (self_test + ', ' + self_test.replace(str(self.data[0].data[0]), target_test)).split(', ')
AttributeError: 'str' object has no attribute 'data'