I have python-memcached (1.57) and django-celery (3.1.17), celery (3.1.20) and python 3.5. I always get the error below when i try to implement http://docs.celeryproject.org/en/latest/tutorials/task-cookbook.html#ensuring-a-task-is-only-executed-one-at-a-time
Task tasks.live_task[a2ed1faf-0fce-4855-a206-40f2fbdae1a8] raised unexpected: TypeError("a bytes-like object is required, not 'str'",)
Traceback (most recent call last):
File "/app/current/venv/lib/python3.5/site-packages/celery/app/trace.py", line 240, in trace_task
R = retval = fun(*args, **kwargs)
File "/app/current/venv/lib/python3.5/site-packages/celery/app/trace.py", line 438, in __protected_call__
return self.run(*args, **kwargs)
File "/app/current/src/helps.py", line 62, in wrapper
if acquire():
File "/app/current/src/helps.py", line 57, in acquire
return cache.add(id, "true", time_out)
File "/app/current/venv/lib/python3.5/site-packages/django/core/cache/backends/memcached.py", line 80, in add
return self._cache.add(key, value, self.get_backend_timeout(timeout))
File "/app/current/venv/lib/python3.5/site-packages/memcache.py", line 633, in add
return self._set("add", key, val, time, min_compress_len, noreply)
File "/app/current/venv/lib/python3.5/site-packages/memcache.py", line 983, in _set
server, key = self._get_server(key)
File "/app/dashboard/current/venv/lib/python3.5/site-packages/memcache.py", line 413, in _get_server
serverhash = serverHashFunction(str(serverhash) + str(i))
File "/app/current/venv/lib/python3.5/site-packages/memcache.py", line 65, in cmemcache_hash
(((binascii.crc32(key) & 0xffffffff)
TypeError: a bytes-like object is required, not 'str'
python-memchached is not supported on python 3.5
If you've used python-memchached, The following commands will help you.
pip uninstall python-memcached
pip install python3-memcached
Related
23 aditi#DESKTOP-9EEMTR0 ~/ardupilot/ArduCopter
$ ../Tools/autotest/sim_vehicle.py --map --console
SIM_VEHICLE: Start
SIM_VEHICLE: Killing tasks
SIM_VEHICLE: kill_tasks failed: a bytes-like object is required, not 'str'
SIM_VEHICLE: Starting up at -35.363261,149.165230,584,353 (CMAC)
SIM_VEHICLE: WAF build
SIM_VEHICLE: Configure waf
SIM_VEHICLE: "/home/aditi/ardupilot/modules/waf/waf-light" "configure" "--board" "sitl"
Traceback (most recent call last):
File "/home/aditi/ardupilot/modules/waf/waflib/Node.py", line 579, in ant_iter
raise StopIteration
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/aditi/ardupilot/modules/waf/waflib/Scripting.py", line 165, in waf_entry_point
run_commands()
File "/home/aditi/ardupilot/modules/waf/waflib/Scripting.py", line 262, in run_commands
parse_options()
File "/home/aditi/ardupilot/modules/waf/waflib/Scripting.py", line 214, in parse_options
Context.create_context('options').execute()
File "/home/aditi/ardupilot/modules/waf/waflib/Options.py", line 271, in execute
super(OptionsContext, self).execute()
File "/home/aditi/ardupilot/modules/waf/waflib/Context.py", line 205, in execute
self.recurse([os.path.dirname(g_module.root_path)])
File "/home/aditi/ardupilot/modules/waf/waflib/Context.py", line 287, in recurse
user_function(self)
File "/home/aditi/ardupilot/wscript", line 49, in options
opt.load('compiler_cxx compiler_c waf_unit_test python')
File "/home/aditi/ardupilot/modules/waf/waflib/Context.py", line 197, in load
fun(self)
File "/home/aditi/ardupilot/modules/waf/waflib/Tools/compiler_cxx.py", line 103, in options
opt.load_special_tools('cxx_*.py')
File "/home/aditi/ardupilot/modules/waf/waflib/Context.py", line 609, in load_special_tools
lst = self.root.find_node(waf_dir).find_node('waflib/extras').ant_glob(var)
File "/home/aditi/ardupilot/modules/waf/waflib/Node.py", line 672, in ant_glob
ret = [x for x in self.ant_iter(accept=accept, pats=[to_pat(incl), to_pat(excl)], maxdepth=kw.get('maxdepth', 25), dir=dir, src=src, remove=kw.get('remove', True))]
File "/home/aditi/ardupilot/modules/waf/waflib/Node.py", line 672, in <listcomp>
ret = [x for x in self.ant_iter(accept=accept, pats=[to_pat(incl), to_pat(excl)], maxdepth=kw.get('maxdepth', 25), dir=dir, src=src, remove=kw.get('remove', True))]
RuntimeError: generator raised StopIteration
SIM_VEHICLE: (Configure waf) exited with code 512
SIM_VEHICLE: Killing tasks
SIM_VEHICLE: kill_tasks failed: a bytes-like object is required, not 'str'
It's not clear what exactly it is, but you may have just made a mistake somewhere in your Python file based on << a bytes-like object is required, not 'str' >> meaning somewhere you should not enter a string, But you entered a string and you should not do this
Maybe in file sim_vehicle.py
I am trying to parse a gif file with Biopython, and am using the sample code from their website. This is the code:
from BCBio import GFF
in_file = "infile.gff"
in_handle = open(in_file)
for rec in GFF.parse(in_handle):
print(rec)
in_handle.close()
When I run the code I get the following error:
Traceback (most recent call last):
File "/Users/juliofdiaz/anaconda2/envs/python37/lib/python3.7/site-packages/Bio/SeqIO/Interfaces.py", line 47, in __init__
self.stream = open(source, "r" + mode)
TypeError: expected str, bytes or os.PathLike object, not FakeHandle
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "get_genes_dpt.py", line 37, in <module>
for rec in GFF.parse(in_handle):
File "/Users/juliofdiaz/anaconda2/envs/python37/lib/python3.7/site-packages/BCBio/GFF/GFFParser.py", line 746, in parse
target_lines):
File "/Users/juliofdiaz/anaconda2/envs/python37/lib/python3.7/site-packages/BCBio/GFF/GFFParser.py", line 322, in parse_in_parts
for results in self.parse_simple(gff_files, limit_info, target_lines):
File "/Users/juliofdiaz/anaconda2/envs/python37/lib/python3.7/site-packages/BCBio/GFF/GFFParser.py", line 343, in parse_simple
for results in self._gff_process(gff_files, limit_info, target_lines):
File "/Users/juliofdiaz/anaconda2/envs/python37/lib/python3.7/site-packages/BCBio/GFF/GFFParser.py", line 637, in _gff_process
for out in self._lines_to_out_info(line_gen, limit_info, target_lines):
File "/Users/juliofdiaz/anaconda2/envs/python37/lib/python3.7/site-packages/BCBio/GFF/GFFParser.py", line 699, in _lines_to_out_info
fasta_recs = self._parse_fasta(FakeHandle(line_iter))
File "/Users/juliofdiaz/anaconda2/envs/python37/lib/python3.7/site-packages/BCBio/GFF/GFFParser.py", line 560, in _parse_fasta
return list(SeqIO.parse(in_handle, "fasta"))
File "/Users/juliofdiaz/anaconda2/envs/python37/lib/python3.7/site-packages/Bio/SeqIO/__init__.py", line 607, in parse
return iterator_generator(handle)
File "/Users/juliofdiaz/anaconda2/envs/python37/lib/python3.7/site-packages/Bio/SeqIO/FastaIO.py", line 183, in __init__
super().__init__(source, mode="t", fmt="Fasta")
File "/Users/juliofdiaz/anaconda2/envs/python37/lib/python3.7/site-packages/Bio/SeqIO/Interfaces.py", line 51, in __init__
if source.read(0) != "":
TypeError: read() takes 1 positional argument but 2 were given
I am not sure how to fix the error as it seems I am passing a str and not a FakeHandle. I am running biopython 1.78 with conda.
I'm trying to run flake8 on a docker django built like described here (tutorial page)
when building the docker image I get an error from flake8 which is run in an docker-compose file with like so
$ flake8 --ignore=E501,F401 .
multiprocessing.pool.RemoteTraceback:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **
File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 48, in
return list(map(*
File "/usr/local/lib/python3.8/site-packages/flake8/checker.py", line 666, in
return checker.run_checks()
File "/usr/local/lib/python3.8/site-packages/flake8/checker.py", line 598, in run_checks
self.run_ast_checks()
File "/usr/local/lib/python3.8/site-packages/flake8/checker.py", line 495, in run_ast_checks
checker = self.run_check(plugin, tree=ast)
File "/usr/local/lib/python3.8/site-packages/flake8/checker.py", line 426, in run_check
self.processor.keyword_arguments_for( File "/usr/local/lib/python3.8/site-packages/flake8/processor.py", line 241, in keyword_arguments_for arguments[param] = getattr(self, param)
File "/usr/local/lib/python3.8/site-packages/flake8/processor.py", line 119, in file_tokens
self._file_tokens = list(
File "/usr/local/lib/python3.8/tokenize.py", line 525, in _tokenize
pseudomatch = _compile(PseudoToken).match(line, pos)
RuntimeError: internal error in regular expression engine
The above exception was the direct cause of the following exception: Traceback (most recent call last):
File "/usr/local/bin/flake8", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.8/site-packages/flake8/main/cli.py", line 18, in main
app.run(argv)
File "/usr/local/lib/python3.8/site-packages/flake8/main/application.py", line 393, in run
self._run(argv)
File "/usr/local/lib/python3.8/site-packages/flake8/main/application.py", line 381, in _run
self.run_checks()
File "/usr/local/lib/python3.8/site-packages/flake8/main/application.py", line 300, in run_checks
self.file_checker_manager.run()
File "/usr/local/lib/python3.8/site-packages/flake8/checker.py", line 329, in run
self.run_parallel()
File "/usr/local/lib/python3.8/site-packages/flake8/checker.py", line 293, in run_parallel
for ret in pool_map:
File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 448, in <genexpr>
return (item for chunk in result for item in chunk)
File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 865, in next
raise value
RuntimeError: internal error in regular expression engine
When I run flake8 with the --verbose flag, I get an error like this:
Fatal Python error: deletion of interned string failed
Python runtime state: initialized
KeyError: 'FILENAME_RE'
from the tokenizer.py
Does anyone know how to solve this?
Additional Data:
running docker-compose v1.25.4 on an raspberry 3 with buster lite.
Installed and compiled Python 3.8.2 from source with the flag --enableloadable-sqlite
Thanks for helping!
If you don't care for flake8, then just delete that line. It will work. I had the same problem.
I know this isn't an answer. I would add a comment instead if I could.
I encountered a very similar error profile when I had refactored and left a lot of data which formerly had been in the top of the project down in what became the package folder. There were 33621 files including .venv, .nox, .pytest_cache, .coverage.
File "/usr/lib/python3.8/multiprocessing/pool.py", line 448, in <genexpr>
return (item for chunk in result for item in chunk)
File "/usr/lib/python3.8/multiprocessing/pool.py", line 868, in next
raise value
IndexError: string index out of range
If you see a similar signature (the parallel processing engine being overwhelmed in some way and throwing an exception), you may want to review your project directory structure and make sure that you did not put this kind of data in your sources directories.
I'm using windows 7, python 2.7.10, conda 3.14.1. When I create a simple conda environment using conda create -n webhook conda
It shows TypeError: __init__() got an unexpected keyword argument 'max_retries'
The entire traceback is:
Traceback (most recent call last):
File "D:\Program\Anaconda\Scripts\conda-script.py", line 4, in <module>
sys.exit(main())
File "D:\Program\Anaconda\lib\site-packages\conda\cli\main.py", line 201, in m
ain
args_func(args, p)
File "D:\Program\Anaconda\lib\site-packages\conda\cli\main.py", line 208, in a
rgs_func
args.func(args, p)
File "D:\Program\Anaconda\lib\site-packages\conda\cli\common.py", line 612, in
inner
return func(args, parser)
File "D:\Program\Anaconda\lib\site-packages\conda\cli\main_create.py", line 50
, in execute
install.install(args, parser, 'create')
File "D:\Program\Anaconda\lib\site-packages\conda\cli\install.py", line 255, i
n install
offline=args.offline)
File "D:\Program\Anaconda\lib\site-packages\conda\cli\common.py", line 549, in
get_index_trap
return get_index(*args, **kwargs)
File "D:\Program\Anaconda\lib\site-packages\conda\api.py", line 42, in get_ind
ex
unknown=unknown)
File "D:\Program\Anaconda\lib\site-packages\conda\utils.py", line 119, in __ca
ll__
value = self.func(*args, **kw)
File "D:\Program\Anaconda\lib\site-packages\conda\fetch.py", line 228, in fetc
h_index
session = CondaSession()
File "D:\Program\Anaconda\lib\site-packages\conda\connection.py", line 67, in
__init__
http_adapter = requests.adapters.HTTPAdapter(max_retries=retries)
TypeError: __init__() got an unexpected keyword argument 'max_retries'
Trying to run some code. Get this error when I do. I thought I had all the necessary dependencies installed, but still getting this error.
linux; GNU C++ version 4.8.1; Boost_105300; UHD_003.007.000-133-g6bd9fed2
Traceback (most recent call last):
File "/usr/local/bin/tpms_rx", line 274, in <module>
main()
File "/usr/local/bin/tpms_rx", line 265, in main
tb = top_block(source, args)
File "/usr/local/bin/tpms_rx", line 229, in __init__
self.source = source_rtlsdr(args.tuned_frequency, args.if_rate)
File "/usr/local/lib/python2.7/dist-packages/tpms/source.py", line 98, in __init__
rf_decimation, rf_decimation_remainder = divmod(rf_sampling_rate, if_sampling_rate)
TypeError: unsupported operand type(s) for divmod(): 'int' and 'NoneType'
When you run your program you need to pass a parameter -i/--if-rate or else the default is None which eventually gets passed, 2 layers later, to divmod.
See https://github.com/jboone/gr-tpms/blob/master/apps/tpms_rx and https://github.com/jboone/gr-tpms/blob/master/python/source.py additionally.