Python operation Kafka reports an error: return ‘& lt; SimpleProducer batch=%s>’ %self.async
return ‘< SimpleProducer batch=%s>’ % self. async
^^^^^
SyntaxError: invalid syntax
reason:
Because PY3 Async has become a keyword in 7. This leads to incompatibility.
Solution:
Method 1:
The latest Kafka version is used, but the Kafka on pypi has not been replaced with the latest one. You can upgrade Kafka Python using the following method
PIP install Kafka python
Method 2:
Just switch to version 3.6 and wait for subsequent upgrades
Read More:
- [Solved] sys.stderr.write(f“ERROR: {exc}“) ^ SyntaxError: invalid syntax
- [Solved] rdd.foreach(print) Error: SyntaxError: invalid syntax
- Python syntax error except exception, e: ^ syntax error: invalid syntax
- [Solved] Failed to install PIP for MacOS, prompt: syntax error: invalid syntax
- [Solved] PIP Install tensorflow error: syntax error: invalid syntax
- How to Solve Python WARNING: Ignoring invalid distribution -ip (e:\python\python_dowmload\lib\site-packages)
- Invalid python sd, Fatal Python error: init_fs_encoding: failed to get the Python cod [How to Solve]
- Python Error: SyntaxError: ‘break‘ outside loop
- Python Post kafka Messages Error: [Error 10] MessageSizeTooLargeError
- Python Error: SyntaxError: (unicode error) ‘unicodeescape‘ codec can‘t decode bytes in position 2-3:
- [Solved] Python sqlite3.OperationalError: near “?“: syntax error
- Python Pandas Typeerror: invalid type comparison
- Python_Syntax error: unexpected character after line continuation character
- Python Use sqlalchemy Error: pymssql.ProgrammingError: (102, b“Incorrect syntax near ‘(‘.DB-Lib error
- [Solved] TVM operate error: TVMError: AssertionError
- [Solved] Python WARNING: Ignoring invalid distribution -umpy
- Python Error: bash syntax error near unexpected token `newline’
- Python Error: ValueError: invalid literal for int() with base 16: ‘ ‘
- [Solved] NPM install Error: check python checking for Python executable python2 in the PATH