Bug 462603 - capisuite 0.4.5 error in cs_helper.py sox related
Summary: capisuite 0.4.5 error in cs_helper.py sox related
Status: RESOLVED FIXED
Alias: None
Product: openSUSE 11.1
Classification: openSUSE
Component: ISDN (show other bugs)
Version: Final
Hardware: All openSUSE 11.1
: P3 - Medium : Normal with 5 votes (vote)
Target Milestone: ---
Assignee: Karsten Keil
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-26 19:39 UTC by Bruno Friedmann
Modified: 2012-01-22 19:30 UTC (History)
3 users (show)

See Also:
Found By: Consulting
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bruno Friedmann 2008-12-26 19:39:18 UTC
With new version of sox (& python) there's some messages which lead to an error raised.

error log

Thu Dec 25 16:42:00 2008 CapiSuite 0xbffae698: CapiSuite 0.4.5 started.
Thu Dec 25 16:42:57 2008 Pythonscript /usr/lib/capisuite/incoming.py,callIncoming,0x826d2e8: A python error occured. See traceback below.
Thu Dec 25 16:42:57 2008 Pythonscript 0x826d2e8: Python traceback: Traceback (most recent call last):
Thu Dec 25 16:42:57 2008 Pythonscript 0x826d2e8: Traceback:   File "/usr/lib/capisuite/incoming.py", line 75, in callIncoming
Thu Dec 25 16:42:57 2008 Pythonscript 0x826d2e8: Traceback:     voiceIncoming(call,call_from,call_to,curr_user,config)
Thu Dec 25 16:42:57 2008 Pythonscript 0x826d2e8: Traceback:   File "/usr/lib/capisuite/incoming.py", line 255, in voiceIncoming
Thu Dec 25 16:42:57 2008 Pythonscript 0x826d2e8: Traceback:     +"See attached file.\nThe original file was saved to file://"+filename+"\n\n", filename)
Thu Dec 25 16:42:57 2008 Pythonscript 0x826d2e8: Traceback:   File "/usr/lib/python2.6/site-packages/cs_helpers.py", line 234, in sendMIMEMail
Thu Dec 25 16:42:57 2008 Pythonscript 0x826d2e8: Traceback:     raise "conv-error","Error while calling sox. Not installed?"
Thu Dec 25 16:42:57 2008 Pythonscript 0x826d2e8: Traceback: TypeError: exceptions must be classes or instances, not str
Thu Dec 25 18:35:27 2008 CapiSuite 0xbffae698: CapiSuite finished.



This could be corrected by this line 
the diff patch extract
 
@@ -229,7 +229,8 @@
                elif (mail_type=="la"): # voice file
                        # la -> wav
                        # don't use stdout as sox needs a file to be able to seek in it otherwise the header will be incomplete
-                       ret = os.spawnlp(os.P_WAIT,"sox","sox",attachment,"-w",basename+"wav")
+                       # ret = os.spawnlp(os.P_WAIT,"sox","sox",attachment,"-w",basename+"wav")
+                       ret = os.spawnlp(os.P_WAIT,"sox","sox","-r","8000","-c","1",attachment,basename+"wav")
                        if (ret or not os.access(basename+"wav",os.R_OK)):
                                raise "conv-error","Error while calling sox. Not installed?"
                        filepart = email.MIMEAudio.MIMEAudio(open(basename+"wav").read(),"x-wav",email.Encoders.encode_base64,name=os.path.basename(basename)+"wav")

This only correct the call to sox without any warning or message.
As I can't to much correct python code.
Comment 1 Christian Fertig 2009-01-14 11:17:05 UTC
Additionally, all Text Exceptions should be replaced by Exception classes, as 11.1 ships python 2.6 and this does not accept them anymore. So for the example above:

raise "conv-error","Error while calling sox."

it should be replaced with something like:

raise Exception("conv-error","Error while calling sox.")
Comment 2 Karsten Keil 2009-01-15 15:11:42 UTC
Since I'm not a python expert as well, is this simple change enough, no need to define something else ?
It seems to work:
Thu Jan 15 15:49:36 2009 Pythonscript /usr/lib/capisuite/incoming.py,callIncoming,0x85a8c0: A python error occured. See traceback below.
Thu Jan 15 15:49:36 2009 Pythonscript 0x85a8c0: Python traceback: Traceback (most recent call last):
Thu Jan 15 15:49:36 2009 Pythonscript 0x85a8c0: Traceback:   File "/usr/lib/capisuite/incoming.py", line 75, in callIncoming
Thu Jan 15 15:49:36 2009 Pythonscript 0x85a8c0: Traceback:     voiceIncoming(call,call_from,call_to,curr_user,config)
Thu Jan 15 15:49:36 2009 Pythonscript 0x85a8c0: Traceback:   File "/usr/lib/capisuite/incoming.py", line 255, in voiceIncoming
Thu Jan 15 15:49:36 2009 Pythonscript 0x85a8c0: Traceback:     +"See attached file.\nThe original file was saved to file://"+filename+"\n\n", filename)
Thu Jan 15 15:49:36 2009 Pythonscript 0x85a8c0: Traceback:   File "/usr/lib64/python2.6/site-packages/cs_helpers.py", line 235, in sendMIMEMail
Thu Jan 15 15:49:36 2009 Pythonscript 0x85a8c0: Traceback:     raise Exception("conv-error","Error while calling sox. Not installed?")
Thu Jan 15 15:49:36 2009 Pythonscript 0x85a8c0: Traceback: Exception: ('conv-error', 'Error while calling sox. Not installed?')
Comment 3 Christian Fertig 2009-01-15 15:50:35 UTC
You don't need to define something else. Perhaps it's not a beautiful solution, as a python list ('item','item') is put out, not a pure message.

