OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

small python hint

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
accabrown
Power User
Power User


Joined: 21 Apr 2004
Posts: 75
Location: England

PostPosted: Wed Nov 09, 2005 3:45 am    Post subject: small python hint Reply with quote

I have just discovered the delights of Ipython, and want to urge them on ayone who plays with Python to script OOo. It's not a complete IDE (I could never get IDLE to work with OOo Python) but a superb command line processor, with which you can work out scripts interactively, and then save slices from the history list into a file as programs. An introduction is here, thogh there is very good documentation.

After it has been installed, there are two tricks needed to make it work wth OOo.
    You must point the %PYTHONSTARTUP% variable to a file which will start up Ipython as the default shell
    In the ipythonrc.ini file, add uno and unohelper to the import_mod line


So the last lines of my python.bat are
Code:

set PYTHONHOME=%MYROOT%python-core-2.3.4
set PYTHONSTARTUP=%MYROOT%\addpaths.py
"%MYROOT%python-core-2.3.4\bin\python.exe" %*

and addpaths.py (silly name) just says
Code:

import IPython 
IPython.Shell.IPShell().mainloop(sys_exit=1)
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group