description
hello guys I have a python project with the following import statement the project used to work just fine but after sometime
the following line of code
from moviepy.editor import concatenate_videoclips, VideoFileClip
causes below error, when this line is commented the error disappears and everything just continues to work but I need to import those to for my application to do it's job but when this is present the error appears and the application halts.
error
Traceback (most recent call last):
File "C:\Users\mohamed\.pyenv\pyenv-win\versions\3.8.10\lib\tokenize.py", line 330, in find_cookie
line_string = line.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x90 in position 2: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ".\gui1.0.py", line 10, in <module>
from gui.infoarea import InfoArea
File "D:\Learning\practical applications\safe2watch\gui\infoarea\__init__.py", line 12, in <module>
from gui.services import FileProcessingService
File "D:\Learning\practical applications\safe2watch\gui\services\__init__.py", line 4, in <module>
from safe2watch.pipeline import run_pipeline
File "D:\Learning\practical applications\safe2watch\safe2watch\__init__.py", line 9, in <module>
from .pipeline import run_pipeline
File "D:\Learning\practical applications\safe2watch\safe2watch\pipeline\__init__.py", line 16, in <module>
from moviepy.editor import concatenate_videoclips #, VideoFileClip
File "D:\Learning\practical applications\safe2watch\env\lib\site-packages\moviepy\editor.py", line 36, in <module>
from .video.io.VideoFileClip import VideoFileClip
File "D:\Learning\practical applications\safe2watch\env\lib\site-packages\moviepy\video\io\VideoFileClip.py", line 3, in <module>
from moviepy.audio.io.AudioFileClip import AudioFileClip
File "D:\Learning\practical applications\safe2watch\env\lib\site-packages\moviepy\audio\io\AudioFileClip.py", line 3, in <module>
from moviepy.audio.AudioClip import AudioClip
File "D:\Learning\practical applications\safe2watch\env\lib\site-packages\moviepy\audio\AudioClip.py", line 7, in <module>
from moviepy.audio.io.ffmpeg_audiowriter import ffmpeg_audiowrite
File "D:\Learning\practical applications\safe2watch\env\lib\site-packages\moviepy\audio\io\ffmpeg_audiowriter.py", line 7, in <module>
from moviepy.config import get_setting
File "D:\Learning\practical applications\safe2watch\env\lib\site-packages\moviepy\config.py", line 35, in <module>
from imageio.plugins.ffmpeg import get_exe
File "D:\Learning\practical applications\safe2watch\env\lib\site-packages\imageio\plugins\ffmpeg.py", line 136, in <module>
import imageio_ffmpeg
File "D:\Learning\practical applications\safe2watch\env\lib\site-packages\imageio_ffmpeg\__init__.py", line 7, in <module>
from ._utils import get_ffmpeg_exe, get_ffmpeg_version
File "D:\Learning\practical applications\safe2watch\env\lib\site-packages\imageio_ffmpeg\_utils.py", line 5, in <module>
from pkg_resources import resource_filename
File "D:\Learning\practical applications\safe2watch\env\lib\site-packages\pkg_resources\__init__.py", line 74, in <module>
from pkg_resources.extern import appdirs
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 657, in _load_unlocked
File "<frozen importlib._bootstrap>", line 556, in module_from_spec
File "D:\Learning\practical applications\safe2watch\env\lib\site-packages\pkg_resources\extern\__init__.py", line 52, in create_module
return self.load_module(spec.name)
File "D:\Learning\practical applications\safe2watch\env\lib\site-packages\pkg_resources\extern\__init__.py", line 37, in load_module
__import__(extant)
File "D:\Learning\practical applications\safe2watch\env\lib\site-packages\pkg_resources\_vendor\appdirs.py", line 560, in <module>
import win32com.shell
File "D:\Learning\practical applications\safe2watch\env\lib\site-packages\win32com\__init__.py", line 6, in <module>
import pythoncom
File "D:\Learning\practical applications\safe2watch\env\lib\site-packages\pythoncom.py", line 2, in <module>
import pywintypes
File "shibokensupport/signature/loader.py", line 61, in feature_imported
File "shibokensupport/feature.py", line 137, in feature_imported
File "shibokensupport/feature.py", line 148, in _mod_uses_pyside
File "C:\Users\mohamed\.pyenv\pyenv-win\versions\3.8.10\lib\inspect.py", line 997, in getsource
lines, lnum = getsourcelines(object)
File "C:\Users\mohamed\.pyenv\pyenv-win\versions\3.8.10\lib\inspect.py", line 979, in getsourcelines
lines, lnum = findsource(object)
File "C:\Users\mohamed\.pyenv\pyenv-win\versions\3.8.10\lib\inspect.py", line 794, in findsource
lines = linecache.getlines(file, module.__dict__)
File "C:\Users\mohamed\.pyenv\pyenv-win\versions\3.8.10\lib\linecache.py", line 47, in getlines
return updatecache(filename, module_globals)
File "C:\Users\mohamed\.pyenv\pyenv-win\versions\3.8.10\lib\linecache.py", line 136, in updatecache
with tokenize.open(fullname) as fp:
File "C:\Users\mohamed\.pyenv\pyenv-win\versions\3.8.10\lib\tokenize.py", line 394, in open
encoding, lines = detect_encoding(buffer.readline)
File "C:\Users\mohamed\.pyenv\pyenv-win\versions\3.8.10\lib\tokenize.py", line 371, in detect_encoding
encoding = find_cookie(first)
File "C:\Users\mohamed\.pyenv\pyenv-win\versions\3.8.10\lib\tokenize.py", line 335, in find_cookie
raise SyntaxError(msg)
SyntaxError: invalid or missing encoding declaration for 'D:\\Learning\\practical applications\\safe2watch\\env\\lib\\site-packages\\pywin32_system32\\pywintypes38.dll'
I have the following requirements file, and I have these requirements installed in a python virtual environment.
altgraph==0.17.3
asttokens==2.0.8
autopep8==1.7.0
backcall==0.2.0
certifi==2022.9.24
charset-normalizer==2.1.1
colorama==0.4.6
coloredlogs==15.0.1
contourpy==1.0.5
cycler==0.11.0
debugpy==1.6.3
decorator==4.4.2
docopt==0.6.2
entrypoints==0.4
executing==1.1.1
ffmpeg==1.4
flake8==6.0.0
flatbuffers==22.9.24
fonttools==4.37.4
future==0.18.3
greenlet==2.0.2
humanfriendly==10.0
idna==3.4
imageio==2.22.1
imageio-ffmpeg==0.4.7
ipykernel==6.16.0
ipython==8.5.0
iso8601==1.1.0
jedi==0.18.1
jupyter-client==7.3.5
jupyter-core==4.11.1
kiwisolver==1.4.4
MarkupSafe==2.1.2
matplotlib==3.6.1
matplotlib-inline==0.1.6
mccabe==0.7.0
moviepy==1.0.3
mpmath==1.2.1
nest-asyncio==1.5.6
networkx==2.8.7
numpy==1.23.3
onnxruntime==1.12.1
opencv-python==4.6.0.66
opencv-python-headless==4.6.0.66
packaging==21.3
pandas==1.5.0
parso==0.8.3
pefile==2022.5.30
pexpect==4.8.0
pickleshare==0.7.5
Pillow==9.2.0
proglog==0.1.10
progressbar2==4.0.0
prompt-toolkit==3.0.31
protobuf==4.21.7
psutil==5.9.2
ptyprocess==0.7.0
pure-eval==0.2.2
pycodestyle==2.10.0
pydload==1.0.9
pyflakes==3.0.1
Pygments==2.13.0
pyinstaller==5.7.0
pyinstaller-hooks-contrib==2022.14
pyparsing==3.0.9
pyreadline3==3.4.1
PySide6==6.4.2
PySide6-Addons==6.4.2
PySide6-Essentials==6.4.2
python-dateutil==2.8.2
python-utils==3.3.3
pytz==2022.4
PyWavelets==1.4.1
pywin32==305
pywin32-ctypes==0.2.0
pyzmq==24.0.1
requests==2.28.1
scikit-image==0.19.3
scipy==1.9.2
shiboken6==6.4.2
simplejson==3.18.3
six==1.16.0
SQLAlchemy==2.0.4
stack-data==0.5.1
sympy==1.11.1
tifffile==2022.8.12
toml==0.10.2
tornado==6.2
tqdm==4.64.1
traitlets==5.4.0
typing-extensions==4.5.0
urllib3==1.26.12
uuid==1.30
wcwidth==0.2.5
WebOb==1.8.7
Werkzeug==2.2.3