Hello,
With today's SVN revision (1366), I get a traceback on incoming calls
for the filename used in play_wav_file is a unicode string. It breaks
deep down in std module wave when Wave_read.__init__ tries to figure
out if the file passed in argument is a string or a file object. It
tests for type(fp) == type('') but since fp is a unicode string, this
piece of code thinks that if it is not a string, it must be an open
file.
A simple fix follows:
[shtoom]$ svn diff
Index: shtoom/app/phone.py
===================================================================
--- shtoom/app/phone.py (revision 1366)
+++ shtoom/app/phone.py (working copy)
@@ -58,7 +58,7 @@
def play_wav_file(self, soundconfigurename):
fname = self.getPref(soundconfigurename)
if fname:
- fullfname = self.find_resource_file(fname)
+ fullfname = str(self.find_resource_file(fname))
self._audio.play_wave_file(fullfname)
def needsThreadedUI(self):
Index: shtoom/audio/aufile.py
===================================================================
--- shtoom/audio/aufile.py (revision 1366)
+++ shtoom/audio/aufile.py (working copy)
@@ -1,4 +1,4 @@
-import wave, sunau, aifc, sndhdr
+import wave, sunau, aifc, sndhdr, types
from audioop import tomono, lin2lin, ulaw2lin, ratecv
import struct
@@ -12,6 +12,7 @@
_freqCvt = { 8000: 160, 16000: 320, 32000: 640, 64000: 1280 }
def __init__(self, fp):
+ assert type(fp) is types.StringType, '%s is not of
StringType' % type(fp)
self.fp = self.module.open(fp, 'rb')
p = self.fp.getparams()
print p
[shtoom]$
--
Adrien Di Mascio
LOGILAB, Paris (France).
http://www.logilab.com http://www.logilab.fr http://www.logilab.org
signature.asc
Description: Digital signature
_______________________________________________ Shtoom mailing list [email protected] http://mail.python.org/mailman/listinfo/shtoom
