Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 82589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:38:26+00:00 2026-05-10T21:38:26+00:00

Well I testing my jython program, that does some neat [.xls, .doc, .rtf, .tif,

  • 0

Well I testing my jython program, that does some neat [‘.xls’, ‘.doc’, ‘.rtf’, ‘.tif’, ‘.tiff’, ‘.pdf’ files] -> pdf (intermediary file) -> tif (final output) conversion using Open Office. We moved away from MS Office due to the problems we had with automation. Now it seems we have knocked down many bottles related to show stopper errors with one bottle remaining. OO hangs after a while.

It happens where you see this line ‘<<<<<<<<<<<<‘ in the code

What is the correct way for me to handle a stalled Open Office process. could you please provide useful links, and give me a good suggestion on the way out.
Also one more question.

Sum up:
* How to handle a stalled Open Office instance?
* How to make conversion with java headless, so I dont have a GUI popping up all the time wasting memory.
* also any general suggestions on code quality, optimizations and general coding standards will be most appreciated.


Traceback (innermost last):
File ‘dcmail.py’, line 184, in ?
File ‘dcmail.py’, line 174, in main
File ‘C:\DCMail\digestemails.py’, line 126, in process_inbox
File ‘C:\DCMail\digestemails.py’, line 258, in _convert
File ‘C:\DCMail\digestemails.py’, line 284, in _choose_conversion_type
File ‘C:\DCMail\digestemails.py’, line 287, in _open_office_convert
File ‘C:\DCMail\digestemails.py’, line 299, in _load_attachment_to_convert
com.sun.star.lang.DisposedException: java.io.EOFException
at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge$MessageDi spatcher.run(java_remote_bridge.java:176)

com.sun.star.lang.DisposedException: com.sun.star.lang.DisposedException: java.i o.EOFException

Just to clear up this exception only throws when I kill the open office process. Otherwise the program just waits for open office to complete. Indefinitely


The Code (with non functional code tags)

[code]

#ghost script handles these file types   GS_WHITELIST=['.pdf']   #Open Office handles these file types   OO_WHITELIST=['.xls', '.doc', '.rtf', '.tif', '.tiff']    #whitelist is used to check against any unsupported files.   WHITELIST=GS_WHITELIST + OO_WHITELIST    
def _get_service_manager(self):     try:         self._context=Bootstrap.bootstrap();         self._xMultiCompFactory=self._context.getServiceManager()         self._xcomponentloader=UnoRuntime.queryInterface(XComponentLoader, self._xMultiCompFactory.createInstanceWithContext('com.sun.star.frame.Desktop', self._context))     except:         raise OpenOfficeException('Exception Occurred with Open Office')  def _choose_conversion_type(self,fn):     ext=os.path.splitext(fn)[1]     if ext in GS_WHITELIST:         self._ghostscript_convert_to_tiff(fn)     elif ext in OO_WHITELIST:         self._open_office_convert(fn)  def _open_office_convert(self,fn):     self._load_attachment_to_convert(fn)     self._save_as_pdf(fn)     self._ghostscript_convert_to_tiff(fn)  def _load_attachment_to_convert(self, file):     file=self._create_UNO_File_URL(file)     properties=[]     p=PropertyValue()     p.Name='Hidden'     p.Value=True     properties.append(p)     properties=tuple(properties)      self._doc=self._xcomponentloader.loadComponentFromURL(file, '_blank',0, properties) <<<<<<<<<<<<<<< here is line 299  def _create_UNO_File_URL(self, filepath):     try:         file=str('file:///' + filepath)         file=file.replace('\\', '/')     except MalformedURLException, e:         raise e     return file  def _save_as_pdf(self, docSource):     dirName=os.path.dirname(docSource)     baseName=os.path.basename(docSource)     baseName, ext=os.path.splitext(baseName)     dirTmpPdfConverted=os.path.join(dirName + DIR + PDF_TEMP_CONVERT_DIR)     if not os.path.exists(dirTmpPdfConverted):         os.makedirs(dirTmpPdfConverted)     pdfDest=os.path.join(dirTmpPdfConverted + DIR + baseName + '.pdf')     url_save=self._create_UNO_File_URL(pdfDest)     properties=self._create_properties(ext)     try:         try:             self._xstorable=UnoRuntime.queryInterface(XStorable, self._doc);             self._xstorable.storeToURL(url_save, properties)         except AttributeError,e:                 self.logger.info('pdf file already created (' + str(e) + ')')                 raise e     finally:         try:             self._doc.dispose()         except:             raise  def _create_properties(self,ext):     properties=[]     p=PropertyValue()     p.Name='Overwrite'     p.Value=True     properties.append(p)     p=PropertyValue()     p.Name='FilterName'     if   ext=='.doc':         p.Value='writer_pdf_Export'     elif ext=='.rtf':         p.Value='writer_pdf_Export'     elif ext=='.xls':         p.Value='calc_pdf_Export'     elif ext=='.tif':         p.Value='draw_pdf_Export'     elif ext=='.tiff':         p.Value='draw_pdf_Export'     properties.append(p)     return tuple(properties)  def _ghostscript_convert_to_tiff(self, docSource):     dest, source=self._get_dest_and_source_conversion_file(docSource)     try:         command = ' '.join([             self._ghostscriptPath + 'gswin32c.exe',            '-q',            '-dNOPAUSE',            '-dBATCH',            '-r500',            '-sDEVICE=tiffg4',            '-sPAPERSIZE=a4',            '-sOutputFile=%s %s' % (dest, source),            ])         self._execute_ghostscript(command)         self.convertedTifDocList.append(dest)     except OSError, e:         self.logger.info(e)         raise e     except TypeError, (e):         raise e     except AttributeError, (e):         raise e     except:         raise 

[/code]

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T21:38:27+00:00Added an answer on May 10, 2026 at 9:38 pm

    The icky solution is to have a monitor for the OpenOffice process. If your monitor knows the PID and has privileges, it can get CPU time used every few seconds. If OO hangs in a stalled state (no more CPU), then the monitor can kill it.

    The easiest way to handle this is to have the ‘wrapper’ that’s firing off the open office task watch it while it runs and kill it when it hangs. The parent process has to do a wait anyway, so it may as well monitor.

    If OpenOffuce hangs in a loop, then it’s tougher to spot. CPU usually goes through the roof, stays there, and the priority plummets to the lowest possible priority. Processing or hung? Judgement call. You have to let it hang like this for ‘a while’ (pick a random duration, 432 seconds (3 dozen dozen) for instance; you’ll always be second-guessing yourself.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 73k
  • Answers 73k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer So, some important concepts discussed here helped me to solve… May 11, 2026 at 2:10 pm
  • added an answer Try this: var q = from a in db.MyTable group… May 11, 2026 at 2:10 pm
  • added an answer rscbundlecheck does the duplicate key check and more validations suitable… May 11, 2026 at 2:10 pm

Related Questions

well i have this messages table with sample values like these: msg_id recipient_id read
Well I've gotten myself in a pickle I did the subversion 1 click setup
Well I am querying my DB, a table called bookBilling, to get a value
Well I run a small video website and on the actual video page there
Well, I have this bit of code that is slowing down the program hugely
My memory usage increases over time and restarting Django is not kind to users.
I am trying to build a cross-compiler with x86_64 being the host and i386

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.