Today I will show how to use the pstats python module. It’s just some simple example, but can be useful for us.
Let’s add some source code to test this python module.
import os, sys
for i in range(100000):
The documentation tells us: A profiler is a program that describes the run time performance of… Continue Reading Using pstats python module .
Although most of us prefer the python version 2.6, today I tried to install the latest version of Django and Python 2.3.2. Make a new folder, named test-dj.
On the official site, I got the two archives:
I will start with the installation of python. We unzip the… Continue Reading Python 3.2 and Django 1.4 – installation.
Simple python script to start the OpenOffice software. This script starts OpenOffice software. The script uses the following modules:
Now we define the arguments for each software OpenOffice:
NoConnectionException = uno.getClass("com.sun.star.connection.NoConnectException")
ooffice = 'ooffice "-accept=socket,host=localhost,port=8100;urp;"'
oocalc = 'oocalc "-accept=socket,host=localhost,port=8100;urp;"'
ooimpress = 'ooimpress "-accept=socket,host=localhost,port=8100;urp;"'
oowriter = 'oowriter "-accept=socket,host=localhost,port=8100;urp;"'
The next step, we define a function that will start OpenOffice software. See below:
''' start ooo software '''
# using fork
# Start OpenOffice.org and report any errors that
retcode = subprocess.call(soft, shell=True)
if retcode < 0:
print >>sys.stderr,"retcode is ",-retcode
elif retcode > 0:
print >>sys.stderr,"retcode is ",retcode
except OSError, e:
print >>sys.stderr, "Error is :", err
We use a variable to… Continue Reading Python and OpenOffice – Start OpenOffice.
Sometimes it is necessary to resize the images. The PIL module is used for image processing. The glob module takes a wildcard and returns the full path of all files and directories matching the wildcard. Here are two scripts that I made. The first is a simple example using a… Continue Reading How to resize images – python script .
The official site www.python.org says: Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report… Continue Reading Python – simple language scripting.
Start Blender 3D version 2.5 or higher. At the top, choose File from the menu and then User Preferences … or press keys Ctrl+Alt+U. See the picture below: Click the button Install Add-on … A dialog will appear and you can select the script with that addon. In this case… Continue Reading Addons on Blender 2.5 – Installing an addon using Python