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
  Open/save file on Android frohr 0 281 Jan-24-2024, 06:28 PM
Last Post: frohr
  KivyMD android app - problem with permission polak7gt 0 248 Jan-18-2024, 01:27 PM
Last Post: polak7gt
  file open "file not found error" shanoger 8 946 Dec-14-2023, 08:03 AM
Last Post: shanoger
  Potential Permission error on Mac OSX Catalina OWOLLC 1 644 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 805 Aug-14-2023, 05:04 PM
Last Post: snippsat
  logging: change log file permission with RotatingFileHandler erg 0 959 Aug-09-2023, 01:24 PM
Last Post: erg
  The INSERT permission was denied on the object Steven5055 2 1,426 Feb-25-2023, 11:37 PM
Last Post: Steven5055
  I cannot able open a file in python ? ted 5 3,050 Feb-11-2023, 02:38 AM
Last Post: ted
  testing an open file Skaperen 7 1,309 Dec-20-2022, 02:19 AM
Last Post: Skaperen
  access is denied error 5 for network drive mapping ? ahmedbarbary 2 1,731 Aug-17-2022, 10:09 PM
Last Post: ahmedbarbary

Forum Jump:

User Panel Messages

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