Skip to content Skip to sidebar Skip to footer

Reading Logfile And Opening Files In There

I'm having a problem reading a logfile I'm creating in another method. The logfile has file-paths of unzipped files in it (unpacking is in another function). The logfile looks kind

Solution 1:

You just need to strip the newline character so change

read_files = open(lines)

to

read_files = open(lines.strip())

as an observation - critical to read each character in an error message - the message was telling you that there was no file named

'/home/usr/Downloads/outdir/unpacked_files.log\n'

so it is useful to then try to understand why the \n showed up - this did not match your expectation of the file name so you should wonder why the file has that name

Post a Comment for "Reading Logfile And Opening Files In There"