'Repetition' object has no attribute 'totalLength'
Closed this issue · 13 comments
The python program repetitionTest.py
does not run. It gives the error message:
'Repetition' object has no attribute 'totalLength'
This file hasn't been pushed to main yet
There might also be a problem as I think the only swiML.py that was updated was the one sitting at the top level in pythonXMLtest, I can go through and change all of them although I was planning on moving to top-level tomorrow
The same error happens in the file JasiMasters2024030501.py
I had copied the latest version of swiML.py into this directory this morning. It should be up to date.
in repetitionTest.py this section of code is erroring
`oneSet1=swiML.Instruction(
length=('lengthAsDistance',150),
stroke=('kicking',('standardKick','any'))
)
oneSet2Continue=swiML.Continue(
instructions=[
swiML.Instruction(
length=('lengthAsDistance',25),
stroke=('drill',('6KickDrill','freestyle'))
),
swiML.Instruction(
length=('lengthAsDistance',25),
stroke=('drill',('singleArm','butterfly'))
)
]
)
oneSet2=swiML.Repetition(
repetitionCount=2,
instructions=[oneSet2Continue]
)
oneSet3=swiML.Instruction(
length=('lengthAsDistance',150),
stroke=('standardStroke','any')
)
oneSet=swiML.Repetition(
simplify=True,
rest=('afterStop','PT0M15S'),
instructions=[
oneSet1,
oneSet2,
oneSet3
]
)`
but you're trying to simplify
150 kick
2 x 50 drill
150 swim
which doesn't make much sense
What should this output be?
fixed the issue so JasiMasters2024030501.py works now
repetitionTestpy now displays the correct error:
xception: Cannot simplify continue with repetitions of different lengths 150 meters any kick cannot be simplified with 50 swim as | 25 meters freestyle 6KickDrill drill | | 25 meters butterfly singleArm drill
The error is best seen in JasiMasters2024022501.py
. Have a look at the JasiMasters2024022501.jpeg
. It is 3x150. The second 150 is 3x(25drill, 25 another drill).
I think I modelled it in Python correctly, but maybe I got something wrong.
It's erroring because the second 150 isn't a 150 its 3x50 drill, you would need to wrap it in a continue. It gives a validation error because you can't simplify 150 with 3x50.
This is a good example of why I had made it possible to specify the total length of a continue. So in this case you could replace the 3x repetition with a continue that had a continue length of 150.
I updated the Python program JasiMasters2024022501.py
and it gives the error:
Continue.__init__() got an unexpected keyword argument 'continueLength'
I also updated the JasiMasters2024022501-manualXML.xml
with the continueLength. It transformed to HTML reasonably well.
But it also still triggers a validation error:
Assertion evaluation (' ((./sw:simplify = true()) and (every $length in .//sw:length satisfies $length/*[1] = (.//sw:length)[1]/*[1])) or ./sw:simplify = false() or count(./sw:simplify) = 0') for element 'repetition' on schema type 'repetitionType' did not succeed.
fixed the python - it now works with continue length
had a go at fixing the assertion but I'm still not sure whether its working properly
The assertion does not seem to work. I created a new program and it has the same validation error: JasiMasters2024031201.xml
JasiMasters2024022501-manualXML.xml
=> Tested and okay
JasiMasters2024031201.xml
=> Tested and okay
I tested JasiMasters2024022501.py
and it gives an error message:
Exception: Cannot simplify continue with repetitions of different lengths
150 meters any kick cannot be simplified with
('lengthAsDistance', 150) swim as
| | 25 meters freestyle 6KickDrill drill
| 3x |
| | 25 meters butterfly singleArm drill
The same construction in JasiMasters2024022501-manualXML.xml
works without any validation errors.
tested and works.