###AttributeError: 'str' object has no attribute 'hex'というエラーメッセージが出てどのように解決すればいいのかわかりません。どこかコードが間違っているのでしょうか。
この問題にハマりなかなか解決出来ません。回答宜しくお願い致します。
Pythonのバージョンは2.7.12を使用しています。
初歩的な質問ですみません。
###エラーメッセージ
Traceback (most recent call last): File "http://echobot.py ", line 4, in <module> line = LINE('email', 'pass') File "/usr/local/lib/python2.7/dist-packages/linepy/client.py", line 18, in __init__ self.loginWithCredential(_id=idOrAuthToken, passwd=passwd, certificate=certificate, systemName=systemName, appName=appName, keepLoggedIn=keepLoggedIn) File "/usr/local/lib/python2.7/dist-packages/linepy/auth.py", line 79, in loginWithCredential crypto = rsa.encrypt(message, pub_key).hex() AttributeError: 'str' object has no attribute 'hex'
###ソースコード
python
1# -*- coding: utf-8 -*- 2from linepy import * 3 4line = LINE('email', 'pass') 5#line = LINE('AUTHTOKEN') 6 7line.log("Auth Token : " + str(line.authToken)) 8 9# Initialize OEPoll with LINE instance 10oepoll = OEPoll(line) 11 12# Receive messages from OEPoll 13def RECEIVE_MESSAGE(op): 14 msg = op.message 15 16 text = msg.text 17 msg_id = http://msg.id 18 receiver = http://msg.to 19 sender = msg._from 20 21 # Check content only text message 22 if msg.contentType == 0: 23 # Check only group chat 24 if msg.toType == 2: 25 # Get sender contact 26 contact = line.getContact(sender) 27 txt = '[%s] %s' % (contact.displayName, text) 28 # Send a message 29 line.sendMessage(receiver, txt) 30 # Print log 31 line.log(txt) 32 33# Add function to OEPoll 34oepoll.addOpInterruptWithDict({ 35 OpType.RECEIVE_MESSAGE: RECEIVE_MESSAGE 36}) 37 38while True: 39 oepoll.trace()

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。