简体   繁体   English

尝试在 python 中运行脚本时出现权限错误

[英]Permissions Error when trying to run a script in python

I am trying to run a script in python and I got this error:我正在尝试在 python 中运行脚本,但出现此错误:

PermissionError: [Errno 13] Permission denied: 'E:\\Projects\\Abusive Comments Filter\\zest.txt'

main.py主文件

import re
import tkinter as tk
import subprocess
import urllib.request
from inscriptis import get_text

import os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
path1 = os.path.join(BASE_DIR,'Abusive-Comments-Filter-master/zest.txt')

# url = input("Enter URL\n")
url = "https://www.quora.com/What-are-all-the-bad-words-and-their-meanings"
html = urllib.request.urlopen(url).read().decode('utf-8')

text = get_text(html)
path = r'path1'
# path = ''
file = open(path, 'w')
file.write(text)
file.close()

How can i fix this please.请问我该如何解决这个问题。

Close the file zest.txt if it is open in your text editor or any other program.如果在您的文本编辑器或任何其他程序中打开了文件zest.txt ,请关闭它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM