Hello again,

Sorry, I don't know the Python binding. From the idl file you can see
that the ErrCodeIOException has a member "ErrCode" of type "long". I
expected that the Python bindings allows to access this member. Maybe
someone who knows the Python binding can help us here.

Clement wrote I should try:
Except Exception, e:
   print str(e)

But this only showed me, that apparently the ErrCode is not accessible in Python. e was an empty string :/

quit quickstarter
wait 10 secs
start quickstarter
wait 10 secs
start python app
initiate creation of document
save document to disk, thereby initiate extraction of rawtext
Oh, sorry I misunderstood you there. I now tried to do it this way, with the same results. I still have to try it once (let it fail), close the app, start the app, try it again (success).

Again, thanks for taking the time!
Daniela

--------------------------------------------------------------------------------------------
# original problem description
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 unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to