I m unable to test-run a cssparser that I d like to use.
test.py:
from css.parse import parse
data = """
em {
padding: 2px;
margin: 1em;
border-width: medium;
border-style: dashed;
line-height: 2.4em;
}
p { color: red; font-size: 12pt }
p:first-letter { color: green; font-size: 200% }
p:first-line { color: blue }"""
for rule in parse(data):
print (rule)
..gives an error:
Traceback (most recent call last):
method <module> in test.py at line 1
from css.parse import parse
method <module> in test.py at line 6
from . import css, csslex, cssyacc
method <module> in test.py at line 8
from . import serialize
method <module> in test.py at line 6
from . import css
ImportError: cannot import name css
Directory structure (/Users/nimbuz/Documents/python31):
/Users/nimbuz/Documents/python31/**csspy**/
|
+-- css/ (*has __init__.py*)
|
+-- uri/ (*has __init__.py*)
|
+-- test.py
print(sys.path) shows:
[ /Users/nimbuz/Documents/python31/csspy , /Library/Frameworks/Python.framework/Versions/3.1/lib/python31.zip , /Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1 , /Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/plat-darwin , /Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/lib-dynload , /Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages ]