Home > Mobile >  I am getting permission error to a folder when I try opening it with io.open
I am getting permission error to a folder when I try opening it with io.open

Time:12-08

I am trying to run this piece of code but I am getting a permission error. What solution do you suggest? Can I replace io.open with something else:

"""Detect labels given a file path."""
video_client = videointelligence.VideoIntelligenceServiceClient()
features = [videointelligence.Feature.LABEL_DETECTION]

cwd = "E:/.../Google_Video_API/videos/"
with io.open(cwd, "rb") as movie:
    input_content = movie.read()

operation = video_client.annotate_video(
    request={"features": features, "input_content": input_content}
)
print("\nProcessing video for label annotations:")

This is the error I get: PermissionError: [Errno 13] Permission denied: 'E:/.../Google_Video_API/videos/'

CodePudding user response:

There are a couple of problems:

  1. io.open expects a file not a directory; cwd looks to be a directory
  2. cwd = "E:/.../Google_Video_API/videos/" includes ..., is that correct?
  • Related