getting a frustrating issue when running 'status services' against a running localstack, which appears to have started without error.
Most of the awslocal commands I attempt to run against localstack seem to work ok, so I am confused as to why 'localstack status services' fails
Error is below:
$ localstack status services
Traceback (most recent call last):
File "/usr/local/Cellar/localstack/1.3.1/libexec/lib/python3.11/site-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python#3.11/3.11.1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python#3.11/3.11.1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python#3.11/3.11.1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/localstack", line 23, in <module>
main()
File "/usr/local/bin/localstack", line 19, in main
main.main()
File "/usr/local/Cellar/localstack/1.3.1/libexec/lib/python3.11/site-packages/localstack/cli/main.py", line 11, in main
cli()
File "/usr/local/Cellar/localstack/1.3.1/libexec/lib/python3.11/site-packages/localstack/cli/plugin.py", line 15, in __call__
self.group(*args, **kwargs)
File "/usr/local/Cellar/localstack/1.3.1/libexec/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/localstack/1.3.1/libexec/lib/python3.11/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/localstack/1.3.1/libexec/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/localstack/1.3.1/libexec/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/localstack/1.3.1/libexec/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/localstack/1.3.1/libexec/lib/python3.11/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/localstack/1.3.1/libexec/lib/python3.11/site-packages/localstack/cli/localstack.py", line 94, in cmd_status_services
doc = health.json()
^^^^^^^^^^^^^
File "/usr/local/Cellar/localstack/1.3.1/libexec/lib/python3.11/site-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Hoping somebody has seen this before!
Edited this to reply to #thrau as the comment is too long...
$ curl localhost:4566/health
{"services": {"apigateway": "running", "cloudformation": "running", "cloudwatch": "running", "dynamodb": "running", "dynamodbstreams": "running", "ec2": "running", "es": "running", "firehose": "running", "iam": "running", "sts": "running", "kinesis": "running", "kms": "running", "lambda": "running", "logs": "running", "redshift": "running", "route53": "running", "s3": "running", "secretsmanager": "running", "ses": "running", "sns": "running", "sqs": "running", "ssm": "running", "events": "running", "stepfunctions": "running", "swf": "running", "resourcegroupstaggingapi": "running", "resource-groups": "running", "support": "running", "acm": "running"}, "features": {"persistence": "disabled", "initScripts": "initialized"}}
Related
I am trying to upload a video to YouTube using the upload_video method, but I am encountering a TypeError that says 'Object of type function is not JSON serializable.
Here is the code I am using:
def upload_video(title,description,tags,upload_year,uplaod_month,upload_day):
upload_date_time = datetime.datetime(upload_year,uplaod_month,upload_day, 8, 00, 0).isoformat() + 'Z'
print(f"this is a upload time {upload_date_time}")
request_body = {
'snippet': {
'categoryI': 19,
'title': title,
'description': description,
'tags': tags
},
'status': {
'privacyStatus': 'private',
'publishAt': upload_date_time,
'selfDeclaredMadeForKids': False,
},
'notifySubscribers': False
}
mediaFile = MediaFileUpload('output.MP4')
response_upload = service.videos().insert(
part='snippet,status',
body=request_body,
media_body=mediaFile
).execute()
This is the error message I am receiving:
Traceback (most recent call last): File "c:\Users\Lukas\Dokumenty\python_scripts\Billionare livestyle\main.py", line 216, in <module>
upload_video(title,"#Shorts", ["motivation", "business", "luxury", "entrepreneurship", "success", "lifestyle", "inspiration", "wealth", "financial freedom", "investing", "mindset", "personal development", "self-improvement", "goals", "hustle", "ambition", "rich life", "luxury lifestyle", "luxury brand", "luxury travel", "luxury cars"],year,month,day) File "c:\Users\Lukas\Dokumenty\python_scripts\Billionare livestyle\main.py", line 93, in upload_video
response_upload = service.videos().insert( File "C:\Users\Lukas\Dokumenty\python_scripts\Billionare livestyle\env\youtube\lib\site-packages\googleapiclient\discovery.py", line 1100, in method
headers, params, query, body = model.request( File "C:\Users\Lukas\Dokumenty\python_scripts\Billionare livestyle\env\youtube\lib\site-packages\googleapiclient\model.py", line 160, in request
body_value = self.serialize(body_value) File "C:\Users\Lukas\Dokumenty\python_scripts\Billionare livestyle\env\youtube\lib\site-packages\googleapiclient\model.py", line 273, in serialize
return json.dumps(body_value) File "C:\Users\Lukas\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 231, in dumps
return _default_encoder.encode(obj) File "C:\Users\Lukas\AppData\Local\Programs\Python\Python310\lib\json\encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True) File "C:\Users\Lukas\AppData\Local\Programs\Python\Python310\lib\json\encoder.py", line 257, in iterencode
return _iterencode(o, 0) File "C:\Users\Lukas\AppData\Local\Programs\Python\Python310\lib\json\encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} ' TypeError: Object of type function is not JSON serializable
I'm running the following code with web3.py:
transaction = SimpleStorage.constructor().buildTransaction(
{"chainId": chain_id, "from": my_address, "nonce": nonce}
)
And I am running into the following error:
Traceback (most recent call last):
File "/Users/patrick/code/web3_py_simple_storage/deploy.py", line 64, in <module>
transaction = SimpleStorage.constructor().buildTransaction(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/eth_utils/decorators.py", line 18, in _wrapper
return self.method(obj, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/web3/contract.py", line 684, in buildTransaction
return fill_transaction_defaults(self.web3, built_transaction)
File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/web3/_utils/transactions.py", line 121, in fill_transaction_defaults
default_val = default_getter(web3, transaction)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/web3/_utils/transactions.py", line 71, in <lambda>
web3.eth.max_priority_fee + (2 * web3.eth.get_block('latest')['baseFeePerGas'])
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/web3/eth.py", line 549, in max_priority_fee
return self._max_priority_fee()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/web3/module.py", line 57, in caller
result = w3.manager.request_blocking(method_str,
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/web3/manager.py", line 198, in request_blocking
return self.formatted_response(response,
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/web3/manager.py", line 171, in formatted_response
raise ValueError(response["error"])
ValueError: {'message': 'Method eth_maxPriorityFeePerGas not supported.', 'code': -32000, 'data': {'stack': 'Error: Method eth_maxPriorityFeePerGas not supported.\n at GethApiDouble.handleRequest (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/subproviders/geth_api_double.js:70:16)\n at next (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/node_modules/web3-provider-engine/index.js:136:18)\n at GethDefaults.handleRequest (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/subproviders/gethdefaults.js:15:12)\n at next (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/node_modules/web3-provider-engine/index.js:136:18)\n at SubscriptionSubprovider.FilterSubprovider.handleRequest (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/node_modules/web3-provider-engine/subproviders/filters.js:89:7)\n at SubscriptionSubprovider.handleRequest (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/node_modules/web3-provider-engine/subproviders/subscriptions.js:137:49)\n at next (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/node_modules/web3-provider-engine/index.js:136:18)\n at DelayedBlockFilter.handleRequest (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/subproviders/delayedblockfilter.js:31:3)\n at next (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/node_modules/web3-provider-engine/index.js:136:18)\n at RequestFunnel.handleRequest (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/subproviders/requestfunnel.js:32:12)\n at next (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/node_modules/web3-provider-engine/index.js:136:18)\n at Web3ProviderEngine._handleAsync (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/node_modules/web3-provider-engine/index.js:123:3)\n at Timeout._onTimeout (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/node_modules/web3-provider-engine/index.js:107:12)\n at listOnTimeout (internal/timers.js:531:17)\n at processTimers (internal/timers.js:475:7)', 'name': 'Error'}}
How do I fix this?
This is an issue from a new edition of web3.py.
You need to add gasPrice to your transaction, like so:
transaction = SimpleStorage.constructor().buildTransaction(
{"chainId": chain_id, "gasPrice": w3.eth.gas_price, "from": my_address, "nonce": nonce}
)
This is due to EIP1559 changing, and web3.py updating for the change.
I am going through the freeCodeCamp course on YouTube and have caught an error regarding when I run. As I am trying to build a transaction into Ganache. I see in Ganache logs that there is activity as well. First time posting, so let me know what other information should I provide!
The course: Solidity, Blockchain, and Smart Contract Course – Beginner to Expert Python Tutorial
transaction = SimpleStorage.constructor().buildTransaction(
{"chainId": chain_id, "from": my_address, "nonce": nonce}
)
The error that the terminal returns:
Traceback (most recent call last):
File "C:\Users\Justin\demos\web3_py_simple_storage\deploy.py",
line 60, in <module>
transaction = SimpleStorage.constructor().buildTransaction(
File "C:\Users\Justin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\eth_utils\decorators.py", line 18, in _wrapper
return self.method(obj, *args, **kwargs)
File "C:\Users\Justin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\web3\contract.py", line 684, in buildTransaction
return fill_transaction_defaults(self.web3, built_transaction)
File "cytoolz\functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
File "C:\Users\Justin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\web3\_utils\transactions.py", line 121, in fill_transaction_defaults
default_val = default_getter(web3, transaction)
File "C:\Users\Justin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\web3\_utils\transactions.py", line 67, in <lambda>
'gas': lambda web3, tx: web3.eth.estimate_gas(tx),
File "C:\Users\Justin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\web3\eth.py", line 759, in estimate_gas
return self._estimate_gas(transaction, block_identifier)
File "C:\Users\Justin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\web3\module.py", line 57, in caller
result = w3.manager.request_blocking(method_str,
File "C:\Users\Justin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\web3\manager.py", line 197, in request_blocking
response = self._make_request(method, params)
File "C:\Users\Justin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\web3\manager.py", line 150, in _make_request
return request_func(method, params)
File "cytoolz\functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
File "C:\Users\Justin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\web3\middleware\formatting.py", line 76, in apply_formatters
response = make_request(method, params)
File "C:\Users\Justin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\web3\middleware\gas_price_strategy.py", line 90,
in middleware
return make_request(method, params)
File "cytoolz\functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
File "C:\Users\Justin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\web3\middleware\formatting.py", line 74, in apply_formatters
response = make_request(method, formatted_params)
File "C:\Users\Justin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\web3\middleware\attrdict.py", line 33, in middleware
response = make_request(method, params)
File "cytoolz\functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
File "C:\Users\Justin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\web3\middleware\formatting.py", line 74, in apply_formatters
response = make_request(method, formatted_params)
File "cytoolz\functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
File "C:\Users\Justin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\web3\middleware\formatting.py", line 73, in apply_formatters
formatted_params = formatter(params)
File "cytoolz\functoolz.pyx", line 503, in cytoolz.functoolz.Compose.__call__
File "cytoolz\functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
File "C:\Users\Justin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\eth_utils\decorators.py", line 91, in wrapper
return ReturnType(result) # type: ignore
File "C:\Users\Justin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\eth_utils\applicators.py", line 22, in apply_formatter_at_index
yield formatter(item)
File "cytoolz\functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
File "C:\Users\Justin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\eth_utils\functional.py", line 45, in inner
return callback(fn(*args, **kwargs))
File "C:\Users\Justin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\eth_utils\applicators.py", line 84, in apply_formatters_to_dict
yield key, formatters[key](item)
File "cytoolz\functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
File "C:\Users\Justin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\eth_utils\applicators.py", line 72, in apply_formatter_if
return formatter(value)
File "cytoolz\functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
File "C:\Users\Justin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\web3\middleware\validation.py", line 57, in validate_chain_id
raise ValidationError(
web3.exceptions.ValidationError: The transaction declared chain ID 5777, but the connected node is on 1337
The Full Code that I used is below:
from solcx import compile_standard, install_solc
import json
from web3 import Web3
with open("./SimpleStorage.sol", "r") as file:
simple_storage_file = file.read()
# Compile Our Solidity
print("Installing...")
install_solc("0.6.0")
compiled_sol = compile_standard(
{
"language": "Solidity",
"sources": {"SimpleStorage.sol": {"content": simple_storage_file}},
"settings": {
"outputSelection": {
"*": {
"*": [
"abi",
"metadata",
"evm.bytecode",
"evm.bytecode.sourceMap",
]
}
}
},
},
solc_version="0.6.0",
)
with open("compiled_code.json", "w") as file:
json.dump(compiled_sol, file)
# get bytecode
bytecode = compiled_sol["contracts"]["SimpleStorage.sol"]["SimpleStorage"]["evm"][
"bytecode"
]["object"]
# get abi
abi = compiled_sol["contracts"]["SimpleStorage.sol"]["SimpleStorage"]["abi"]
# for connecting to ganache
w3 = Web3(Web3.HTTPProvider("http://127.0.0.1:7545"))
chain_id = 5777
my_address = "0xf2580f5ddfFb89e69A12a7CbCa8CA175Df4cBe08"
private_key = "0x937073896304af4297e6bbb3a3c623689d48388aa8595058752fafb522b31a13"
# Create the contract in python
SimpleStorage = w3.eth.contract(abi=abi, bytecode=bytecode)
print(SimpleStorage)
# Get the latest transaction
nonce = w3.eth.getTransactionCount(my_address)
print(nonce)
# 1. Build a transaction
# 2. Sign a transaction
# 3. Send a transaction
transaction = SimpleStorage.constructor().buildTransaction(
{"chainId": chain_id, "from": my_address, "nonce": nonce}
)
print(transaction)
As of 5.25.0 of web3.py, we now need to add gasPrice to our transactions with a local Ganache chain. Adding "gasPrice": w3.eth.gas_price should fix your issue in the transactions.
Full Example:
transaction = SimpleStorage.constructor().buildTransaction(
{
"chainId": chain_id,
"gasPrice": w3.eth.gas_price,
"from": my_address,
"nonce": nonce,
}
)
Use the following line in .buildTransaction:
transaction = SimpleStorage.constructor().buildTransaction(
{'from': address, 'nonce':nonce, 'chainId':chain_id,'gas': 1728712,
'gasPrice': w3.toWei('21', 'gwei')})
And change the chain_id = 1337.
The transaction declared chain ID 5777, but the connected node is on 1337.
You have to change your chain_id:
chain_id = 5777❌
But use the one below
chain_id = 1337✔
I was having this exact same problem. Including "gasPrice": w3.eth.gas_price, solved it originally, but it came back.
After some tweaking, I found that casting chain_id (because I was getting that from .env as well) as an int solved my problems.
So the full code looked like this:
transaction = SimpleStorage.constructor().buildTransaction(
{
"chainId": int(chain_id),
"gasPrice": w3.eth.gas_price,
"from": my_address,
"nonce": nonce,
}
)
Error:
Odoo Server Error
Traceback (most recent call last):
File "F:\odoo-14.0\odoo-14.0\odoo\tools\convert.py", line 677, in _tag_root
f(rec)
File "F:\odoo-14.0\odoo-14.0\odoo\tools\convert.py", line 655, in _tag_template
return self._tag_record(record)
File "F:\odoo-14.0\odoo-14.0\odoo\tools\convert.py", line 580, in _tag_record
record = model._load_records([data], self.mode == 'update')
File "F:\odoo-14.0\odoo-14.0\odoo\models.py", line 4213, in _load_records
records = self._load_records_create([data['values'] for data in to_create])
File "F:\odoo-14.0\odoo-14.0\odoo\models.py", line 4142, in _load_records_create
return self.create(values)
File "<decorator-gen-43>", line 2, in create
File "F:\odoo-14.0\odoo-14.0\odoo\api.py", line 345, in _model_create_multi
return create(self, arg)
File "F:\odoo-14.0\odoo-14.0\odoo\addons\base\models\ir_ui_view.py", line 482, in create
return super(View, self).create(vals_list)
File "<decorator-gen-65>", line 2, in create
File "F:\odoo-14.0\odoo-14.0\odoo\api.py", line 345, in _model_create_multi
return create(self, arg)
File "F:\odoo-14.0\odoo-14.0\odoo\addons\base\models\ir_fields.py", line 534, in create
recs = super().create(vals_list)
File "<decorator-gen-13>", line 2, in create
File "F:\odoo-14.0\odoo-14.0\odoo\api.py", line 345, in _model_create_multi
return create(self, arg)
File "F:\odoo-14.0\odoo-14.0\odoo\models.py", line 3903, in create
fields[0].determine_inverse(batch_recs)
File "F:\odoo-14.0\odoo-14.0\odoo\fields.py", line 1185, in determine_inverse
getattr(records, self.inverse)()
File "F:\odoo-14.0\odoo-14.0\odoo\addons\base\models\ir_ui_view.py", line 300, in _inverse_arch
view.write(data)
File "F:\odoo-14.0\odoo-14.0\odoo\addons\base\models\ir_ui_view.py", line 500, in write
res = super(View, self).write(self._compute_defaults(vals))
File "F:\odoo-14.0\odoo-14.0\odoo\models.py", line 3687, in write
real_recs._validate_fields(vals, inverse_fields)
File "F:\odoo-14.0\odoo-14.0\odoo\models.py", line 1266, in _validate_fields
check(self)
File "F:\odoo-14.0\odoo-14.0\odoo\addons\base\models\ir_ui_view.py", line 411, in _check_xml
)).with_traceback(e.__traceback__) from None
File "F:\odoo-14.0\odoo-14.0\odoo\addons\base\models\ir_ui_view.py", line 385, in _check_xml
view_def = view.read_combined(['arch'])
File "F:\odoo-14.0\odoo-14.0\odoo\addons\base\models\ir_ui_view.py", line 809, in read_combined
arch = root.apply_view_inheritance(arch_tree, self.model)
File "F:\odoo-14.0\odoo-14.0\odoo\addons\base\models\ir_ui_view.py", line 750, in apply_view_inheritance
return self._apply_view_inheritance(source, inherit_tree)
File "F:\odoo-14.0\odoo-14.0\odoo\addons\base\models\ir_ui_view.py", line 758, in _apply_view_inheritance
source = view.apply_inheritance_specs(source, arch_tree)
File "F:\odoo-14.0\odoo-14.0\odoo\addons\base\models\ir_ui_view.py", line 735, in apply_inheritance_specs
self.handle_view_error(str(e))
File "F:\odoo-14.0\odoo-14.0\odoo\addons\base\models\ir_ui_view.py", line 673, in handle_view_error
raise ValueError(formatted_message).with_traceback(from_traceback) from from_exception
odoo.exceptions.ValidationError: Error while validating view:
Element '<xpath expr="//script[last()]">' cannot be located in parent view
View name: QUnit Assets
Error context:
view: ir.ui.view(1033,)
xmlid: qunit_suite
view.parent: ir.ui.view(199,)
file: f:\odoo-14.0\odoo-14.0\custom\muk_web_utils\template\assets.xml
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "F:\odoo-14.0\odoo-14.0\odoo\addons\base\models\ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "F:\odoo-14.0\odoo-14.0\odoo\http.py", line 684, in dispatch
result = self._call_function(**self.params)
File "F:\odoo-14.0\odoo-14.0\odoo\http.py", line 360, in _call_function
return checked_call(self.db, *args, **kwargs)
File "F:\odoo-14.0\odoo-14.0\odoo\service\model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "F:\odoo-14.0\odoo-14.0\odoo\http.py", line 348, in checked_call
result = self.endpoint(*a, **kw)
File "F:\odoo-14.0\odoo-14.0\odoo\http.py", line 913, in __call__
return self.method(*args, **kw)
File "F:\odoo-14.0\odoo-14.0\odoo\http.py", line 532, in response_wrap
response = f(*args, **kw)
File "f:\odoo-14.0\odoo-14.0\addons\web\controllers\main.py", line 1393, in call_button
action = self._call_kw(model, method, args, kwargs)
File "f:\odoo-14.0\odoo-14.0\addons\web\controllers\main.py", line 1381, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "F:\odoo-14.0\odoo-14.0\odoo\api.py", line 396, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "F:\odoo-14.0\odoo-14.0\odoo\api.py", line 383, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "<decorator-gen-72>", line 2, in button_immediate_install
File "F:\odoo-14.0\odoo-14.0\odoo\addons\base\models\ir_module.py", line 74, in check_and_log
return method(self, *args, **kwargs)
File "F:\odoo-14.0\odoo-14.0\odoo\addons\base\models\ir_module.py", line 475, in button_immediate_install
return self._button_immediate_function(type(self).button_install)
File "F:\odoo-14.0\odoo-14.0\odoo\addons\base\models\ir_module.py", line 593, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "F:\odoo-14.0\odoo-14.0\odoo\modules\registry.py", line 89, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "F:\odoo-14.0\odoo-14.0\odoo\modules\loading.py", line 460, in load_modules
loaded_modules, update_module, models_to_check)
File "F:\odoo-14.0\odoo-14.0\odoo\modules\loading.py", line 348, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check
File "F:\odoo-14.0\odoo-14.0\odoo\modules\loading.py", line 221, in load_module_graph
load_data(cr, idref, mode, kind='data', package=package)
File "F:\odoo-14.0\odoo-14.0\odoo\modules\loading.py", line 69, in load_data
tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind)
File "F:\odoo-14.0\odoo-14.0\odoo\tools\convert.py", line 733, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate)
File "F:\odoo-14.0\odoo-14.0\odoo\tools\convert.py", line 799, in convert_xml_import
obj.parse(doc.getroot())
File "F:\odoo-14.0\odoo-14.0\odoo\tools\convert.py", line 719, in parse
self._tag_root(de)
File "F:\odoo-14.0\odoo-14.0\odoo\tools\convert.py", line 685, in _tag_root
)) from e
Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "F:\odoo-14.0\odoo-14.0\odoo\http.py", line 640, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "F:\odoo-14.0\odoo-14.0\odoo\http.py", line 316, in _handle_exception
raise exception.with_traceback(None) from new_cause
odoo.tools.convert.ParseError: while parsing None:73, near
<data name="QUnit Assets" inherit_id="web.qunit_suite">
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/muk_web_utils/static/tests/fields.js"/>
</xpath>
</data>
and here is my code:
/**********************************************************************************
*
* Copyright (c) 2017-2019 MuK IT GmbH.
*
* This file is part of MuK Web Utils
* (see https://mukit.at).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
**********************************************************************************/
odoo.define('muk_web_utils.tests.fields', function (require) {
"use strict";
var basicFields = require('web.basic_fields');
var concurrency = require('web.concurrency');
var config = require('web.config');
var core = require('web.core');
var FormView = require('web.FormView');
var KanbanView = require('web.KanbanView');
var ListView = require('web.ListView');
var session = require('web.session');
var testUtils = require('web.test_utils');
var field_registry = require('web.field_registry');
var createView = testUtils.createView;
var createAsyncView = testUtils.createAsyncView;
var DebouncedField = basicFields.DebouncedField;
var JournalDashboardGraph = basicFields.JournalDashboardGraph;
var _t = core._t;
QUnit.module('muk_web_utils', {}, function () {
QUnit.module('fields', {
beforeEach: function () {
this.data = {
partner: {
fields: {
display_name: {
string: "Displayed name",
type: "char",
searchable: true
},
short: {
string: "Short",
type: "char",
searchable: true,
trim: true
},
long: {
String: "Long",
string: "txt",
type: "text",
},
document: {
string: "Binary",
type: "binary",
attachment: true,
},
},
records: [{
id: 1,
display_name: "first record",
short: "Short Text",
long: "Super looooooong Text",
document: 'coucou==\n',
}],
},
};
}
}, function () {
QUnit.module('BinaryFileCopy');
QUnit.test('Fields is correctly rendered', function (assert) {
assert.expect(2);
var form = createView({
View: FormView,
model: 'partner',
data: this.data,
arch: (
'<form string="Partners">' +
'<field name="document" widget="copy_binary" filename="short"/>' +
'<field name="short"/>' +
'</form>'
),
res_id: 1,
});
assert.strictEqual(
form.$('a.o_field_widget[name="document"] > .mk_copy_binary > .mk_copy_button').length,
1, "the copy button should be visible in readonly mode"
);
form.$buttons.find('.o_form_button_edit').click();
assert.strictEqual(
form.$('a.o_field_widget[name="document"] > .mk_copy_binary').length,
0, "the copy button shouldn't be visible in edit mode"
);
form.destroy();
});
QUnit.module('CharShare');
QUnit.test('Fields is correctly rendered', function (assert) {
assert.expect(1);
var form = createView({
View: FormView,
model: 'partner',
data: this.data,
arch: (
'<form string="Partners">' +
'<div>' +
'<field name="short" widget="share_char"/>' +
'</div>' +
'</form>'
),
res_id: 1,
});
assert.strictEqual(
form.$('span.o_field_widget[name="short"] > .mk_share_dropdown.mk_share_char').length,
1, "the copy button should be visible in readonly mode"
);
form.destroy();
});
QUnit.module('TextShare');
QUnit.test('Fields is correctly rendered', function (assert) {
assert.expect(1);
var form = createView({
View: FormView,
model: 'partner',
data: this.data,
arch: (
'<form string="Partners">' +
'<div>' +
'<field name="long" widget="share_text"/>' +
'</div>' +
'</form>'
),
res_id: 1,
});
assert.strictEqual(
form.$('span.o_field_widget[name="long"] > .mk_share_dropdown.mk_share_text').length,
1, "the copy button should be visible in readonly mode"
);
form.destroy();
});
QUnit.module('BinaryFileShare');
QUnit.test('Fields is correctly rendered', function (assert) {
assert.expect(2);
var form = createView({
View: FormView,
model: 'partner',
data: this.data,
arch: (
'<form string="Partners">' +
'<field name="document" widget="share_binary" filename="short"/>' +
'<field name="short"/>' +
'</form>'
),
res_id: 1,
});
assert.strictEqual(
form.$('a.o_field_widget[name="document"] > .mk_share_dropdown > .mk_share_button').length,
1, "the share dropdown should be visible in readonly mode"
);
form.$buttons.find('.o_form_button_edit').click();
assert.strictEqual(
form.$('a.o_field_widget[name="document"] > .mk_share_dropdown > .mk_share_button').length,
0, "the share dropdown shouldn't be visible in edit mode"
);
form.destroy();
});
});
});
});
When i upgrade this module from odoo 12 to odoo 14 then this error occured.When I changed the xpath and install this module its show an error typerror:view.getcontroller(....)then.guardedcatch is not a function. I have no idea about this error how can i fix it and in my code where i need to change please help me.
<xpath expr="//script[last()]" position="after">
Odoo can't able to get the above expr path so please check your inherited_id in v14.
or try to rewrite as this:
<template id="qunit_suite" name="QUnit Assets" inherit_id="web.qunit_suite">
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/muk_web_utils/static/tests/fields.js" />
</xpath>
</template>
I threw this together earlier today:
import stripe
stripe.api_key = "sk_test_key"
stripe.Token.create(
card={
"number": '4242424242424242',
"exp_month": 12,
"exp_year": 2018,
"cvc": '123'
},
)
stripe.Customer.create(
description="test test test",
source="tok_visa"
)
stripe.Customer.list(limit=1)
stripe.Subscription.create(
customer="id",
items=[
{
"plan": "1",
},
],
)
Running this returns with this
read-only#bash: Traceback (most recent call last):
File "main.py", line 28, in <module> "plan": "1",
File "/tmp/stripe/api_resources/subscription.py", line 33, in create return super(Subscription, cls).create(**params)
File "/tmp/stripe/api_resources/abstract/createable_api_resource.py", line 17, in create response, api_key = requestor.request('post', url, params, headers)
File "/tmp/stripe/api_requestor.py", line 152, in request resp = self.interpret_response(rbody, rcode, rheaders)
File "/tmp/stripe/api_requestor.py", line 359, in interpret_response self.handle_error_response(rbody, rcode, resp, rheaders)
File "/tmp/stripe/api_requestor.py", line 177, in handle_error_response raise err
stripe.error.InvalidRequestError: Request req_ZmLk0oWGjmrkut: No such customer: id
This seems to be an error or I'm just putting the wrong value in "customer"
Any ideas on on what to do?