Extension 'Pattern along Path' python script fails
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| Inkscape |
Fix Released
|
Low
|
Alvin Penner | ||
Bug Description
Using Inkscape 0.47pre4 on WinXP SP3
- simple horizontally straight line (2 nodes) as path for pattern
- bezier curve as path to put pattern along
- use "pattern along path" extension
- tick the "pattern is vertical" check box, to get the pattern perpendicular along the path
Set "Copies of the pattern" to single: pattern is drawn as expected
Set "Copies of the pattern" to repeated: script fails with an ZeroDivisionError error.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Traceback (most recent call last):
File "D:\Program Files\Inkscape\
e.affect()
File "D:\Program Files\Inkscape\
self.effect()
File "D:\Program Files\Inkscape\
NbCopies=
ZeroDivisionError: float division
Related branches
removed: extension path pattern
Ran another test similar to the above:
If I set "Space between copies" to 1.0 the script runs fine with the repeated setting.
If I reduce the space (used 0.1) Inkscape eventually crashes with a MVC++ runtime error.
Perhaps some limitations in settings need to be calculated/set based on selected pattern for path generation?
- 486920-pattern-along-path.svg Edit (3.4 KiB, image/svg+xml)
not reproduced with Inkscape 0.47pre4 and 0.46+devel r22575 on OS X 10.5.8
can you attach a sample SVG file that produces this python error?
Depending on the complexity of the used pattern the result of the extension is one single path with a huge number of nodes, a file structure that often reaches the limits of Inkscapes rendering performance. OTOH it could be related to an issue as described in bug #193671 "Incorrect rendering and 16 exabyte memory usage", most likely due to limitations of the extension system implementation and possibly Python itself?
Have you tried to use the LivePathEffect 'Pattern Along Path' instead?
- 486920-pattern-along-path-2.svg Edit (695.7 KiB, image/svg+xml)
partly reproduced (after reading the steps more carefully ;-): pattern is straight line, path is bézier curve.
a) extension fails when pattern is vertical, repeated and 'space between copies' set to 0.0 with:
Traceback (most recent call last):
File "Contents/
e.affect()
File "/Volumes/
self.effect()
File "Contents/
for i in range(0,
OverflowError: range() result has too many items
b) extension works with 'space between copies' set to 0.1 (see attached file)
- SVG with 2 paths as used in my test Edit (3.7 KiB, image/svg+xml)
I can reproduce it exactly every time. And it always comes up with an ZeroDivisionError.
I do realise that this may not be the intended use for this extension because of the huge value of objects involved, I just stumbled upon it while I wanted to apply a limited number of repeats along the path, but forgot to set the spacing.
I have attached a file with paths that cause this behaviour on my system. I did a reboot of my system and started Inkscape, draw these 2 paths and ran the extension.
reproduced with your drawing in Inkscape 0.46+devel r22575 on OS X 10.5.8, Python 2.6.2
1) Resetting the preferences to default values (including those for the 'Pattern along Path' extension) and applying it to your example I get the same 'ZeroDivisionError' failure.
2) increasing the number of copies
- Setting 'space between copies' to 1.0 and [x] Live Preview works as expected.
- Lowering the spacing takes increasingly longer:
spacing 0.2: 4.5 minutes of CPU time to calculate and render
spacing 0.1: I canceled the test after letting Inkscape run for 50 min (without crash), it had partially created and rendered the new path but seemed unable to finish.
The extensions now rejects the 0 value for 'space between copies', and no longer shows performances issues (tested with 0.1, rendered in less than a second).
But there are remaining issues when the Vertical option and a stretched mode is set:
- With Unique, stretched, the following error message shows:
Traceback (most recent call last):
File "pathalongpath.py", line 284, in <module>
e.affect()
File "/usr/local/
self.effect()
File "pathalongpath.py", line 270, in effect
stretch(
ZeroDivisionError: float division by zero
- With Repeated, stretched, Inkscape crashed when I change the spacing value in live preview mode (with very low values, let's say 0.1, 0.2):
Program received signal SIGSEGV, Segmentation fault.
0x080e57ca in release (this=0xb4df810)
at /usr/include/
145 dispose();
Backtrace attached.
- pathalongpath.py Edit (11.5 KiB, text/x-python)
attached is a modified version of pathalongpath.py. This one will raise a warning message instead of crashing, if the pattern width is zero when using stretch.
committed to rev 10616