Python Forum
Newly written .txt file not printing
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newly written .txt file not printing
#8
(Oct-16-2017, 11:21 AM)gruntfutuk Wrote: Your first print does not work because your position in the file is already past the content you wrote.

You need a text_file.seek(0) before the print.

Of course, wouldn't I have to print it after I write it? I can't print anything before I've written it because there would be nothing to print. Also it gave me an error when I tried to print it after closing the file...
text_file.seek(0) wasn't used in any part of this and it still printed after the last write command so why would that be necessary?
Please understand that I'm not trying to argue with those that I've asked for help from, but that makes no sense to me and I'm trying to understand. :D

(Oct-16-2017, 11:53 AM)buran Wrote: I don't see the point to post 26 lines of irrelevant code.
Also, if you closed the file, how do you expect to be able to read/write without opening it again. Same as to open a door, pass trough it, close the door behind you and then trying to pass trough it again, without opening it againĀ  :-)

Both of the new print commands that I added in an attempt to print out the newly written lines before they were actually overwritten, were added after opening the file and before closing it again. If you look at the code again you should see that the same file is opened and closed 3 different times. So thank you for your reply but I don't think you understood my question. Smile
Quote:If you can't learn to do something well?... Learn to enjoy doing it poorly.
Reply


Messages In This Thread
Newly written .txt file not printing - by Crackity - Oct-16-2017, 06:23 AM
RE: Newly written .txt file not printing - by buran - Oct-16-2017, 07:11 AM
RE: Newly written .txt file not printing - by Crackity - Oct-20-2017, 04:19 AM
RE: Newly written .txt file not printing - by buran - Oct-16-2017, 11:53 AM
RE: Newly written .txt file not printing - by buran - Oct-16-2017, 12:36 PM
RE: Newly written .txt file not printing - by buran - Oct-20-2017, 06:21 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  My Loop for printing text file goes to infinity Nomex 7 4,411 Feb-10-2020, 03:13 PM
Last Post: buran
  Command line inputs not printing to Log File ijosefson 1 3,412 Oct-19-2017, 06:41 AM
Last Post: buran

Forum Jump:

User Panel Messages

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