Pymunk drawing utils not working - python-3.x

I am struggling to setup pymunk on my Ubuntu 16.04. I am using virtualenv, I have Python 3.5.2, pymunk 5.3.0 and cffi 1.11.0 installed.
I tried a very simple code first; basically, I created an empty Space and called step on it and everything worked smoothly. However, when I try to visualize it and create DrawOptions instance, I get strange errors, which I can't decipher. Also, I tried matplotlib_util and pygame_util, but both failed to create DrawOptions.
This is the code snippet I used:
import pymunk
import pyglet
import pymunk.pyglet_util
s = pymunk.Space()
options = pymunk.pyglet_util.DrawOptions()
s.debug_draw(options)
# s.step(0.02)
This is the output I get:
Loading chipmunk for Linux (64bit) [/home/wm/.virtualenvs/cv/lib/python3.5/site-packages/pymunk/libchipmunk.so]
Traceback (most recent call last):
File "/home/wm/.virtualenvs/cv/lib/python3.5/site-packages/cffi-1.11.0-py3.5-linux-x86_64.egg/cffi/api.py", line 167, in _typeof
result = self._parsed_types[cdecl]
KeyError: 'typedef void (*cpSpaceDebugDrawCircleImpl)(cpVect pos, cpFloat angle, cpFloat radius, cpSpaceDebugColor outlineColor, cpSpaceDebugColor fillColor, cpDataPointer data)'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/wm/.virtualenvs/cv/lib/python3.5/site-packages/cffi-1.11.0-py3.5-linux-x86_64.egg/cffi/cparser.py", line 276, in _parse
ast = _get_parser().parse(fullcsource)
File "/home/wm/.virtualenvs/cv/lib/python3.5/site-packages/pycparser/c_parser.py", line 152, in parse
debug=debuglevel)
File "/home/wm/.virtualenvs/cv/lib/python3.5/site-packages/pycparser/ply/yacc.py", line 331, in parse
return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
File "/home/wm/.virtualenvs/cv/lib/python3.5/site-packages/pycparser/ply/yacc.py", line 1199, in parseopt_notrack
tok = call_errorfunc(self.errorfunc, errtoken, self)
File "/home/wm/.virtualenvs/cv/lib/python3.5/site-packages/pycparser/ply/yacc.py", line 193, in call_errorfunc
r = errorfunc(token)
File "/home/wm/.virtualenvs/cv/lib/python3.5/site-packages/pycparser/c_parser.py", line 1761, in p_error
column=self.clex.find_tok_column(p)))
File "/home/wm/.virtualenvs/cv/lib/python3.5/site-packages/pycparser/plyparser.py", line 66, in _parse_error
raise ParseError("%s: %s" % (coord, msg))
pycparser.plyparser.ParseError: <cdef source string>:2:16: before: cpSpaceDebugDrawCircleImpl
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "pmtest2.py", line 5, in <module>
options = pymunk.pyglet_util.DrawOptions()
File "/home/wm/.virtualenvs/cv/lib/python3.5/site-packages/pymunk/pyglet_util.py", line 89, in __init__
super(DrawOptions, self).__init__()
File "/home/wm/.virtualenvs/cv/lib/python3.5/site-packages/pymunk/space_debug_draw_options.py", line 51, in __init__
#ffi.callback("typedef void (*cpSpaceDebugDrawCircleImpl)"
File "/home/wm/.virtualenvs/cv/lib/python3.5/site-packages/cffi-1.11.0-py3.5-linux-x86_64.egg/cffi/api.py", line 375, in callback
cdecl = self._typeof(cdecl, consider_function_as_funcptr=True)
File "/home/wm/.virtualenvs/cv/lib/python3.5/site-packages/cffi-1.11.0-py3.5-linux-x86_64.egg/cffi/api.py", line 170, in _typeof
result = self._typeof_locked(cdecl)
File "/home/wm/.virtualenvs/cv/lib/python3.5/site-packages/cffi-1.11.0-py3.5-linux-x86_64.egg/cffi/api.py", line 155, in _typeof_locked
type = self._parser.parse_type(cdecl)
File "/home/wm/.virtualenvs/cv/lib/python3.5/site-packages/cffi-1.11.0-py3.5-linux-x86_64.egg/cffi/cparser.py", line 476, in parse_type
return self.parse_type_and_quals(cdecl)[0]
File "/home/wm/.virtualenvs/cv/lib/python3.5/site-packages/cffi-1.11.0-py3.5-linux-x86_64.egg/cffi/cparser.py", line 479, in parse_type_and_quals
ast, macros = self._parse('void __dummy(\n%s\n);' % cdecl)[:2]
File "/home/wm/.virtualenvs/cv/lib/python3.5/site-packages/cffi-1.11.0-py3.5-linux-x86_64.egg/cffi/cparser.py", line 278, in _parse
self.convert_pycparser_error(e, csource)
File "/home/wm/.virtualenvs/cv/lib/python3.5/site-packages/cffi-1.11.0-py3.5-linux-x86_64.egg/cffi/cparser.py", line 307, in convert_pycparser_error
raise CDefError(msg)
cffi.error.CDefError: cannot parse "typedef void (*cpSpaceDebugDrawCircleImpl)(cpVect pos, cpFloat angle, cpFloat radius, cpSpaceDebugColor outlineColor, cpSpaceDebugColor fillColor, cpDataPointer data)"
<cdef source string>:2:16: before: cpSpaceDebugDrawCircleImpl
What do you think is causing that? Is that the python version I use, or maybe cffi compilation is faulty?

