Language Translation using Python - python-2.7

I used to use GoogleTrans but this has stopped working with this error
AttributeError: 'NoneType' object has no attribute 'group'
I then found this article googletrans stopped working with error 'NoneType' object has no attribute 'group'
I then tried to use the version by running pip install googletrans==3.1.0a0
However, as I am using Python 2.7 it does not seem to work. I am writing an Agent for Plex and therefore, I am tied in with Python 2.7..
Does anyone know of any translation libraries that still work with Python 2.7??

Have you tried installing google-cloud-translate==2.0.1?
See here under "Deprecated Python Versions"
https://pypi.org/project/google-cloud-translate/

I ended up using this library - free to use and no need to register for a licence or key....
https://pypi.org/project/doodle-translate/
to install
pip install doodle-translate

Related

AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'

I have been getting this error anytime i run my project with (runserver_plus --cert-file cert.crt)...I already installed the django extensions and pyOpenSSL
I tried running without the (--cert-file cert.crt), that one seems to work fine buh doesnt provide me with what I am looking for .
You can try to downgrade the cryptography lib:
pip install --force-reinstall "cryptography==38.0.4"
Seems to be a temporary bug, fixed, but pending to release: https://github.com/aws/aws-sam-cli/issues/4527#issuecomment-1368871248

how do i fix "No module named 'win32api'" on python2.7

I am trying to import win32api in python 2.7.9. i did the "pip install pypiwin32" and made sure all the files were intalled correctly (i have the win32api.pyd under ${PYTHON_HOME}\Lib\site-packages\win32). i also tried coping the files from C:\Python27\Lib\site-packages\pywin32_system32 to C:\Python27\Lib\site-packages\win32. I also tried restarting my pc after each of these steps but nothing seems to work! i still get the error 'No module named 'win32api''
Well, turns out the answer is upgrading my python to 3.6.
python 2.7 seems to old to work with outside imports (I'm just guessing here, because its not the first time I'm having an import problem)
hope it helps :)

Module object has no attribute SQLStorageAdapter

While running django chatterbot app, i encounter an error
module' object has no attribute 'SQLStorageAdapter'
I define chatbot the following way in my view.
chatbot = ChatBot(
"SQLMemoryTerminal",
storage_adapter='chatterbot.storage.SQLStorageAdapter',
logic_adapters=[
"chatterbot.logic.MathematicalEvaluation",
"chatterbot.logic.TimeLogicAdapter",
"chatterbot.logic.BestMatch"
],
input_adapter="chatterbot.input.TerminalAdapter",
output_adapter="chatterbot.output.TerminalAdapter",
)
Can anybody tell me why I am getting this error? Should I need any extra library or something like that? Thanks.
I think you were using very old version of chatterbot, you could try to upgrade to latest version by using.
pip install --upgrade chatterbot
Instead SQLStorageAdapter I recommended to use Mongo-DB as your storage adapter.
For more information fallow this link http://chatterbot.readthedocs.io/en/stable/storage/index.html#mongodb-storage-adapter

Using Point Cloud Library in Python

Hello I am trying to use Point Cloud Library in Python and as I am new to this C++ library and Python I am following the tutorial on http://strawlab.github.io/python-pcl/#pcl.PointCloud
However whenever I try to import pcl and define a module such as pcl.PointCloud() I get the following error;
AttributeError: 'module' object has no attribute 'PointCloud'
I have used sys.path.append to point to the correct directory where the PCL files have been installed as they are not in site packages. It says on the above link that the C++ code has already got Python bindings but I am unsure exactly what files I am trying to call in Python. Does anybody know how to overcome this error and load these modules?
Thanks,
Andrew
Try this,
sudo add-apt-repository ppa:sweptlaser/python3-pcl
sudo apt update
sudo apt install python3-pcl
After you've done that then you should be able to run:
python3 -c 'import pcl'
and it will return with no error (as opposed to ModuleNotFoundError: No module named 'pcl').
Tested on:
Ubuntu 18.04 LTS
Python 3.6.9
Reference: https://askubuntu.com/a/1170661/922137
Try skipping the parentheses:
from pcl import PointCloud
And then create an instance of PointCloud, for example, p:
p = PointCloud()
Hope it helps!
Looks like you need PCL 1.5.1 and cython 0.16 according to this page: http://strawlab.github.io/python-pcl/
"""https://blog.pollithy.com/python/numpy/pointcloud/tutorial-pypcd"""
python3.6 -m pip install --user git+https://github.com/DanielPollithy/pypcd.git

AttributeError: 'ElasticSearch' object has no attribute 'bulk_index'"

When I try python manage.py rebuild_index, error occur:
self.conn.bulk_index(self.index_name, 'modelresult', prepped_docs, id_field=ID)
AttributeError: 'ElasticSearch' object has no attribute 'bulk_index'
I found the link https://github.com/toastdriven/pyelasticsearch/blob/master/pyelasticsearch.py#L424-469 with pyelasticsearch.py, and I dont know which edition it is. Anyway there is bulk_index in that code, buy my pyelasticsearch.py is not.
Anyone has the same experience? thanks for ur time.
Plus:
django-haystack 2.0.0.beta, pyelasticsearch 0.0.6
Django-haystack will NOT work with original pyelasticsearch. You need to use toastdrivens' fork instead: https://github.com/toastdriven/pyelasticsearch
If you use pip, just type:
pip uninstall pyelasticsearch
pip install git+git://github.com/toastdriven/pyelasticsearch.git