List Info

Thread: quickstarter / storeToURL problem (python)




quickstarter / storeToURL problem (python)
user name
2006-01-18 09:46:30
Hello list,

I have encountered a problem that I cannot understand no
matter how hard
I try:

I have  a python app that calls openoffice to create a
writer document.
it then saves it to disk
using model.storeAsURL where model is the current document.
So far so good.
Then I want to extract the raw text from the document using
this function:

# code snippet
################################################
def rawText(self, model, storepath):
    cwd = systemPathToFileUrl( getcwd() )
    makedir(self)
    filename = os.environ['TEMP'] + '\' + storepath +
'.txt'
    storeUrl = absolutize( cwd,
systemPathToFileUrl(filename) )
    filterName = "Text (Encoded)"
    storeProps = PropertyValue( "FilterName" , 0,
filterName , 0 ),
    model.storeToURL(storeUrl, storeProps)
# end of code snippet
##########################################

now - this code works. everytime. EXCEPT for, when i just
restarted the
quickstarter.
so the way to reproduce the problem is:
quit quickstarter. start quickstarter. start python app.
initiate
creation of document. save
document to disk, thereby initiate extraction of rawtext.
->
ErrorCodeIOException
the way to "solve" this problem is:
quit python app. start python app. initiate creation of
document. save
document to disk,
thereby initiate extraction of rawtext. -> success.

i suspected it might have something to do with how fast the
office gets
done with the
saving of the document and all and tried working around that
by using
this code:

# code snippet #######################################
def rawText(self, model, storepath):
    cwd = systemPathToFileUrl( getcwd() )
    makedir(self)
    filename = os.environ['TEMP'] + '\' + storepath +
'.txt'
    storeUrl = absolutize( cwd,
systemPathToFileUrl(filename) )
    filterName = "Text (Encoded)"
    storeProps = PropertyValue( "FilterName" , 0,
filterName , 0 ),
    try:
        open(os.environ['TEMP'] + '\'+ storepath, 'r')
        model.storeToURL(storeUrl, storeProps)
    except ErrorCodeIOException:
        time.sleep(2)
        rawText(self, model, storepath)
# end of code snippet ##################################

to no avail though. :/ if there's anybody with any
explanation or
workaround or
even fix for this problem, please respond.
Thanks in advance,
Daniela


------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org

quickstarter / storeToURL problem (python)
user name
2006-01-18 17:48:47
Daniela Garling wrote:

> so the way to reproduce the problem is:
> quit quickstarter. start quickstarter. start python
app. initiate
> creation of document. save
> document to disk, thereby initiate extraction of
rawtext. ->
> ErrorCodeIOException

Did you try the same with making a pause between the steps
(e.g. for 10
seconds or so)?

Best regards,
Mathias

-- 
Mathias Bauer - OpenOffice.org Application Framework Project
Lead
Please reply to the list only, nospamforMBAgmx.de is
a spam sink.

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )