Re: [Tutor] Import error in UNO
On Feb 6, 2008, at 5:23 AM, muhamed niyas wrote: I can import when i moved to the uno location. pls see the messages in the terminal. C:\>cd "Program Files\OpenOffice.org 2.0\program"\ C:\Program Files\OpenOffice.org 2.0\program>python Python 2.3.4 (#53, Feb 2 2006, 01:06:22) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import uno >>> Given this and the behavior before where the import uno did not return to the prompt, it sounds like the dependencies the uno module has on the OpenOffice libraries. When OpenOffice is in the current path, uno seems to be able to find them. If you look at the windows documentation for uno: http://udk.openoffice.org/python/python-bridge.html even the hello world examples have you switch to the Open Office program directory. Later on in the documentation, it explains this (pay close attention the third paragraph below): "Unlike the Java or C++ UNO binding, the python UNO binding is not self contained. It requires the C++ UNO binding and additional scripting components. These additional components currently live in the shared libraries typeconverter.uno, invocation.uno, corereflection.uno, introspection.uno, invocadapt.uno, proxyfac.uno, pythonloader.uno (on windows typeconverter.uno.dll,...; unix typeconverter.uno.so,...). Often, the components for setting up an interprocess connection are also required. These are uuresolver.uno, connector.uno, remotebridge.uno, bridgefac.uno shared libraries. The path environment variables ( LD_LIBRARY_PATH on Unix, PATH on Windows) must point to a directory, where the core UNO libraries, the above listed components and the pyuno shared library is located. (On Unix, there exists two files: libpyuno.so containing the code and a pyuno.so which is needed for importing a native python module). Additionally, the python module uno.py, unohelper.py and pythonloader.py must be located in a directory, which is listed in the PYTHONPATH environment variable. " -- Sincerely, Chris Calloway http://www.seacoos.org office: 332 Chapman Hall cell: (919) 599-3530 mail: Campus Box #3300, UNC-CH, Chapel Hill, NC 27599 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Import error in UNO
"muhamed niyas" <[EMAIL PROTECTED]> wrote >I can import when i moved to the uno location. > pls see the messages in the terminal. > > > C:\>cd "Program Files\OpenOffice.org 2.0\program"\ > C:\Program Files\OpenOffice.org 2.0\program>python > Python 2.3.4 (#53, Feb 2 2006, 01:06:22) [MSC v.1310 32 bit > (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more > information. import uno Ok, Odd. Lets just check its finding the PYTHONPATH setting OK. Exit Python, start a new cmd window and restart python. Now import sys and print sys.path Does your PYTHONPATH folder show up in the list? If so the only other things I can think of are 1) Create a simple Python module in the same folder as uno and try importing that to see if you definitely can find it and prove the folder permissions aren't the issue. 2) Check that there are no modules called uno in any other of the sys.path folders that are masking the OOo one. After that I'm kind of stumped. Alan G ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Import error in UNO
I can import when i moved to the uno location. pls see the messages in the terminal. C:\>cd "Program Files\OpenOffice.org 2.0\program"\ C:\Program Files\OpenOffice.org 2.0\program>python Python 2.3.4 (#53, Feb 2 2006, 01:06:22) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import uno >>> On Feb 6, 2008 3:42 PM, Alan Gauld <[EMAIL PROTECTED]> wrote: > "muhamed niyas" <[EMAIL PROTECTED]> wrote > > import uno > > > > I am not getting the promt >>> after importing that. > > OK, That suggests a problem in the uno module itself. > > Yet ISTR you said you could import if you changed to > the directory and ran Python there? > > Can you try that again just to confirm > > CD to the OOo folder that contains uno and startt python > and try the import again. > > Alan G. > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > -- Thanks & Best Regards, Muhamed Niyas C (GM, Core Solutions India) Mobile: +91 9447 468825 URL: www.coresolutionsindia.com Email: [EMAIL PROTECTED] ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Import error in UNO
"muhamed niyas" <[EMAIL PROTECTED]> wrote import uno > > I am not getting the promt >>> after importing that. OK, That suggests a problem in the uno module itself. Yet ISTR you said you could import if you changed to the directory and ran Python there? Can you try that again just to confirm CD to the OOo folder that contains uno and startt python and try the import again. Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Import error in UNO
When i import >>>import uno I am not getting the promt >>> after importing that. On Feb 6, 2008 2:29 PM, Alan Gauld <[EMAIL PROTECTED]> wrote: > > "muhamed niyas" <[EMAIL PROTECTED]> wrote > > > Thanks for your kind response. I tried to include the path > > 'C:\Program > > Files\OpenOffice.org 2.0\program' in PYTHONPATH. but now i didnt get > > any error message but its hanging while importing. Pls advice me to > > correct > > this. > > > > What happens if you start an interactive Python sesssion and > try 'import uno' at the >>> prompt. Does that work? > > Alan G. > > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > -- Thanks & Best Regards, Muhamed Niyas C (GM, Core Solutions India) Mobile: +91 9447 468825 URL: www.coresolutionsindia.com Email: [EMAIL PROTECTED] ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Import error in UNO
"muhamed niyas" <[EMAIL PROTECTED]> wrote > Thanks for your kind response. I tried to include the path > 'C:\Program > Files\OpenOffice.org 2.0\program' in PYTHONPATH. but now i didnt get > any error message but its hanging while importing. Pls advice me to > correct > this. > What happens if you start an interactive Python sesssion and try 'import uno' at the >>> prompt. Does that work? Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Import error in UNO
Thanks for your kind response. I tried to include the path 'C:\Program Files\OpenOffice.org 2.0\program' in PYTHONPATH. but now i didnt get any error message but its hanging while importing. Pls advice me to correct this. On Feb 6, 2008 3:54 AM, Tiger12506 <[EMAIL PROTECTED]> wrote: > > "muhamed niyas" <[EMAIL PROTECTED]> wrote > > > >> Also i set 'C:\Program Files\OpenOffice.org 2.0\program' in PATH > >> evvironment > >> variable. > > > > Close but not quite. > > You need to set the module folder in your PYTHONPATH environment > > variable. > > > > PATH is where the python interpreter lives > > PYTHONPATH is where your modules live > > For a less intrusive approach you can > import sys > sys.path.append("path of containing folder here") > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > -- Thanks & Best Regards, Muhamed Niyas C (GM, Core Solutions India) Mobile: +91 9447 468825 URL: www.coresolutionsindia.com Email: [EMAIL PROTECTED] ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Import error in UNO
> "muhamed niyas" <[EMAIL PROTECTED]> wrote > >> Also i set 'C:\Program Files\OpenOffice.org 2.0\program' in PATH >> evvironment >> variable. > > Close but not quite. > You need to set the module folder in your PYTHONPATH environment > variable. > > PATH is where the python interpreter lives > PYTHONPATH is where your modules live For a less intrusive approach you can import sys sys.path.append("path of containing folder here") ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Import error in UNO
"muhamed niyas" <[EMAIL PROTECTED]> wrote > Also i set 'C:\Program Files\OpenOffice.org 2.0\program' in PATH > evvironment > variable. Close but not quite. You need to set the module folder in your PYTHONPATH environment variable. PATH is where the python interpreter lives PYTHONPATH is where your modules live -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Import error in UNO
muhamed niyas wrote: > Also i set 'C:\Program Files\OpenOffice.org 2.0\program' in PATH evvironment > variable. PYTHONPATH is the environment variable you need, it is one way to tell the interpreter where to look for imports. Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor