[SciPy-dev] Patches for sandbox/montecarlo and pilutil.py
Marco Presi
zufus@zufus....
Wed Feb 21 19:57:14 CST 2007
Hi,
I am attaching here a couple of patches I applied to scipy distributed
with Debian.
The first one fixes a syntax error in
sandbox/motecarlo/test_dictsampler.py
The second one replaces the hard-coded image-viewer "xv" with the
command "see" (provided by mime-support); it ensures that a valid image
viewer is always called, even if xv is not installed [1].
Regards,
Marco
[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=395198
Patches:
--------
--- Lib/sandbox/montecarlo/tests/test_dictsampler.py.orig 2007-02-22
01:29:56.000000000 +0000
+++ Lib/sandbox/montecarlo/tests/test_dictsampler.py 2007-02-22
01:30:59.000000000 +0000
@@ -37,7 +37,7 @@
#import pdb
#pdb.set_trace()
s = sampler.sample(n)
- assert sum(s[i]=='b' for i in range(n),axis=0)*1./n > 0.75
+ assert sum((s[i]=='b' for i in range(n)),axis=0)*1./n > 0.75
#lam = 10.0
#n = 35
--- Lib/misc/pilutil.py.orig 2006-08-29 08:56:12.000000000 +0100
+++ Lib/misc/pilutil.py 2007-02-18 20:36:39.000000000 +0000
@@ -230,7 +230,10 @@
try:
import os
im.save('/tmp/scipy_imshow.png')
- if os.system("(xv /tmp/scipy_imshow.png; rm
-f /tmp/scipy_imshow.png)&"):
+ cmd = "see"
+ if os.environ.has_key ("SCIPY_PIL_IMAGE_VIEWER"):
+ cmd = os.environ.get ("SCIPY_PIL_IMAGE_VIEWER")
+ if os.system("(" + cmd + " /tmp/scipy_imshow.png; rm
-f /tmp/scipy_imshow.png)&"):
raise RuntimeError
return
except:
More information about the Scipy-dev
mailing list