I'm trying to write a program that allows user to open notepad as one of its functions. However, when trying to open an already-made text file, I got error:
[File path]
You do not have permission to open this file. See the owner of the file or an administrator to obtain permission.
The code I'm using is this:
if not os.path.exists(location):
os.makedirs(location)
os.system("start notepad " + location)
I have created a text file if it doesn't already exist notepad would ask anyways, so I just want to take a step out for the user.
I know the location exists because when I checked it, the file I wish to create existed there, so I know the issue is with the os.system() command.
I found this: Failing to open a file using os.system(), as stack recommended it to me while writing this question, but it doesn't really answer my question.
Edit 1: I'm one windows 10.
Edit 2: I need to be able to run this piece of code from another python file, so I cannot run this script as an administrator in command line.
Edit 3: This question was marked as a duplicate to How to run python script with elevated privilege on windows, but even if I run my script as ADMIN (right clicking it, selecting "Run as administrator", it still brings up that error.
The file location is: E:\System Files\Logs\Logs[Date].txt, where date is the current date formatted in yyyy-mm-dd