'PosixPath' object has no attribute 'with_stem'

Viewed 33

My code used to work as is but now I'm facing this problem: 'PosixPath' object has no attribute 'with_stem'

def crowd_vid(vid_path, Area):
  vid = cv2.VideoCapture(vid_path)
  try:
      # creating a folder named data
      if not os.path.exists('data'):
          os.makedirs('data')
  # if not created then raise error
  except OSError:
      print('Error: Creating directory of data')
  # frame
  currentframe = 0
  while (True):
      # reading from frame
      success, frame = vid.read()
      if success:
          # continue creating images until video remains
          name = './data/frame' + str(currentframe) + '.jpg'
          # writing the extracted images
          cv2.imwrite(name, frame)
          # increasing counter so that it will
          # show how many frames are created
          currentframe += 1
0 Answers
Related