This error happens because there was a new version of pycparser (which is used by cffi) released, and that version breaks pymunk 5.3.0 and earlier versions. Yesterday I made a new release of Pymunk, 5.3.1 with a workaround for the problem. If you try to update your Pymunk version to 5.3.1 it should work.

Related

pylint and astroid AttributeError: 'Module' object has no attribute 'col_offset'

It fails using pylint version 2.9.0 and 2.9.3. With version 2.8.3 it still works though.
See GitHub-issue under the provided link.
Traceback (most recent call last):
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/astroid/inference_tip.py", line 19, in _inference_tip_cached
return iter(_cache[func, node])
KeyError: (<function register_builtin_transform.<locals>._transform_wrapper at 0x7f310b222700>, <Call l.166 at 0x7f3102ebf970>)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/.pyenv/versions/3.8.8/bin/pylint", line 8, in <module>
sys.exit(run_pylint())
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/pylint/__init__.py", line 24, in run_pylint
PylintRun(sys.argv[1:])
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/pylint/lint/run.py", line 384, in __init__
linter.check(args)
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 973, in check
self._check_files(
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 1007, in _check_files
self._check_file(get_ast, check_astroid_module, name, filepath, modname)
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 1033, in _check_file
check_astroid_module(ast_node)
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 1170, in check_astroid_module
retval = self._check_astroid_module(
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 1215, in _check_astroid_module
walker.walk(ast_node)
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/pylint/utils/ast_walker.py", line 77, in walk
self.walk(child)
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/pylint/utils/ast_walker.py", line 77, in walk
self.walk(child)
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/pylint/utils/ast_walker.py", line 74, in walk
callback(astroid)
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/pylint/checkers/typecheck.py", line 1071, in visit_assign
self._check_assignment_from_function_call(node)
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/pylint/checkers/typecheck.py", line 1081, in _check_assignment_from_function_call
function_node = safe_infer(node.value.func)
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/pylint/checkers/utils.py", line 1177, in safe_infer
value = next(infer_gen)
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/astroid/node_classes.py", line 353, in infer
yield from self._infer(context, **kwargs)
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/astroid/decorators.py", line 136, in raise_if_nothing_inferred
yield next(generator)
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/astroid/decorators.py", line 100, in wrapped
res = next(generator)
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/astroid/inference.py", line 299, in infer_attribute
for owner in self.expr.infer(context):
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/astroid/node_classes.py", line 367, in infer
for i, result in enumerate(generator):
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/astroid/decorators.py", line 136, in raise_if_nothing_inferred
yield next(generator)
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/astroid/decorators.py", line 100, in wrapped
res = next(generator)
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/astroid/bases.py", line 144, in _infer_stmts
for inferred in stmt.infer(context=context):
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/astroid/node_classes.py", line 367, in infer
for i, result in enumerate(generator):
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/astroid/decorators.py", line 136, in raise_if_nothing_inferred
yield next(generator)
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/astroid/decorators.py", line 100, in wrapped
res = next(generator)
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/astroid/bases.py", line 144, in _infer_stmts
for inferred in stmt.infer(context=context):
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/astroid/node_classes.py", line 343, in infer
results = tuple(self._explicit_inference(self, context, **kwargs))
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/astroid/inference_tip.py", line 21, in _inference_tip_cached
result = func(*args, **kwargs)
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/astroid/brain/brain_builtin_inference.py", line 203, in _transform_wrapper
if result.col_offset is None:
AttributeError: 'Module' object has no attribute 'col_offset'
The requirements.txt - file of this testing environment contains:
astroid
src/packages/project/requirements.txt
pycodestyle
pylint
pylint_junit
pytest
pytest-cov
yapf
with src/packages/project/requirements.txt containing:
awswrangler==2.8.0
babel==2.9.1
boto3==1.17.77
botocore==1.20.77
category-encoders==2.2.2
joblib==1.0.1
markdown==3.3.4
matplotlib==3.3.4
openpyxl==3.0.7
pandas==1.1.5
pyarrow==4.0.0
pytz==2021.1
requests==2.25.1
scikit-learn==0.24.2
simple_salesforce==1.0.0
EDIT on different attempts producing the same error:
Installing pylint=2.9.3
Installing astroid and pylint (latest versions, no version specification)
Installing astroid and pylint and upgrade astroid to latest version during build-process (in AWS test-buildspec.yml) via pip install --upgrade astroid (suggested here)
It look like you found a bug/crash in pylint 2.9, you can open an issue here. You can downgrade to 2.8.3 while it's being fixed.
Thanks to the work of #Pierre.Sassoulas this issue has been resolved (see here).
After having proven that the following combination of pylint - and astroid - versions worked well together without producing the OP-error, new commits have been made to the GitHub-project to fix the problem:
pip install pylint==2.9.3
pip install git+git://github.com/PyCQA/astroid.git#c37b6fd47b62486fd6cbe77b913b568b809f1a6d#egg=astroid
From here going forward, the issue should not occur again installing the latest version of pylint combined with astroid. Yet, if the issue returns, I'll let you know here.

Python library "Crypto" conflict

I'm trying to integrate two frameworks, and I'm installing requirements for both of frameworks, but it seems like the library 'Crypto' used in both frameworks and have different versions of use, so if I install requirements for one of the frameworks, it returns me the first error:
Traceback (most recent call last):
File "dapp_bdb.py", line 134, in <module>
main()
File "dapp_bdb.py", line 112, in main
blockchain = LevelDBBlockchain(settings.chain_leveldb_path)
File "/home/ubuntu/.local/lib/python3.6/site-packages/neo/Implementations/Blockchains/LevelDB/LevelDBBlockchain.py", line 190, in __init__
self.Persist(Blockchain.GenesisBlock())
File "/home/ubuntu/.local/lib/python3.6/site-packages/neo/Implementations/Blockchains/LevelDB/LevelDBBlockchain.py", line 691, in Persist
account = accounts.GetAndChange(output.AddressBytes, AccountState(output.ScriptHash))
File "/home/ubuntu/.local/lib/python3.6/site-packages/neo/Core/TX/Transaction.py", line 121, in AddressBytes
return bytes(self.Address, encoding='utf-8')
File "/home/ubuntu/.local/lib/python3.6/site-packages/neo/Core/TX/Transaction.py", line 111, in Address
return Crypto.ToAddress(self.ScriptHash)
File "/home/ubuntu/.local/lib/python3.6/site-packages/neocore/Cryptography/Crypto.py", line 103, in ToAddress
return scripthash_to_address(script_hash.Data)
File "/home/ubuntu/.local/lib/python3.6/site-packages/neocore/Cryptography/Helper.py", line 78, in scripthash_to_address
return base58.b58encode(bytes(outb)).decode("utf-8")
AttributeError: 'str' object has no attribute 'decode'
and with the second requrirements of the framework, it returns me other error:
exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "dapp_bdb.py", line 95, in custom_background_code
put_bdb("Hello world")
File "dapp_bdb.py", line 68, in put_bdb
fulfilled_creation_tx = bdb.transactions.fulfill(prepared_creation_tx, private_keys=private_key)
File "/home/ubuntu/.local/lib/python3.6/site-packages/bigchaindb_driver/driver.py", line 270, in fulfill
return fulfill_transaction(transaction, private_keys=private_keys)
File "/home/ubuntu/.local/lib/python3.6/site-packages/bigchaindb_driver/offchain.py", line 346, in fulfill_transaction
signed_transaction = transaction_obj.sign(private_keys)
File "/home/ubuntu/.local/lib/python3.6/site-packages/bigchaindb_driver/common/transaction.py", line 823, in sign
PrivateKey(private_key) for private_key in private_keys}
File "/home/ubuntu/.local/lib/python3.6/site-packages/bigchaindb_driver/common/transaction.py", line 823, in <dictcomp>
PrivateKey(private_key) for private_key in private_keys}
File "/home/ubuntu/.local/lib/python3.6/site-packages/bigchaindb_driver/common/transaction.py", line 817, in gen_public_key
public_key = private_key.get_verifying_key().encode()
File "/home/ubuntu/.local/lib/python3.6/site- packages/cryptoconditions/crypto.py", line 62, in get_verifying_key
return Ed25519VerifyingKey(self.verify_key.encode(encoder=Base58Encoder))
File "/home/ubuntu/.local/lib/python3.6/site-packages/nacl/encoding.py", line 90, in encode
return encoder.encode(bytes(self))
File "/home/ubuntu/.local/lib/python3.6/site-packages/cryptoconditions/crypto.py", line 15, in encode
return base58.b58encode(data).encode()
AttributeError: 'bytes' object has no attribute 'encode'
Is there any ideas how I can avoid it?
Looks like cryptoconditions library is doing it wrong.
You should file a bug asking to update required version of base58 and review all the calls to it. Usual behavior for Python3 is to return bytes on some_encoder_library.encode() and str on some_encoder_library.decode(). New versions of base58 module follow this rule although base58-encoded objects never contain any special symbols of course. cryptoconditions are still using previous version where b58encode were returning str.
Meanwhile you can make local modifications to the installed library or for it and install your fork instead.
It is likely that everything will work OK with encode() call removed from this line.

anaconda navigator will no longer start even through cmd, won't install or update or manage environments

I'm new to django and using the anaconda cloud environment. Its been working well for 3 months plus but as of 7-24-2018 it is just stop to launch the navigator or open through cmd. I can't manage environments or install packages. Using the anaconda prompt also gives me the same error upon launching. It started when I wanted to install django-Oscar, but not having its dependencies I was forced to install the packages manually which in turn needed cytoolz that needs Microsoft Visual C++ build tools which I got to install as well but the error persists. Please help me!
Copy/Paste of CMD Traceback:
C:\Users\kaukau\Desktop>conda --version conda 4.5.4
C:\Users\kaukau\Desktop>anaconda-navigator Traceback (most recent call
last): File
"C:\Users\kaukau\Anaconda3\lib\site-packages\qtpy__init__.py", line
169, in
from PySide import version as PYSIDE_VERSION # analysis:ignore ModuleNotFoundError: No module named 'PySide'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"C:\Users\kaukau\Anaconda3\Scripts\anaconda-navigator-script.py", line
6, in
from anaconda_navigator.app.main import main File "C:\Users\kaukau\Anaconda3\lib\site-packages\anaconda_navigator\app\main.py",
line 22, in
from anaconda_navigator.utils.conda import is_conda_available File
"C:\Users\kaukau\Anaconda3\lib\site-packages\anaconda_navigator\utils__init__.py",
line 15, in
from qtpy.QtGui import QIcon File "C:\Users\kaukau\Anaconda3\lib\site-packages\qtpy__init__.py", line
175, in
raise PythonQtError('No Qt bindings could be found') qtpy.PythonQtError: No Qt bindings could be found
C:\Users\kaukau\Desktop>conda install qt --force Traceback (most
recent call last): File
"C:\Users\kaukau\Anaconda3\lib\site-packages\conda\common\configuration.py",
line 42, in
from cytoolz.dicttoolz import merge File "C:\Users\kaukau\Anaconda3\lib\site-packages\cytoolz__init__.py",
line 1, in
from .itertoolz import * ModuleNotFoundError: No module named 'cytoolz.itertoolz'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"C:\Users\kaukau\Anaconda3\lib\site-packages\conda\exceptions.py",
line 819, in call
return func(*args, **kwargs) File "C:\Users\kaukau\Anaconda3\lib\site-packages\conda\cli\main.py", line
73, in _main
from ..base.context import context File "C:\Users\kaukau\Anaconda3\lib\site-packages\conda\base\context.py",
line 23, in
from ..common.configuration import (Configuration, LoadError, MapParameter, PrimitiveParameter, File
"C:\Users\kaukau\Anaconda3\lib\site-packages\conda\common\configuration.py",
line 47, in
from .._vendor.toolz.functoolz import excepts File "C:\Users\kaukau\Anaconda3\lib\site-packages\conda_vendor\toolz\functoolz.py",
line 501
f.name for f in reversed((self.first,) + self.funcs),
^ SyntaxError: Generator expression must be parenthesized
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"C:\Users\kaukau\Anaconda3\lib\site-packages\conda\common\configuration.py",
line 42, in
from cytoolz.dicttoolz import merge File "C:\Users\kaukau\Anaconda3\lib\site-packages\cytoolz__init__.py",
line 1, in
from .itertoolz import * ModuleNotFoundError: No module named 'cytoolz.itertoolz'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"C:\Users\kaukau\Anaconda3\Scripts\conda-script.py", line 10, in
sys.exit(main()) File "C:\Users\kaukau\Anaconda3\lib\site-packages\conda\cli\main.py", line
113, in main
return conda_exception_handler(_main, *args) File "C:\Users\kaukau\Anaconda3\lib\site-packages\conda\exceptions.py",
line 1112, in conda_exception_handler
return_value = exception_handler(func, *args, **kwargs) File "C:\Users\kaukau\Anaconda3\lib\site-packages\conda\exceptions.py",
line 822, in call
return self.handle_exception(exc_val, exc_tb) File "C:\Users\kaukau\Anaconda3\lib\site-packages\conda\exceptions.py",
line 864, in handle_exception
return self.handle_unexpected_exception(exc_val, exc_tb) File "C:\Users\kaukau\Anaconda3\lib\site-packages\conda\exceptions.py",
line 876, in handle_unexpected_exception
self.print_unexpected_error_report(error_report) File "C:\Users\kaukau\Anaconda3\lib\site-packages\conda\exceptions.py",
line 932, in print_unexpected_error_report
from .base.context import context File "C:\Users\kaukau\Anaconda3\lib\site-packages\conda\base\context.py",
line 23, in
from ..common.configuration import (Configuration, LoadError, MapParameter, PrimitiveParameter, File
"C:\Users\kaukau\Anaconda3\lib\site-packages\conda\common\configuration.py",
line 47, in
from .._vendor.toolz.functoolz import excepts File "C:\Users\kaukau\Anaconda3\lib\site-packages\conda_vendor\toolz\functoolz.py",
line 501
f.name for f in reversed((self.first,) + self.funcs),
^ SyntaxError: Generator expression must be parenthesized Traceback (most recent call last): File
"C:\Users\kaukau\Anaconda3\lib\site-packages\conda\common\configuration.py",
line 42, in
from cytoolz.dicttoolz import merge File "C:\Users\kaukau\Anaconda3\lib\site-packages\cytoolz__init__.py",
line 1, in
from .itertoolz import * ModuleNotFoundError: No module named 'cytoolz.itertoolz'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"C:\Users\kaukau\Anaconda3\lib\site-packages\conda\cli\main.py", line
97, in main
from ..activate import main as activator_main File "C:\Users\kaukau\Anaconda3\lib\site-packages\conda\activate.py", line
11, in
from .base.context import ROOT_ENV_NAME, context, locate_prefix_by_name File
"C:\Users\kaukau\Anaconda3\lib\site-packages\conda\base\context.py",
line 23, in
from ..common.configuration import (Configuration, LoadError, MapParameter, PrimitiveParameter, File
"C:\Users\kaukau\Anaconda3\lib\site-packages\conda\common\configuration.py",
line 47, in
from .._vendor.toolz.functoolz import excepts File "C:\Users\kaukau\Anaconda3\lib\site-packages\conda_vendor\toolz\functoolz.py",
line 501
f.name for f in reversed((self.first,) + self.funcs),
^ SyntaxError: Generator expression must be parenthesized
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"C:\Users\kaukau\Anaconda3\lib\site-packages\conda\common\configuration.py",
line 42, in
from cytoolz.dicttoolz import merge File "C:\Users\kaukau\Anaconda3\lib\site-packages\cytoolz__init__.py",
line 1, in
from .itertoolz import * ModuleNotFoundError: No module named 'cytoolz.itertoolz'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"C:\Users\kaukau\Anaconda3\Scripts\conda-script.py", line 10, in
sys.exit(main()) File "C:\Users\kaukau\Anaconda3\lib\site-packages\conda\cli\main.py", line
110, in main
return ExceptionHandler().handle_exception(exc_val, exc_tb) File "C:\Users\kaukau\Anaconda3\lib\site-packages\conda\exceptions.py",
line 864, in handle_exception
return self.handle_unexpected_exception(exc_val, exc_tb) File "C:\Users\kaukau\Anaconda3\lib\site-packages\conda\exceptions.py",
line 876, in handle_unexpected_exception
self.print_unexpected_error_report(error_report) File "C:\Users\kaukau\Anaconda3\lib\site-packages\conda\exceptions.py",
line 932, in print_unexpected_error_report
from .base.context import context File "C:\Users\kaukau\Anaconda3\lib\site-packages\conda\base\context.py",
line 23, in
from ..common.configuration import (Configuration, LoadError, MapParameter, PrimitiveParameter, File
"C:\Users\kaukau\Anaconda3\lib\site-packages\conda\common\configuration.py",
line 47, in
from .._vendor.toolz.functoolz import excepts File "C:\Users\kaukau\Anaconda3\lib\site-packages\conda_vendor\toolz\functoolz.py",
line 501
f.name for f in reversed((self.first,) + self.funcs),
^ SyntaxError: Generator expression must be parenthesized
I've just found out that I cant even use any conda commands except the : >conda --version< command only.
Please help me resolve this issue without uninstalling then reinstalling anaconda completely
Sorry to waste your time, I solved it by reinstalling anaconda completely and every project started working again....thanks to those who read it, the effort is appreciated.
It usually happen when you directly download and insall anaconda normally form its website.
Updating anaconda solved this issue for me in Manjaro and will surely work on Windows as well.
use conda update anaconda-navigator command to Update Anaconda.
If it doesn't starts, restart your pc and try to open it again.

win32com module not found

I am trying to get pyttsx3 up and running on my computer. I did pip install pyttsx3 and pip install pypiwin32 I can see both of them in my python directory.
I type this code in to test it:
import pyttsx3
engine = pyttsx3.init()
engine.say("I will speak this text")
engine.runAndWait()
This is what comes out:
Traceback (most recent call last):
File "C:\Users\Danny\AppData\Local\Programs\Python\Python36\lib\site-packages\pyttsx3__init__.py", line 44, in init
eng = _activeEngines[driverName]
File "C:\Users\Danny\AppData\Local\Programs\Python\Python36\lib\weakref.py", line 131, in getitem
o = self.datakey
KeyError: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Danny\Desktop\python text to speech.py", line 9, in
engine = pyttsx3.init()
File "C:\Users\Danny\AppData\Local\Programs\Python\Python36\lib\site-packages\pyttsx3__init__.py", line 46, in init
eng = Engine(driverName, debug)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python36\lib\site-packages\pyttsx3\engine.py", line 52, in init
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python36\lib\site-packages\pyttsx3\driver.py", line 77, in init
self._driver = self._module.buildDriver(weakref.proxy(self))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python36\lib\site-packages\pyttsx3\drivers\sapi5.py", line 22, in buildDriver
return SAPI5Driver(proxy)
File "C:\Users\Danny\AppData\Local\Programs\Python\Python36\lib\site-packages\pyttsx3\drivers\sapi5.py", line 41, in init
self.setProperty('voice', self.getProperty('voice'))
File "C:\Users\Danny\AppData\Local\Programs\Python\Python36\lib\site-packages\pyttsx3\drivers\sapi5.py", line 83, in setProperty
self._tts.Voice = token
File "C:\Users\Danny\AppData\Local\Programs\Python\Python36\lib\site-packages\win32com\client\dynamic.py", line 549, in setattr
self.oleobj.Invoke(entry.dispid, 0, invoke_type, 0, value)
pywintypes.com_error: (-2147352573, 'Member not found.', None, None)
I tried the same thing on another computer that already had both installed, and got the same output. Any idea what is going on with the win32com? I have no experience with it and am pretty lost. Thanks.
Ok, so I found the answer looking at other problems that were related to the win32com module. Basically what you need to do is navigate to your python scripts folder (in my case: C:\Users\Danny\AppData\Local\Programs\Python\Python36\Scripts) and run pywin32_postinstall. Upon running that script, it works perfectly!
Cheers!

TypeError: can't pickle memoryview objects when running basic add.delay(1,2) test

Trying to run the most basic test of add.delay(1,2) using celery 4.1.0 with Python 3.6.4 and getting the following error:
[2018-02-27 13:58:50,194: INFO/MainProcess] Received task:
exb.tasks.test_tasks.add[52c3fb33-ce00-4165-ad18-15026eca55e9]
[2018-02-27 13:58:50,194: CRITICAL/MainProcess] Unrecoverable error:
SystemError(' returned a result with an error set',) Traceback (most
recent call last): File
"/opt/myapp/lib/python3.6/site-packages/kombu/messaging.py", line 624,
in _receive_callback
return on_m(message) if on_m else self.receive(decoded, message) File
"/opt/myapp/lib/python3.6/site-packages/celery/worker/consumer/consumer.py",
line 570, in on_task_received
callbacks, File "/opt/myapp/lib/python3.6/site-packages/celery/worker/strategy.py",
line 145, in task_message_handler
handle(req) File "/opt/myapp/lib/python3.6/site-packages/celery/worker/worker.py", line
221, in _process_task_sem
return self._quick_acquire(self._process_task, req) File "/opt/myapp/lib/python3.6/site-packages/kombu/async/semaphore.py",
line 62, in acquire
callback(*partial_args, **partial_kwargs) File "/opt/myapp/lib/python3.6/site-packages/celery/worker/worker.py", line
226, in _process_task
req.execute_using_pool(self.pool) File "/opt/myapp/lib/python3.6/site-packages/celery/worker/request.py",
line 531, in execute_using_pool
correlation_id=task_id, File "/opt/myapp/lib/python3.6/site-packages/celery/concurrency/base.py",
line 155, in apply_async
**options) File "/opt/myapp/lib/python3.6/site-packages/billiard/pool.py", line 1486,
in apply_async
self._quick_put((TASK, (result._job, None, func, args, kwds))) File
"/opt/myapp/lib/python3.6/site-packages/celery/concurrency/asynpool.py",
line 813, in send_job
body = dumps(tup, protocol=protocol) TypeError: can't pickle memoryview objects
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File
"/opt/myapp/lib/python3.6/site-packages/celery/worker/worker.py", line
203, in start
self.blueprint.start(self) File "/opt/myapp/lib/python3.6/site-packages/celery/bootsteps.py", line
119, in start
step.start(parent) File "/opt/myapp/lib/python3.6/site-packages/celery/bootsteps.py", line
370, in start
return self.obj.start() File "/opt/myapp/lib/python3.6/site-packages/celery/worker/consumer/consumer.py",
line 320, in start
blueprint.start(self) File "/opt/myapp/lib/python3.6/site-packages/celery/bootsteps.py", line
119, in start
step.start(parent) File "/opt/myapp/lib/python3.6/site-packages/celery/worker/consumer/consumer.py",
line 596, in start
c.loop(*c.loop_args()) File "/opt/myapp/lib/python3.6/site-packages/celery/worker/loops.py", line
88, in asynloop
next(loop) File "/opt/myapp/lib/python3.6/site-packages/kombu/async/hub.py", line 354,
in create_loop
cb(*cbargs) File "/opt/myapp/lib/python3.6/site-packages/kombu/transport/base.py", line
236, in on_readable
reader(loop) File "/opt/myapp/lib/python3.6/site-packages/kombu/transport/base.py", line
218, in _read
drain_events(timeout=0) File "/opt/myapp/lib/python3.6/site-packages/librabbitmq-2.0.0-py3.6-linux-x86_64.egg/librabbitmq/init.py",
line 227, in drain_events
self._basic_recv(timeout) SystemError: returned a result with an error set
I cannot find any previous evidence of anyone hitting this error. I noticed from the celery site that only python 3.5 is mentioned as supported, is that the issue or is this something I am missing?
Any help would be much appreciated!
UPDATE: Tried with Python 3.5.5 and the problem persists. Tried with Django 4.0.2 and the problem persists.
UPDATE: Uninstalled librabbitmq and the problem stopped. This was seen after migration from Python 2.7.5, Django 1.7.7 to Python 3.6.4, Django 2.0.2.
After uninstalling librabbitmq, the problem was resolved.

Resources