Python gprc AttributeError: 'NoneType' object has no attribute 'message_types_by_name' - grpc-python

I just want to complete a simple demo, but I got this error message.
Traceback (most recent call last):
File "E:/grpc/biliService.py", line 10, in <module>
import hello_bilibili_pb2 as pb2
File "E:\grpc\hello_bilibili_pb2.py", line 21, in <module>
_HELLODEWEIREQ = DESCRIPTOR.message_types_by_name['HelloDeweiReq']
AttributeError: 'NoneType' object has no attribute 'message_types_by_name'

grpcio==1.30.0
grpcio-tools==1.30.0
The latest grpcio version 1.44.0 generate incompatible pb2 files, so I've seen the same question, I downgrade grpcio 1.30.0, and it worked.

Related

Pyueye IDS Camera

I am working with IDS camera and they have a python module called pyueye. I installed it using pip, but it seems like the dll are missing:
Traceback (most recent call last):
File "/home/bikram/.local/lib/python3.8/site-packages/pyueye/dll.py", line 166, in load_dll
dll = DLL(libinfo, libnames, os.getenv(envname))
File "/home/bikram/.local/lib/python3.8/site-packages/pyueye/dll.py", line 96, in __init__
raise RuntimeError("could not find any library for {} ({})".format(libinfo, dllmsg))
RuntimeError: could not find any library for ueye_api (DLL_PATH: unset)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/bikram/Documents/uEye/1.py", line 1, in <module>
from pyueye import ueye
File "/home/bikram/.local/lib/python3.8/site-packages/pyueye/__init__.py", line 56, in <module>
from . import ueye
File "/home/bikram/.local/lib/python3.8/site-packages/pyueye/ueye.py", line 58, in <module>
get_dll_file, _bind = load_dll("ueye_api", ["ueye_api_64", "ueye_api"], "PYUEYE_DLL_PATH")
File "/home/bikram/.local/lib/python3.8/site-packages/pyueye/dll.py", line 168, in load_dll
raise ImportError(exc)
ImportError: could not find any library for ueye_api (DLL_PATH: unset)
I noticed someone else had the same issue in windows.
Does anyone else have the same issue using pyeue?
I had same issue but then I downloaded IDS Software Suite from https://en.ids-imaging.com/
Installed it and everything worked. Give it a try.
It will also let you configure their camera from IDS Camera Manager before you use it from Python.

Why do I get an error message although I have installed thonny sqlite3 correctly

I want to use thonny sqlite3. I am installing sqlite3 module with Thonny Manage Packages.But after typing import sqlite3, when I want to run it in this state, it gives the following error message:
File "<stdin>", line 3, in <module>
File "/lib/sqlite3.py", line 11, in <module>
AttributeError: 'NoneType' object has no attribute 'func'
Thank for your help.

Spyder not working after installation of other packages

In summary: as far as I recall, after conda-installing fenics and sfepy (along with, through pip, some dependencies), I cannot run spyder:
$ spyder
Traceback (most recent call last):
File "/home/charles/anaconda3/lib/python3.5/site-packages/qtpy/QtWebEngineWidgets.py", line 22, in
from PyQt5.QtWebEngineWidgets import QWebEnginePage
ImportError: No module named 'PyQt5.QtWebEngineWidgets'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/charles/anaconda3/bin/spyder", line 6, in
sys.exit(spyder.app.start.main())
File "/home/charles/anaconda3/lib/python3.5/site-packages/spyder/app/start.py", line 103, in main
from spyder.app import mainwindow
File "/home/charles/anaconda3/lib/python3.5/site-packages/spyder/app/mainwindow.py", line 92, in
from qtpy import QtWebEngineWidgets # analysis:ignore
File "/home/charles/anaconda3/lib/python3.5/site-packages/qtpy/QtWebEngineWidgets.py", line 26, in
from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage
ImportError: /usr/lib/x86_64-linux-gnu/libQt5WebKitWidgets.so.5: version `Qt_5' not found (required by /home/charles/anaconda3/lib/python3.5/site-packages/PyQt5/QtWebKitWidgets.so)
Along the method of
https://www.scivision.co/fix-spyder-cxxabi-not-found-qt-error/
Would it be a terrible idea to simply copy
/usr/lib/x86_64-linux-gnu/libQt5WebKitWidgets.so.5
to
~/anaconda3/lib/
a la
cp /usr/lib/x86_64-linux-gnu/libQt5WebKitWidgets.so.5 ~/anaconda3/lib/
?
I'm paranoid about breaking something, is there a high probability of that happening?
Surely there's a better way to do this, no?
Thanks!

Python3 decode doesn't work on mac

I wrote this code:
'\xe4\xf6\xfc'.decode('latin1')
but I got this:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute 'decode'
I am using python 3.4 and I am using python on mac.
Because the string type does not support the .decode() method in Python 3. Simply prefix your string with b, which turns it into the bytes type:
>>> b'\xe4\xf6\xfc'.decode('latin1')
'äöü'

cx_freeze error with pyodbc

if you have a simple program name pyodbcTest.py
import pyodbc
print "pass"
and then use cx_freeze to compile it
cxfreeze --targe-dir=cxTest pyodbcTest.py
and then run that program it throws the following error.
C:\temp\pythonWork\cxTest>pyodbcTest.exe
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27, in <module>
exec code in m.__dict__
File "pyodbcTest.py", line 1, in <module>
RuntimeError: Unable to import decimal
Any ideas?
I had to add the option --include-module decimal to solve the problem. Not sure why it could not find that one on its own during the freeze process, but its working now

Resources