Error Handling in Python with SUDS

前端 未结 4 974
误落风尘
误落风尘 2020-12-15 22:21

I have been trying to control a camera through a wsdl file using SUDS. I have got the code working but I want to place error handling into the script. I have tried different

相关标签:
4条回答
  • 2020-12-15 23:16

    If you want to catch that exception you should put

    try:
        result = client.service.AbsoluteMove(token, dest, speed)
    except suds.WebFault as detail:
        ...
    
    0 讨论(0)
  • 2020-12-15 23:18

    You need to catch suds.WebFault by the looks of that traceback. The error itself seems legitimate, IE, your requests are being executed correctly, but perhaps your parameters are wrong in the given context.

    0 讨论(0)
  • 2020-12-15 23:21

    I believe you refer to a harmless diagnostic message in your comment. I could suppress messages from suds calling logging.error() by assigning logging.INFO to basicConfig and logging.CRITICAL to suds.client.

    https://fedorahosted.org/suds/wiki/Documentation

    0 讨论(0)
  • 2020-12-15 23:22

    If you handled all exceptions and errors in your code and your code is working fine but still you are getting below message with your correct output.

    Msg : "No handlers could be found for logger suds.client "

    Then a simple solution is to add this line

    logging.getLogger('suds.client').setLevel(logging.CRITICAL)
    

    in yourclient.py file just after all import statement.

    0 讨论(0)
提交回复
热议问题