Python Forum
iam getting problem that permission denied to open the file andprocess whileexecution
Thread Rating:
  • 3 Vote(s) - 2.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
iam getting problem that permission denied to open the file andprocess whileexecution
#1
import os,sys
sr=os.open("srinivas.txt",os.O_RDWR|os.O_CREAT)
line="this is test"
b=str.encode(line)
os.write(sr,b)
os.close(sr)
print("closed the function successfully")
Reply
#2
Why are you using os at all?

Just use open for opening a file, and "w" for the access type (instead of os constants).
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to open depracated joblib file mckennamason 0 691 Sep-19-2024, 03:30 PM
Last Post: mckennamason
  Circumvent the "access denied" page? Pedroski55 7 2,093 Jun-15-2024, 06:25 AM
Last Post: Pedroski55
  The INSERT permission was denied on the object Steven5055 3 2,927 Jun-12-2024, 08:13 AM
Last Post: GregoryConley
  Delete file with read-only permission, but write permission to parent folder cubei 6 25,275 Jun-01-2024, 07:22 AM
Last Post: Eleanorreo
  Open/save file on Android frohr 0 1,089 Jan-24-2024, 06:28 PM
Last Post: frohr
  KivyMD android app - problem with permission polak7gt 0 890 Jan-18-2024, 01:27 PM
Last Post: polak7gt
  file open "file not found error" shanoger 8 6,110 Dec-14-2023, 08:03 AM
Last Post: shanoger
  Potential Permission error on Mac OSX Catalina OWOLLC 1 1,762 Nov-02-2023, 07:52 AM
Last Post: unjnsacih
  How can i combine these two functions so i only open the file once? cubangt 4 1,901 Aug-14-2023, 05:04 PM
Last Post: snippsat
  logging: change log file permission with RotatingFileHandler erg 0 2,440 Aug-09-2023, 01:24 PM
Last Post: erg

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020