PermissionError:权限被拒绝

我得到这个错误:

Exception in Tkinter callback Traceback (most recent call last): File "C:\Python34\lib\tkinter\__init__.py", line 1538, in __call__ return self.func(*args) File "C:/Users/Marc/Documents/Programmation/Python/Llamachat/Llamachat/Llamachat.py", line 32, in download with open(place_to_save, 'wb') as file: PermissionError: [Errno 13] Permission denied: '/goodbye.txt' 

运行这个时候:

 def download(): # get selected line index index = films_list.curselection()[0] # get the line's text selected_text = films_list.get(index) directory = filedialog.askdirectory(parent=root, title="Choose where to save your movie") place_to_save = directory + '/' + selected_text print(directory, selected_text, place_to_save) with open(place_to_save, 'wb') as file: connect.retrbinary('RETR ' + selected_text, file.write) tk.messagebox.showwarning('File downloaded', 'Your movie has been successfully downloaded!' '\nAnd saved where you asked us to save it!!') 

有人能告诉我我做错了什么吗? 谢谢

规格:Python 3.4.4 x86 Windows 10 x64

更改要保存的目录的权限,以便所有用户具有读取和写入权限。

由于在Windows中没有sudo命令我会建议:

  • C:\Windows\system32找到cmd.exe
  • 用鼠标右键单击它
  • 选择Run as Administrator
  • 然后它将打开目录C:\Windows\system32的命令提示符
  • 前往您的项目目录
  • 运行你的程序

通过这样做你是作为管理员运行,所以这个问题不应该持续下去