Skip to content

Commit 11fb4d4

Browse files
committed
Print debug even if PyAV not installed
1 parent e0cc395 commit 11fb4d4

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

auto_editor/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "26.1.0"
1+
__version__ = "26.1.1"

auto_editor/__main__.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env python3
22

3+
import platform as plat
34
import re
45
import sys
56
from os import environ
67
from os.path import exists, isdir, isfile, lexists, splitext
78
from subprocess import run
89

910
import auto_editor
10-
from auto_editor.edit import edit_media
1111
from auto_editor.utils.func import get_stdout
1212
from auto_editor.utils.log import Log
1313
from auto_editor.utils.types import (
@@ -329,15 +329,17 @@ def main() -> None:
329329
return
330330

331331
if args.debug and not args.input:
332-
import platform as plat
332+
print(f"OS: {plat.system()} {plat.release()} {plat.machine().lower()}")
333+
print(f"Python: {plat.python_version()}")
333334

334-
import av
335+
try:
336+
import av
335337

336-
license = av._core.library_meta["libavcodec"]["license"]
338+
license = av._core.library_meta["libavcodec"]["license"]
339+
print(f"PyAV: {av.__version__} ({license})")
340+
except (ModuleNotFoundError, ImportError):
341+
print("PyAV: error")
337342

338-
print(f"OS: {plat.system()} {plat.release()} {plat.machine().lower()}")
339-
print(f"Python: {plat.python_version()}")
340-
print(f"PyAV: {av.__version__} ({license})")
341343
print(f"Auto-Editor: {auto_editor.__version__}")
342344
return
343345

@@ -363,6 +365,8 @@ def main() -> None:
363365
log.error(f"Option/Input file doesn't exist: {my_input}")
364366
paths.append(my_input)
365367

368+
from auto_editor.edit import edit_media
369+
366370
try:
367371
edit_media(paths, args, log)
368372
except KeyboardInterrupt:

auto_editor/utils/log.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
from shutil import get_terminal_size, rmtree
66
from tempfile import mkdtemp
77
from time import perf_counter, sleep
8-
from typing import NoReturn
8+
from typing import TYPE_CHECKING, NoReturn
99

10-
import av
10+
if TYPE_CHECKING:
11+
import av
1112

1213

1314
class Log:

0 commit comments

Comments
 (0)