0

I am trying to run a script in python and I got this error:

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.

1 Answer 1

1

Close the file zest.txt if it is open in your text editor or any other program.

Sign up to request clarification or add additional context in comments.

7 Comments

which file please.
The file you are trying to access, zest.txt
the file doesn't exist there
Hi could you elaborate, are you trying to create a file or read it, could you post your code please
oh ok but then what did you mean when you said "the file doesn't exist there", you cannot read a file if it is not there and your python script cannot open the file if it is exists but is already open in another program.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.