In the python 2.6.1 docs

http://docs.python.org/c-api/exceptions.html#deprecation-of-string-exceptions

it's written, that these string exceptions would be just depreacted, but still working. This does seem to be right, just the real "exception content" is replaced by their error message "Error: exceptions must be classes or instances, not str". My test program seems to continue after such a catched exception. 

So it's more eyecandy to replace the strings by classes. It's was just the locating of the problem in our real "sox"-bug for me becoming harder.

This is something, that the maintainer of the capisuite should fix, but it seems that there is no one at the moment.

Sorry, that I started a discussion about "another bug" by posting a comment to the sox bug
Comment 4 Karsten Keil 2009-01-15 16:52:44 UTC
In this case it is OK, I'll fix it together, for the next release this avoid problems if python make it really fail. But I think it is not complete, it should not trow a traceback here. I think this code need also a change:

        except "conv-error",errormessage:
                text+="\n\nERROR occured while converting file: "+errormessage+"\nPlease talk to your friendly administrator.\n"
                textpart = email.MIMEText.MIMEText(text)
                msg.attach(textpart)

Reading in the docu comes up with:
        except Exception as (errno, errormessage):
...

Correct ?
Comment 5 Bruno Friedmann 2009-01-15 17:01:12 UTC
What would be great as a fix, is to try it also with phython-3 as this version also come with opensuse 11.1 and would become the standard in near future.
Comment 6 Karsten Keil 2009-01-15 17:10:32 UTC
Hmm I do not see python-3 on 11.1, which packages ?
Comment 7 Bruno Friedmann 2009-01-15 19:36:26 UTC
zypper se ( or yast2 sw_single -> search ) python3 

And you would get them 
 | python3                           | Python3 Interpreter                                                                   | package
  | python3-2to3                      | Python 3.0 conversion tool                                                            | package
  | python3-curses                    | Python Interface to the (N)Curses Library                                             | package
  | python3-dbm                       | Python Interface to the GDBM Library                                                  | package
  | python3-demo                      | Python Demonstration Scripts                                                          | package
  | python3-devel                     | Include Files and Libraries Mandatory for Building Python Modules                     | package
  | python3-doc                       | Additional Package Documentation for Python.                                          | package
  | python3-doc-pdf                   | Python PDF Documentation                                                              | package
  | python3-idle                      | An Integrated Development Environment for Python                                      | package
  | python3-tk                        | TkInter - Python Tk Interface                                                         | package
  | python3-xml                       | A Python XML Interface
Comment 8 Karsten Keil 2009-01-15 22:55:19 UTC
I thought that I searched for python3 and python-3, but maybe on the wrong installation. 
So to test this I think I need to build capisuite with python3-devel, but this gives an error on detecting the version:


Python 3.0b3 (r30b3:65927, Dec  3 2008, 13:14:01)
[GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys; print sys.version[:3]
  File "<stdin>", line 1
    import sys; print sys.version[:3]
                        ^
SyntaxError: invalid syntax
Comment 9 Karsten Keil 2009-01-16 07:07:23 UTC
OK this part was easy: import sys; print(sys.version[:3]) but also then the environment is not really ready for python3, autoconf will not find an interpreter with AM_PATH_PYTHON(3.0) so configure fail.
I think this is now too much for this report, the problem is fixed and python3 has to wait.
Comment 11 Bruno Friedmann 2009-01-16 08:13:55 UTC
The python3 was just an enhancement in case of .
I couldn't evaluate how large would be the modification.

If you have success with 2.6.
You could close this bug when the updated package is published.

Thanks a lot. As I think many european using isdn telephony & fax would be happy to see this package continue to work.
Comment 13 Karsten Keil 2009-03-01 09:53:07 UTC
This need a maintenance update.
Comment 14 Anja Stock 2009-03-02 13:23:33 UTC
If this needs a maintenance update, please do not assign, but needinfo ast@novell.com
Comment 16 Bruno Friedmann 2009-09-21 13:30:56 UTC
Anja, we are at less than 8 weeks from 11.2 release, why this bug is always in state open / assign ? 

Should you need something more to have this working in 11.2 ?
Comment 17 Christian Dengler 2009-09-22 08:53:24 UTC
> Anja, we are at less than 8 weeks from 11.2 release, why this bug is always in
> state open / assign ? 

I should be fixed by the maintainer in Factory. Then he can close the bug.

> Should you need something more to have this working in 11.2 ?

No. You only have to submit the fix to Factory. No SwampID is needed here.
Comment 18 Bruno Friedmann 2012-01-22 19:30:47 UTC
This has been solved by related updates 
Confirmed to work with 11.3,11.4,12.1