Ahmadkhan12 commited on
Commit
d63323c
·
verified ·
1 Parent(s): 19c3053

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -1,14 +1,14 @@
1
  import os
2
  import sys
3
- from random import choice
4
 
5
  # Check if moviepy is installed; if not, install it
6
  try:
7
  from moviepy.editor import VideoFileClip, AudioFileClip
8
  except ImportError:
9
  print("MoviePy not found, attempting to install...")
10
- os.system("pip install moviepy")
11
- # Reload the environment to use the newly installed module
12
  try:
13
  from moviepy.editor import VideoFileClip, AudioFileClip
14
  except ImportError:
 
1
  import os
2
  import sys
3
+ import subprocess
4
 
5
  # Check if moviepy is installed; if not, install it
6
  try:
7
  from moviepy.editor import VideoFileClip, AudioFileClip
8
  except ImportError:
9
  print("MoviePy not found, attempting to install...")
10
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "moviepy"])
11
+ # Retry importing after installation
12
  try:
13
  from moviepy.editor import VideoFileClip, AudioFileClip
14
  except ImportError: