-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: 'NoneType' object has no attribute 'endswith' #8
Comments
By the way, this doesn't happen when using the SVG's provided in the example, those work. My SVG's look like this:
|
Same, this is annoying. But a small tweak did the job: def get_unit_attr(value):
# coordinate handling from http://www.w3.org/TR/SVG11/coords.html#Units
units = None # default (user)
+ if value is None:
+ return 0.0, 'px'
for unit_name in UNITS:
if value.endswith(unit_name):
units = unit_name
value = value[:-len(unit_name)]
break
val_float = float(value) # this will fail if units str not parsed
return val_float, units |
Thank you so much @math2001 !!! This helped get the script working for me! |
Confirmed fixed in 3c150a3. Sorry for the delay and thanks for the report. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Traceback (most recent call last):
File "./svg_stack.py", line 713, in
main()
File "./svg_stack.py", line 706, in main
layout.addSVG(fname,alignment=AlignCenter)
File "./svg_stack.py", line 632, in addSVG
svg_file = SVGFile(svg_file)
File "./svg_stack.py", line 181, in init
height, height_units = get_unit_attr(self._root.get('height'))
File "./svg_stack.py", line 44, in get_unit_attr
if value.endswith(unit_name):
AttributeError: 'NoneType' object has no attribute 'endswith'
I'm getting this error when running svg_stack via the following commands:
python2 ./svg_stack.py --direction=h --margin=100 virus.svg web-interface.svg > shapes.svg
python ./svg_stack.py --direction=h --margin=100 virus.svg web-interface.svg > shapes.svg
./svg_stack.py --direction=h --margin=100 virus.svg web-interface.svg > shapes.svg
I also tried running ./setup.py install and
svg_stack.py --direction=h --margin=100 virus.svg web-interface.svg > shapes.svg
gives same error.
I've also installed python-lxml and python3-lxml to no avail. Any idea what I'm doing wrong here?
The text was updated successfully, but these errors were encountered: