accabrown Power User

Joined: 21 Apr 2004 Posts: 75 Location: England
|
Posted: Wed Nov 09, 2005 3:45 am Post subject: small python hint |
|
|
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)
|
|
|