mk-toolブログ

エンジニアと家のことをごちゃごちゃと書いてます

2018-06-06から1日間の記事一覧

【Python】TypeError: Unicode-objects must be encoded before hashing

概要 以下のエラーが出たためメモ。 TypeError: Unicode-objects must be encoded before hashing 解決策 文字列の末尾に.encode('utf-8')を追記する。

【Python】AttributeError: 'UUID' object has no attribute 'get_hex'

概要 以下のエラーが発生したためメモ。 AttributeError: 'UUID' object has no attribute 'get_hex' 解決法 get_hexをhexにする。 - key = self.prefix + uuid.uuid4().get_hex() + key = self.prefix + uuid.uuid4().hex

【Python】MySQLdb must be installed on the system

概要 以下のエラーが出たためメモ。 MySQLdb must be installed on the system 解決策 PyMySQLをinstallする。 pip3 install PyMySQL // もしくは pip install PyMySQL

【Python】throwされたErrorのメッセージをconsoleに表示

概要 Errorメッセージをconsoleに表示して何がおきているか確認する。 解決方法 for model in models: try: // 処理 print("success); except Exception as e: print("message : %s" % e) pass

【Python】AttributeError: 'dict' object has no attribute 'iteritems'

概要 以下のエラーが出たので対応。 AttributeError: 'dict' object has no attribute 'iteritems' 解決策 iteritems()からitems()にする。