LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-26-2010, 12:44 PM   #1
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
uniconv 0.4 problem (python debugging?)


Hello

Running the uniconv 0.4 python script for the first time, on an OOo-generated test .doc (with a single line of text):
Code:
c@CW8:~/d/tmp$ unoconv --stdout -f text Test.doc
Traceback (most recent call last):
  File "/usr/bin/unoconv", line 67, in <module>
    os.environ['LD_LIBRARY_PATH'] = oolibpath + os.pathsep + os.environ['LD_LIBRARY_PATH']
  File "/usr/lib64/python2.6/UserDict.py", line 22, in __getitem__
    raise KeyError(key)
KeyError: 'LD_LIBRARY_PATH'
The problem is probably in the environment, possible a python version mismatch ... but I don't have enough python to know where to begin.

Here's what looks like the relevant part of /usr/bin/unoconv:
Code:
 53 try:
 54     import uno, unohelper
 55 except ImportError:
 56     for oolibpath in extrapaths:
 57         if os.path.exists(os.path.join(oolibpath, "pyuno.so")):
 58             filename = "pyuno.so"
 59         elif os.path.exists(os.path.join(oolibpath, "pyuno.pyd")):
 60             filename = "pyuno.pyd"
 61         else:
 62             continue
 63         try:
 64             sys.path.append(oolibpath)
 65             import uno, unohelper
 66             ### Export an environment that OpenOffice is pleased to work with
 67             os.environ['LD_LIBRARY_PATH'] = oolibpath + os.pathsep + os.environ['LD_LIBRARY_PATH']
 68             break
$LD_LIBRARY_PATH is not set in the calling shell ... ?

Here's /usr/lib64/python2.6/UserDict.py, up to line 22:
Code:
  1 """A more or less complete user-defined wrapper around dictionary objects."""
  2 
  3 class UserDict:
  4     def __init__(self, dict=None, **kwargs):
  5         self.data = {}
  6         if dict is not None:
  7             self.update(dict)
  8         if len(kwargs):
  9             self.update(kwargs)
 10     def __repr__(self): return repr(self.data)
 11     def __cmp__(self, dict):
 12         if isinstance(dict, UserDict):
 13             return cmp(self.data, dict.data)
 14         else:
 15             return cmp(self.data, dict)
 16     def __len__(self): return len(self.data)
 17     def __getitem__(self, key):
 18         if key in self.data:
 19             return self.data[key]
 20         if hasattr(self.__class__, "__missing__"):
 21             return self.__class__.__missing__(self, key)
 22         raise KeyError(key)
In case more code is needed, uniconv 0.4 is online for a month at http://pastebin.com/9tuNeijQ or it can be installed amazingly easily (yay for python!) along with its man page from http://dag.wieers.com/home-made/unoc...nv-0.4.tar.bz2:
Code:
root@CW8:~# cp /home/c/d/Repository/src/unoconv-0.4.tar.bz2 /tmp \
  && cd /tmp \
  && tar -xvf  unoconv-0.4.tar.bz2 \
  && cd unoconv-0.4 \
  && make \
  && make install
[snip]
install -Dp -m0755 unoconv /usr/bin/unoconv
install -Dp -m0644 docs/unoconv.1 /usr/share/man/man1/unoconv.1
Best

Charles
 
Old 12-27-2010, 06:06 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578

Original Poster
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Fixed by patch from Novell bugzilla.

EDIT but now failing with
Code:
c@CW8:~/d/tmp$ soffice -headless -accept='socket,host=127.0.0.1,port=2002;urp;'
c@CW8:~/d/tmp$ unoconv --stdout -f text Test.doc
Traceback (most recent call last):
  File "/usr/bin/unoconv", line 796, in <module>
    main()
  File "/usr/bin/unoconv", line 775, in main
    convertor.convert(inputfn)
  File "/usr/bin/unoconv", line 608, in convert
    doc = self.desktop.loadComponentFromURL( inputurl , "_blank", 0, inputprops )
AttributeError: loadComponentFromURL
That is a known issue for OOO 3.0.0 (I am using 3.2.1) which is still open (http://www.openoffice.org/issues/show_bug.cgi?id=90701) with fix most comprehensibly given at http://piiis.blogspot.com/2008_10_01_archive.html. Tried but did not fix. Maybe switch to PyODConverter (Python OpenDocument Converter)?

Last edited by catkin; 12-27-2010 at 06:37 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Debugging python application binding with C++ libraries mohabic Linux - Software 0 12-11-2009 08:54 AM
[SOLVED] Effective debugging or improving ones debugging skills Ajit Gunge Programming 3 05-22-2009 09:29 AM
Difference between kernel - debugging and application debugging topworld Linux - Software 2 03-30-2006 12:50 AM
python problem - compiled from source - python -V still showing old version txm123 Linux - Newbie 1 02-15-2006 11:05 AM
Visual Debugging and Linux Kernel Debugging Igor007 Programming 0 09-30-2005 10:33 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration