Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
testing an open file
#5
(Dec-17-2022, 06:47 PM)Skaperen Wrote: what cases where it may not have a mode attribute?
When the (pseudo) file object was not opened by the function open(), for example
>>> import io
>>> f = io.StringIO()
>>> f.mode
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: '_io.StringIO' object has no attribute 'mode'
Reply


Messages In This Thread
testing an open file - by Skaperen - Dec-17-2022, 02:06 AM
RE: testing an open file - by Larz60+ - Dec-17-2022, 03:26 AM
RE: testing an open file - by Gribouillis - Dec-17-2022, 07:02 AM
RE: testing an open file - by Skaperen - Dec-17-2022, 06:47 PM
RE: testing an open file - by Gribouillis - Dec-17-2022, 09:00 PM
RE: testing an open file - by Skaperen - Dec-19-2022, 03:17 AM
RE: testing an open file - by Gribouillis - Dec-19-2022, 07:37 AM
RE: testing an open file - by Skaperen - Dec-20-2022, 02:19 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Open/save file on Android frohr 0 415 Jan-24-2024, 06:28 PM
Last Post: frohr
  file open "file not found error" shanoger 8 1,413 Dec-14-2023, 08:03 AM
Last Post: shanoger
  How can i combine these two functions so i only open the file once? cubangt 4 981 Aug-14-2023, 05:04 PM
Last Post: snippsat
  I cannot able open a file in python ? ted 5 3,826 Feb-11-2023, 02:38 AM
Last Post: ted
  I get an FileNotFouerror while try to open(file,"rt"). My goal is to replace str decoded 1 1,470 May-06-2022, 01:44 PM
Last Post: Larz60+
  Dynamic File Name to a shared folder with open command in python sjcsvatt 9 6,394 Jan-07-2022, 04:55 PM
Last Post: bowlofred
  Open an excel file Newbie1114 1 2,398 Jun-16-2021, 09:11 PM
Last Post: Gribouillis
  How to open MIDI-file and get events in a list? philipbergwerf 7 5,190 May-29-2021, 08:24 AM
Last Post: j.crater
  Error on open of file created with tempfile.TemporaryDirectory() Brian177 4 6,526 Apr-05-2021, 07:12 PM
Last Post: Brian177
  I can't open a python file :( Oshadha 2 3,070 Mar-28-2021, 11:00 PM
Last Post: pythonprogrammer1101935

Forum Jump:

User Panel Messages

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