Skip to content

Commit

Permalink
error handling on import user params and target_layer
Browse files Browse the repository at this point in the history
  • Loading branch information
florisvb committed Aug 10, 2018
1 parent dd92f0f commit 403c659
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion figurefirst/svg_to_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
figurefirst_user_parameters = 'default'

if figurefirst_user_parameters == 'default':
from . import figurefirst_user_parameters
try:
from . import figurefirst_user_parameters
except:
import figurefirst_user_parameters
else:
import imp
figurefirst_user_parameters = imp.load_source('figurefirst_user_parameters', figurefirst_user_parameters)
Expand Down Expand Up @@ -1131,9 +1134,12 @@ def clear_fflayer(self, fflayername):
except the figurefirst:targetlayer node.
'''
target_layers = self.output_xml.getElementsByTagNameNS(XMLNS, 'targetlayer')
target_layer = None
for tl in target_layers:
if tl.getAttribute('figurefirst:name') == fflayername:
target_layer = tl.parentNode
if target_layer is None:
return # no target found
removed_children = 1
while removed_children != 0: # this is not the prettiest way to do this, but it mostly works
remove = True
Expand Down

0 comments on commit 403c659

Please sign in to comment.