2

すべての部分が文字列であっても、次の python エラーが発生します

    request = str(self.SETUP) + " " + str(self.fileName) + "RTSP/1.0";
TypeError: unsupported operand type(s) for +: 'int' and 'str'

コードのセクション全体:

if requestCode == self.SETUP and self.state == self.INIT:
    threading.Thread(target=self.recvRtspReply).start()
    # Update RTSP sequence number.
    self.rtspSeq = self.rtspSeq + 1

    # Write the RTSP request to be sent.
    request = str(self.SETUP) + " " + str(self.fileName) + "RTSP/1.0"


    # Keep track of the sent request.
    self.requestSent = request
4

1 に答える 1

0

これを試して:

if requestCode == self.SETUP and self.state == self.INIT:
    threading.Thread(target=self.recvRtspReply).start()
    # Update RTSP sequence number.
    self.rtspSeq = int(self.rtspSeq) + 1 

    # Write the RTSP request to be sent.
    rtps_req = "RTSP/1.0"
    request = "%s %s %s" % (str(self.SETUP),str(self.fileName), rtps_req)


    # Keep track of the sent request.
    self.requestSent = request
于 2013-01-17T00:51:28.473 に答える