I am running a lambda function related with only database. I donot need any input from event. But handler function consists of event and context. If I remove the event and context, it shows error. Is it possible to remove these things? If yes, how?
Traceback (most recent call last):
File "/home/preethi/newvenv/bin/lambda", line 187, in <module>
cli()
File "/home/preethi/newvenv/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
return self.main(*args, **kwargs)
File "/home/preethi/newvenv/local/lib/python2.7/site-packages/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/home/preethi/newvenv/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/preethi/newvenv/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/preethi/newvenv/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "/home/preethi/newvenv/bin/lambda", line 85, in invoke
verbose=verbose,
File "/home/preethi/newvenv/local/lib/python2.7/site-packages/aws_lambda/aws_lambda.py", line 220, in invoke
results = fn(event, None)
TypeError: handler() takes no arguments (2 given)
Thank You.
Related
When I try to sign a PDF document from the CLI using pyhanko-cli package I get the following error:
This is the command I try to run:
pyhanko sign addsig --field Sig1 pemder --key example2.key --cert example2.crt source/SCRIPT_unsigned.pdf out/SCRIPT_signed_cli.pdf
This is the output:
Key passphrase:
2022-09-22 14:56:36,559 - pyhanko.sign.signers.pdf_cms - ERROR - Could not load cryptographic material
Traceback (most recent call last):
File "/home/chris/codetest/pdfsign/pyhanko/.venv/bin/pyhanko", line 8, in <module>
sys.exit(launch())
File "/home/chris/codetest/pdfsign/pyhanko/.venv/lib/python3.9/site-packages/pyhanko/__main__.py", line 7, in launch
cli(prog_name='pyhanko')
File "/home/chris/codetest/pdfsign/pyhanko/.venv/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/home/chris/codetest/pdfsign/pyhanko/.venv/lib/python3.9/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/chris/codetest/pdfsign/pyhanko/.venv/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/chris/codetest/pdfsign/pyhanko/.venv/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/chris/codetest/pdfsign/pyhanko/.venv/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/chris/codetest/pdfsign/pyhanko/.venv/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/chris/codetest/pdfsign/pyhanko/.venv/lib/python3.9/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/chris/codetest/pdfsign/pyhanko/.venv/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/chris/codetest/pdfsign/pyhanko/.venv/lib/python3.9/site-packages/pyhanko/cli.py", line 958, in addsig_pemder
signer = pemder_config.instantiate(provided_key_passphrase=passphrase)
File "/home/chris/codetest/pdfsign/pyhanko/.venv/lib/python3.9/site-packages/pyhanko/config.py", line 369, in instantiate
raise ConfigurationError("Error while loading key material")
pyhanko.pdf_utils.config_utils.ConfigurationError: Error while loading key material
```
Add the --no-pass argument to the call
pyhanko sign addsig --field Sig1 pemder --key example2.key --cert example2.crt source/SCRIPT_unsigned.pdf out/SCRIPT_signed_cli.pdf --no-pass
Feature was added very recently. Found the answer on the discussion page
pyHanko GitHub discussions
I am new to python and pipenv. when I run pipenv lock,I got the following error, I have reinstall pipenv and search the error on google but I still can not fix the error. Last time when I opened the projects with pipenv it is ok, why now it is bad? Is there any relationship with oh-my-zsh?
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/pipenv/project.py", line 527, in _parse_pipfile
return tomlkit.parse(contents)
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/tomlkit/api.py", line 49, in parse
return Parser(string).parse()
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/tomlkit/parser.py", line 146, in parse
key, value = self._parse_table()
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/tomlkit/parser.py", line 958, in _parse_table
item = self._parse_item()
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/tomlkit/parser.py", line 270, in _parse_item
return self._parse_key_value(True)
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/tomlkit/parser.py", line 347, in _parse_key_value
raise self.parse_error(UnexpectedCharError, "=")
** tomlkit.exceptions.UnexpectedCharError: Unexpected character: '=' at line 45 col 16 **
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/toml/decoder.py", line 456, in loads
multibackslash)
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/toml/decoder.py", line 678, in load_line
raise ValueError("Invalid date or number")
ValueError: Invalid date or number
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 10, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/pipenv/cli/command.py", line 301, in uninstall
ctx=ctx
File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 2020, in do_uninstall
ensure_project(three=three, python=python, pypi_mirror=pypi_mirror)
File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 574, in ensure_project
pypi_mirror=pypi_mirror,
File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 494, in ensure_virtualenv
python = ensure_python(three=three, python=python)
File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 394, in ensure_python
python = project.required_python_version
File "/usr/local/lib/python3.7/site-packages/pipenv/project.py", line 243, in required_python_version
required = self.parsed_pipfile.get("requires", {}).get(
File "/usr/local/lib/python3.7/site-packages/pipenv/project.py", line 509, in parsed_pipfile
parsed = self._parse_pipfile(contents)
File "/usr/local/lib/python3.7/site-packages/pipenv/project.py", line 531, in _parse_pipfile
return toml.loads(contents)
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/toml/decoder.py", line 458, in loads
raise TomlDecodeError(str(err), original, pos)
toml.decoder.TomlDecodeError: Invalid date or number (line 45 column 1 char 848)``
when I run `pipenv update`, I got the same error
Check your Pipfile if there is a typo? I got the same error when the Pipfile has a typo, yours I think it is in line 45
I was trying to create an auto chatbot with bothub.
It's a very new experience for me and I am stuck here
I wish that I could find an answer here.
JamesLees-MacBook-Pro:kakaotalkchatbot root# bothub logs
Traceback (most recent call last):
File "/usr/local/bin/bothub", line 11, in <module>
sys.exit(main())
File "/Library/Python/2.7/site-packages/bothub_cli/main.py", line 539, in main
cli()
File "/Library/Python/2.7/site-packages/click/core.py", line 721, in __call__
return self.main(*args, **kwargs)
File "/Library/Python/2.7/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/Library/Python/2.7/site-packages/click/core.py", line 1065, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Library/Python/2.7/site-packages/click/core.py", line 894, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Library/Python/2.7/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/Library/Python/2.7/site-packages/bothub_cli/main.py", line 497, in logs
log_entries = lib_cli.logs()
File "/Library/Python/2.7/site-packages/bothub_cli/lib.py", line 291, in logs
self._load_auth()
File "/Library/Python/2.7/site-packages/bothub_cli/lib.py", line 298, in _load_auth
self.config.load()
File "/Library/Python/2.7/site-packages/bothub_cli/config.py", line 46, in load
with open(self.path, encoding='utf8') as fin:
TypeError: 'encoding' is an invalid keyword argument for this function
This is what I am getting and I cannot proceed from this
TypeError: 'encoding' is an invalid keyword argument for this
I would at least like to know what is the problem
It's still okay if it's not solvable
I would love to get suggestions with chatbot too
Thanks.
So I am getting error while executing code in rq worker
File "/usr/local/bin/rq", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/rq/cli/cli.py", line 75, in wrapper
return ctx.invoke(func, cli_config, *args[1:], **kwargs)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/rq/cli/cli.py", line 236, in worker
worker.work(burst=burst, logging_level=logging_level)
File "/usr/local/lib/python3.7/site-packages/rq/worker.py", line 493, in work
self.execute_job(job, queue)
File "/usr/local/lib/python3.7/site-packages/rq/worker.py", line 662, in execute_job
self.fork_work_horse(job, queue)
File "/usr/local/lib/python3.7/site-packages/rq/worker.py", line 599, in fork_work_horse
self.main_work_horse(job, queue)
File "/usr/local/lib/python3.7/site-packages/rq/worker.py", line 677, in main_work_horse
success = self.perform_job(job, queue)
File "/usr/local/lib/python3.7/site-packages/rq/worker.py", line 781, in perform_job
self.prepare_job_execution(job)
File "/usr/local/lib/python3.7/site-packages/rq/worker.py", line 706, in prepare_job_execution
registry.add(job, timeout, pipeline=pipeline)
File "/usr/local/lib/python3.7/site-packages/rq/registry.py", line 47, in add
return pipeline.zadd(self.key, score, job.id)
File "/usr/local/lib/python3.7/site-packages/redis/client.py", line 2263, in zadd
for pair in iteritems(mapping):
File "/usr/local/lib/python3.7/site-packages/redis/_compat.py", line 123, in iteritems
return iter(x.items())
AttributeError: 'int' object has no attribute 'items'
14:04:29 Moving job to 'failed' queue (work-horse terminated unexpectedly; waitpid returned 256)
I am trying to run this code in decoupled containers on openshift. Same images work locally. I guess only difference is I was running rq worker on system instead on container when trying locally and my local have both python 2 and 3 while openshift have python3 only.
Can anyone resolve why it started behaving like this. I suspect its due to python version. but i dont know how to run redis/ rq worker with python 2.
That is a known issue, resulting from redis-py's new version 3 - see https://github.com/rq/rq/issues/1014
My app started throwing this error last night. Users are complaining the site is slow as well. Still on Python 2.5. As far as I can tell the request itself is not unusual.
Any ideas?
Traceback (most recent call last):
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/_webapp25.py", line 703, in __call__
handler.post(*groups)
File "/base/data/home/apps/s~jupitersfolly/4.357517623694016771/controller/frequest.py", line 57, in post
request_types[request_type]()
File "/base/data/home/apps/s~jupitersfolly/4.357517623694016771/controller/frequest.py", line 78, in order
event, report, messages = Game.update(game_number, user_id, order)
File "/base/data/home/apps/s~jupitersfolly/4.357517623694016771/model/game.py", line 355, in update
event, report, game, universe, messages, updated, ended = db.run_in_transaction(Game.transactional_update, key_id, user_id, order)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 2433, in RunInTransaction
return RunInTransactionOptions(None, function, *args, **kwargs)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 2571, in RunInTransactionOptions
ok, result = _DoOneTry(new_connection, function, args, kwargs)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 2593, in _DoOneTry
result = function(*args, **kwargs)
File "/base/data/home/apps/s~jupitersfolly/4.357517623694016771/model/game.py", line 348, in transactional_update
game.put()
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/db/__init__.py", line 1074, in put
return datastore.Put(self._entity, **kwargs)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 579, in Put
return PutAsync(entities, **kwargs).get_result()
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 604, in get_result
return self.__get_result_hook(self)
File "/base/python_runtime/python_lib/versions/1/google/appengine/datastore/datastore_rpc.py", line 1577, in __put_hook
self.check_rpc_success(rpc)
File "/base/python_runtime/python_lib/versions/1/google/appengine/datastore/datastore_rpc.py", line 1212, in check_rpc_success
rpc.check_success()
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 570, in check_success
self.__rpc.CheckSuccess()
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_rpc.py", line 133, in CheckSuccess
raise self.exception
ArgumentError: An error occurred parsing (locally or remotely) the arguments to datastore_v3.Put()