Error when importingPython-vlc - python

I have installed python-vlc
D:\Programing\Python\Python 3.6>python -m pip install python-vlc
Requirement already satisfied: python-vlc in d:\programing\python\python 3.6\lib\site-packages\python_vlc-1.1.2-py3.6.egg
When I import the module in idle I get this error
>>> import vlc
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import vlc
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 646, in _load_unlocked
File "<frozen importlib._bootstrap>", line 616, in _load_backward_compatible
File "D:\Programing\Python\Python 3.6\lib\site-packages\python_vlc-1.1.2-py3.6.egg\vlc.py", line 181, in <module>
dll, plugin_path = find_lib()
File "D:\Programing\Python\Python 3.6\lib\site-packages\python_vlc-1.1.2-py3.6.egg\vlc.py", line 156, in find_lib
dll = ctypes.CDLL(libname)
File "D:\Programing\Python\Python 3.6\lib\ctypes\__init__.py", line 344, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found
I am running Python 3.6.0 in windows 10 64x

If you have 64bit python, you need 64bit vlc player. If you have 32bit python, you need 32bit vlc version.

Try the command "pip install vlc" in the CMD. If that doesn't work, then try "pip install python-vlc"

Related

AioHttp Installation: multidict module error

I tried installing the AioHttp package, as seen in the extract below. The installation failed with the multidict module.
root#ava:/home/cliquant/server/ava# pip3 install aiohttp
Collecting aiohttp
Using cached https://files.pythonhosted.org/packages/ff/4f/62d9859b7d4e6dc32feda67815c5f5ab4421e6909e48cbc970b6a40d60b7/aiohttp-3.8.3.tar.gz
Complete output from command python setup.py egg_info:
*********************
* Accelerated build *
*********************
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-0b29nbfp/aiohttp/setup.py", line 54, in <module>
setup(**setup_kwargs)
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.6/distutils/core.py", line 121, in setup
dist.parse_config_files()
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 494, in parse_config_files
ignore_option_errors=ignore_option_errors)
File "/usr/lib/python3/dist-packages/setuptools/config.py", line 106, in parse_configuration
meta.parse()
File "/usr/lib/python3/dist-packages/setuptools/config.py", line 382, in parse
section_parser_method(section_options)
File "/usr/lib/python3/dist-packages/setuptools/config.py", line 355, in parse_section
self[name] = value
File "/usr/lib/python3/dist-packages/setuptools/config.py", line 173, in __setitem__
value = parser(value)
File "/usr/lib/python3/dist-packages/setuptools/config.py", line 430, in _parse_version
version = self._parse_attr(value)
File "/usr/lib/python3/dist-packages/setuptools/config.py", line 305, in _parse_attr
module = import_module(module_name)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/tmp/pip-build-0b29nbfp/aiohttp/aiohttp/__init__.py", line 5, in <module>
from . import hdrs as hdrs
File "/tmp/pip-build-0b29nbfp/aiohttp/aiohttp/hdrs.py", line 8, in <module>
from multidict import istr
ModuleNotFoundError: No module named 'multidict'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-0b29nbfp/aiohttp/`
I got error when installing aiohttp with pip3.
How can I fix this?
NB: I can't find in google about it...
Google came to your aid narrowing down on the ModuleNotFoundError: No module named 'multidict'
To resolve, install the multidict module.
python3 -m pip install multidict or
pip3 install multidict
See this GitHub issue #277, and
this SO question
[Edit] For completeness, ensure you are installing in the correct environment env.
Also, check the version(s) of python installed on the system.

I have a problem with pyttx3. what should i do? [duplicate]

This question already has answers here:
python text to speech using pyttsx
(3 answers)
Closed 1 year ago.
Ubuntu is installed on my laptop.
import pyttsx3
engine=pyttsx3.init()
engine.say('Sa1lly sells seashells by the seashore.')
/usr/bin/python3 /home/shohruz/Desktop/Development/solo.py
Traceback (most recent call last):
File "/home/shohruz/.local/lib/python3.8/site-packages/pyttsx3/__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "/usr/lib/python3.8/weakref.py", line 131, in __getitem__
o = self.data[key]()
KeyError: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/shohruz/Desktop/Development/solo.py", line 2, in <module>
engine=pyttsx3.init()
File "/home/shohruz/.local/lib/python3.8/site-packages/pyttsx3/__init__.py", line 22, in init
eng = Engine(driverName, debug)
File "/home/shohruz/.local/lib/python3.8/site-packages/pyttsx3/engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "/home/shohruz/.local/lib/python3.8/site-packages/pyttsx3/driver.py", line 50, in __init__
self._module = importlib.import_module(name)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/shohruz/.local/lib/python3.8/site-packages/pyttsx3/drivers/espeak.py", line 9, in <module>
from . import _espeak, toUtf8, fromUtf8
File "/home/shohruz/.local/lib/python3.8/site-packages/pyttsx3/drivers/_espeak.py", line 18, in <module>
dll = cdll.LoadLibrary('libespeak.so.1')
File "/usr/lib/python3.8/ctypes/__init__.py", line 451, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python3.8/ctypes/__init__.py", line 373, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libespeak.so.1: cannot open shared object file: No such file or directory
1.That is the problem. Please help me...
I have installed pyttx3 with sudo pip install pyttsx3 command.
I have installed both 2 versions of pyttsx. pyttsx and pyttsx3. But when i changed pyttsx3 to pyttsx the "no module named 'engine'" error will appear.
import pyttsx3
engine = pyttsx3.init()
engine.say("Sa1lly sells seashells by the seashore")
engine.runAndWait()
This is under windows but should not make any difference
or try this it works on my site
Version used:
Python 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32

I can't run a small script due to Foundation not being recognised

I am a new python programmer and was testing out pyttsx3, I am trying to use nsss. However when I run the following code
import pyttsx3
engine=pyttsx3.init('nsss')
engine.say ("Top of the morning")
# angine=pyttsx3.init()
# angine.say("Why hello there")
# angine.runAndWait()
It says error Foundation module not found, so I installed it with pip install foundation. This installs foundation and django version 1.10.8 which to my understanding is not compatible with python v 3.9. But when I install Django version 3.1.7, that version is not compatible with Foundation.
The error logs are below
C:\Users\Ahmed_Abdelmuniem\AppData\Local\Programs\Python\Python39\python.exe "C:/Users/Ahmed_Abdelmuniem/PycharmProjects/AI Engine/main.py"
Traceback (most recent call last):
File "C:\Users\Ahmed_Abdelmuniem\AppData\Local\Programs\Python\Python39\lib\site-packages\pyttsx3\__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "C:\Users\Ahmed_Abdelmuniem\AppData\Local\Programs\Python\Python39\lib\weakref.py", line 134, in __getitem__
o = self.data[key]()
KeyError: 'nsss'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Ahmed_Abdelmuniem\PycharmProjects\AI Engine\main.py", line 3, in <module>
engine=pyttsx3.init('nsss')
File "C:\Users\Ahmed_Abdelmuniem\AppData\Local\Programs\Python\Python39\lib\site-packages\pyttsx3\__init__.py", line 22, in init
eng = Engine(driverName, debug)
File "C:\Users\Ahmed_Abdelmuniem\AppData\Local\Programs\Python\Python39\lib\site-packages\pyttsx3\engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "C:\Users\Ahmed_Abdelmuniem\AppData\Local\Programs\Python\Python39\lib\site-packages\pyttsx3\driver.py", line 50, in __init__
self._module = importlib.import_module(name)
File "C:\Users\Ahmed_Abdelmuniem\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:\Users\Ahmed_Abdelmuniem\AppData\Local\Programs\Python\Python39\lib\site-packages\pyttsx3\drivers\nsss.py", line 2, in <module>
from Foundation import *
ModuleNotFoundError: No module named 'Foundation'
Process finished with exit code 1
install the necessary libraries and run in separate virtual environment
sudo apt-get install python-espeak
sudo apt-get update && sudo apt-get install espeak
using python3.9 with virtual environment,
python3.9 -m venv env
source env/bin/activate
pip install pyttsx3
now running the below demo code should work.
import pyttsx3
engine = pyttsx3.init()
engine.say("I will speak this text")
engine.runAndWait()

NameError: name 'defaultParams' is not defined while running the .exe converted using Pyinstaller

I successfully converted the main.py script using pyinstaller. However the below stated error is thrown while executing the .exe file for the same.
MatplotlibDeprecationWarning: Matplotlib installs where the data is not in the mpl-data subdirectory of the package are deprecated since 3.2 and support for them will be removed two minor releases later.
exec(bytecode, module.__dict__)
Traceback (most recent call last):
File "main.py", line 8, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "c:\users\XXXX\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
exec(bytecode, module.__dict__)
File "matplotlib\__init__.py", line 898, in <module>
File "matplotlib\cbook\__init__.py", line 480, in _get_data_path
File "matplotlib\__init__.py", line 239, in wrapper
File "matplotlib\__init__.py", line 534, in get_data_path
File "matplotlib\__init__.py", line 239, in wrapper
File "matplotlib\__init__.py", line 563, in _get_data_path
NameError: name 'defaultParams' is not defined
Supposedly, all you can do to fix this is to downgrade your matplotlib to the version:
pip install matplotlib==3.2.2
Apparently, the latest version of matplotlib meddles with the environment variable in the windows path.

Python / PIP broken on Ubuntu 16.04

I think my Python / PIP environment on a Ubuntu 16.04 machine is broken. I just want to install a program using PIP using this command:
pip3 install --user ocrmypdf
But it doesn't work. When running
pip3 --version
I get this error:
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 7, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 59, in <module>
from pip.log import logger
File "/usr/lib/python3/dist-packages/pip/log.py", line 9, in <module>
import colorama, pkg_resources
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/usr/share/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py", line 1479, in <module>
register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
Python itself seems to work:
root#host /usr/lib # python -V
Python 3.6.3

Categories