First, let me say I'm not subscribed to the list. Please CC me in your
replies.
I'm the maintainer for imgsizer,
http://packages.debian.org/unstable/web/imgsizer.html
which used to be a perl script and is
now a python script. I don't know python. The scripts loads "cmp.py"
which is either:
/usr/lib/python1.5/cmp.py
/usr/lib/python2.1/lib-old/cmp.py
The lib-old directory is _not_ in the load path for python2.1, so I've
modified it to run with python1.5 only. How would I modify the script
to work with any version of python?
The package currently depends on python1.5. What should it depend on
when fixed?
Thanks,
Peter
--
To UNSUBSCRIBE, email to debian-pyt...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
The cmp module has been replace by filecmp. One (untested) way of fixing
it would be to change the line:
import sys, os, getopt, cmp, string, re, urllib, commands
to
import sys, os, getopt, string, re, urllib, commands
if sys.version > '1.6':
import filecmp as cmp
else:
import cmp
] The package currently depends on python1.5. What should it depend on
] when fixed?
python
Regards,
Kim Oldfield
I'd prefer to write this as
try :
import filecmp as cmp
except ImportError :
import cmp
It is more pythonic to just try to do what it is you want, and handle
the situation when it fails, than it is do try and figure out what is
write and do only that which works.
| ] The package currently depends on python1.5. What should it depend on
| ] when fixed?
|
| python
This must be versioned though.
python >= (2.1) , python << (2.2)
will get you the current default version.
-D
--
All a man's ways seem innocent to him,
but motives are weighed by the Lord.
Proverbs 16:2
Except that in this case, versions of python before 2.0 will give a
SyntaxError, because "import spam as eggs" is a new feature as of 2.0.
To be backwards compatible, use:
try:
import filecmp
cmp = filecmp
del filecmp
except ImportError:
import cmp
-Andrew.