Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'groups' #15

Closed
mlinaje opened this issue Jul 17, 2020 · 4 comments · Fixed by #16
Closed

AttributeError: 'NoneType' object has no attribute 'groups' #15

mlinaje opened this issue Jul 17, 2020 · 4 comments · Fixed by #16

Comments

@mlinaje
Copy link

mlinaje commented Jul 17, 2020

Hi,
I'm having this problem while trying to use your code from the powershell in windows 10. I use python and I have installed unsilence for the CLI and as library.
I don't get the traceback as when error with other python programs occur. So, I used "-d" and I got:

File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1264.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1264.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\usuario2\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Scripts\unsilence.exe_main
.py", line 7, in
File "C:\Users\usuario2\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\unsilence\command_line\EntryPoint.py", line 20, in main
run()
File "C:\Users\usuario2\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\unsilence\command_line\EntryPoint.py", line 66, in run
continual = Unsilence(args.input_file)
File "C:\Users\usuario2\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\unsilence\Unsilence.py", line 27, in init
ffmpeg_version = get_ffmpeg_version()
File "C:\Users\usuario2\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\unsilence\lib\tools\ffmpeg_version.py", line 16, in get_ffmpeg_version
groups = match.groups()
AttributeError: 'NoneType' object has no attribute 'groups'

Thanks for your contribution. I'm currently using jumcutterv2 and auto-editor and it would be awesome to test your code against my set of teaching videos.

Best,

@lagmoellertim
Copy link
Owner

Hey, it seems like the ffmpeg version detector does not find a matching ffmpeg version.
Could you check if the ffmpeg version is >4.2.0 and that it is globally available?
If that doesn't fix the problem, could you send me the output of ffmpeg -version?

@mlinaje
Copy link
Author

mlinaje commented Jul 19, 2020

Thanks,
It's in the PATH (it's working and I checked it).
This is the output (I update it trying to make it work):

PS C:\Users\usuario2> ffmpeg -version
ffmpeg version git-2020-07-16-d11cc74 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.3.1 (GCC) 20200621
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 55.100 / 56. 55.100
libavcodec 58. 96.100 / 58. 96.100
libavformat 58. 48.100 / 58. 48.100
libavdevice 58. 11.101 / 58. 11.101
libavfilter 7. 87.100 / 7. 87.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100

Best,

@AtilioA
Copy link
Contributor

AtilioA commented Jul 19, 2020

Hey, it seems like the ffmpeg version detector does not find a matching ffmpeg version.
Could you check if the ffmpeg version is >4.2.0 and that it is globally available?
If that doesn't fix the problem, could you send me the output of ffmpeg -version?

@lagmoellertim This has to do with the regex. It doesn't properly parse FFmpeg's string. Now take a look at this one: https://regex101.com/r/lO6pxG/1
I'm using FFmpeg 3.7 and the regex couldn't match it, leading to the NoneType exception.

I'll be opening a PR to fix this.

lagmoellertim pushed a commit that referenced this issue Jul 19, 2020
Improve ffmpeg version parsing (Fixes #15)
@mlinaje
Copy link
Author

mlinaje commented Jul 21, 2020

I did a git fetch and reinstall it using pip install --ignore-installed .
but the same message appears in the commandline.
After the issue detected by @AtilioA (thanks!) I tried ffmpeg_version.py from the command line with the following output in the python console:


> >>> import subprocess
> >>> console_output = subprocess.run(
> ...             ["ffmpeg", "-version"],
> ...             stdout=subprocess.PIPE,
> ...             stderr=subprocess.STDOUT,
> ...         ).stdout
> >>> import re
> >>> regex = r"ffmpeg version \D?(\d+(?:\.\d+)*)"
> >>> match = re.search(regex, str(console_output))
> >>> groups = match.groups()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> AttributeError: 'NoneType' object has no attribute 'groups'

Recommended downloads of ffmpeg for windows are at https://ffmpeg.zeranoe.com/builds/ and default download is last git version. So, my version is: git-2020-07-16-d11cc74

Solution: I downloadade the lastest release (not git version, 4.3 at the moment) choosing it from the dropdown list top-left and reinstalled it. Now unsilence detects 4.3 version and it working. The output is:


> >>> version = groups[0].split(".")
> >>> print (version)
> ['4', '3']

I have just included this information for other Windows users with the same issues.
Best,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants