View Single Post
Old 10-25-2016, 06:56 PM   #14
slowsmile
Witchman
slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
My thanks to KevinH and DiapDealer for recognizing this as a fault.

Some added info that might help: I'm using Sigil v0.9.6 on Windows. This fault usually always occurs randomly whenever I use the File Splitter button(to the right of the Text/Html view button) on the Toolbar. I've always corrected this problem by just directly changing the first char in the uid to an alpha char within the opf file itself.

I've also written several python apps that deal with conversion to epub and, as a necessary consequence and precaution from this problem, I've also written several uid generators that work to only generate uids that always start with an alpha character. I don't know if this will be of any help to KevinH or DiapDealer but an example is given below:

Code:
from random import sample

#========================================================#
#
#     generates a 32 char uid with an alpha char start.
#
def getUID():
    """  Generates a 32 char uid in 8-4-4-4-12 grouping
         with an alpha char always as the start character. 
         This is necessary to avoid epubcheck "colon" errors
         occuring from structural uids used within epub xml files. 
    """

    # create a hex count sample
    a = ['1','2','3','4','5','6','7','8','9','a','b','c','d','e','f']
    
    # split the id into 8-4-4-4-12 grouping
    # and randomize sample length values
    b = sample(a, 8)
    c = sample(a, 4)
    d = sample(a, 4)
    e = sample(a, 4)
    f = sample(a, 12)
    
    # create a random alpha hex value as the first char
    z = ['a', 'b', 'c', 'd', 'e', 'f']
    first_char = sample(z, 1)
    b[0] = first_char[0]

    # merge the groups into strings
    b = ''.join(b)
    c = ''.join(c)
    d = ''.join(d)
    e = ''.join(e)
    f = ''.join(f)
    
    # build the uid
    uid = b + '-' + c + '-' + d + '-' + e + '-' + f
    
    return(uid)

Last edited by slowsmile; 10-25-2016 at 08:59 PM.
slowsmile is offline   Reply With Quote