Both the Web client and the script logic are sorting the images by their name and the order you see reflects the Python order:
>>> sorted(['s%d' % i for i in range(1, 15)])
['s1', 's10', 's11', 's12', 's13', 's14', 's2', 's3', 's4', 's5', 's6', 's7', 's8', 's9']
The first option gives full flexibility but it feels like every invocation of the script will need some custom input that depends on the dataset. So this might not be very scalable if you need to convert many of them.
For the second strategy, it is possible that the images are created in the order of the index. Could you check this is the case by looking at the image IDs in the client? If so, modifying the script to sort the images by their ID rather than their name might be an option.
Otherwise, the images need to be renamed to match the script assumptions. Post import, it should be possible to construct a script that runs against an entire dataset, looks for the maximal number of digits in the image names after a suffix (
scene) and renames all images by padding their index with zeros (