I wrote a small python script to create a file and calculate the time. I tested it on Fedora 10 and Ubuntu 8.x and it worked well. python versions were 2.5.x.
I tried to run it on my production server (old red hat-based server), the python version is 2.2.3. The script does not work and causes a syntax error in the class definition.
The script defines a class with methods for creating files on disk, measuring time to evaluate the speed of writing to disk. It starts as follows:
class TestDiskSpeed():
def __init__(self, rounds=1, speedMode=SPEED_MODE_MEGABYTE):
class definition is indicated as an error using python 2.2.3.
What are the major changes in python since version 2.2.3 that could lead to my application crashing? I use these modules: os, sys, time, stat, gc.
Update:
removing ()from the class definition, python accepted the class. but another error occurs on this line:
size = long(size) if size != None else self._size
I am a PHP developer, I just introduced Python programming (maybe a month) and am very used to the triple operation that is performed in PHP as follows:
$var = (condition) ? $valueIfTrue : $valueIfFalse;
I searched and found that this is done in python, like the one I used for my variable size. although it seems like he doesn't like python 2.2.3.
I was going to paste all the code here (I will still issue the script as LGPL), but the code is over 150 lines (still under development).