FlaskでWEBアプリケーションにチャレンジしています。
formから値を受け取り、送信ボタンを押すとエラーが出ます。
Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/flask/app.py", line 2446, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python3.8/site-packages/flask/app.py", line 1951, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/python3.8/site-packages/flask/app.py", line 1820, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise raise value File "/usr/lib/python3.8/site-packages/flask/app.py", line 1949, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python3.8/site-packages/flask/app.py", line 1935, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/home/ULUNTA/mysite/aggregate_app.py", line 91, in read_csv tx = facade.transaction_factory.create_embedded({ File "/home/ULUNTA/.local/lib/python3.8/site-packages/symbolchain/core/symbol/TransactionFactory.py", line 85, in create_embedded return self._create(transaction_descriptor, sc.EmbeddedTransactionFactory) File "/home/ULUNTA/.local/lib/python3.8/site-packages/symbolchain/core/symbol/TransactionFactory.py", line 53, in _create processor.copy_to(transaction, ['type', 'signer_public_key']) File "/home/ULUNTA/.local/lib/python3.8/site-packages/symbolchain/core/TransactionDescriptorProcessor.py", line 39, in copy_to value = self.lookup_value(key) File "/home/ULUNTA/.local/lib/python3.8/site-packages/symbolchain/core/TransactionDescriptorProcessor.py", line 24, in lookup_value value = self._lookup_value_and_apply_type_hints(key) File "/home/ULUNTA/.local/lib/python3.8/site-packages/symbolchain/core/TransactionDescriptorProcessor.py", line 18, in _lookup_value_and_apply_type_hints value = self.type_parsing_rules[type_hint](value) File "/home/ULUNTA/.local/lib/python3.8/site-packages/symbolchain/core/symbol/ExtendedTypeParsingRules.py", line 44, in parser return list(map(element_rule, values)) File "/home/ULUNTA/.local/lib/python3.8/site-packages/symbolchain/core/symbol/ExtendedTypeParsingRules.py", line 99, in parser struct_processor.copy_to(struct_obj) File "/home/ULUNTA/.local/lib/python3.8/site-packages/symbolchain/core/TransactionDescriptorProcessor.py", line 32, in copy_to for key in self.transaction_descriptor.keys(): AttributeError: 'tuple' object has no attribute 'keys'
ローカル(VScode)ではうまくいったのですが、
pythonanywhereではうまくいきません。
@app.route('/form', methods=['GET', 'POST']) def read_csv(): try: if request.method == 'POST': network = request.form['radio'] #Mainnet MozaicID:0x6BED913FA20223F8 MozaicID16 = int("0x" + request.form['MozaicID'], 16) MozaicID = request.form['MozaicID'] msg0 = request.form.get('msg0') msg = msg0 or "" print(msg) send_data = request.files['send_data'] key = request.form['key'] if send_data and allowed_file(send_data.filename): filename = secure_filename(send_data.filename) send_data.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) nf = pd.read_csv('uploads/' + filename, encoding="UTF-8", sep=",").values.tolist() nf_Q = len(nf) print(nf) #print(network+ MozaicID) if network == "Testnet_XYM" and nf_Q < 101: ### 設定 ##################################################################################################################################################### # 送信元ウォレットの秘密鍵 private_key = key # トランザクション送信に使う手数料(少ないと送金できない) fee_size = 1 # 宛先リスト toList = nf ############################################################################################################################################################# # testnetで実施 facade = SymbolFacade('testnet') # 送信元の設定 Prikey = PrivateKey(unhexlify(private_key)) Keypair = KeyPair(Prikey) Pubkey = Keypair.public_key Address = facade.network.public_key_to_address(Pubkey) #print("send from :", Address) # 受信先の設定 addressTx = [] for to in toList: address = SymbolFacade.Address(to[1]) mosaic_size = to[2] tx = facade.transaction_factory.create_embedded({ 'type': 'transfer', 'signer_public_key': Pubkey, 'recipient_address': address, 'mosaics': [(MozaicID16, int(mosaic_size * 1000000))], 'message': bytes(1) + msg.encode('utf8') }) addressTx.append(tx)
わかる方いれば教えて下さい。

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