Skip to content

Commit b365bc6

Browse files
authored
Merge pull request #123 from coco3427/ch8code
fixes file not found errors in 8.4
2 parents f240409 + e8798bc commit b365bc6

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

source/ch8_filehandling.ptx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@
500500
with open("myfile.txt", "w") as my_writer:
501501
my_writer.write("File successfully updated!")
502502
print("File successfully written to.")
503-
except OSError as e:
503+
except OSError:
504504
print("An error occurred.")
505505
import traceback
506506
traceback.print_exc()
@@ -523,7 +523,7 @@
523523
public class WriteFile {
524524
public static void main(String[] args) {
525525
try {
526-
FileWriter myWriter = new FileWriter("myfile.txt");
526+
FileWriter myWriter = new FileWriter("newfile.txt");
527527
myWriter.write("File successfully updated!");
528528
myWriter.close();
529529
System.out.println("File successfully written to.");
@@ -570,7 +570,7 @@
570570
public class WriteFile {
571571
public static void main(String[] args) {
572572
try {
573-
FileWriter myWriter = new FileWriter("myfile.txt", true); // true enables append mode
573+
FileWriter myWriter = new FileWriter("newfile.txt", true); // true enables append mode
574574
myWriter.write("File successfully updated!");
575575
myWriter.close();
576576
System.out.println("File successfully written to.");
@@ -788,4 +788,4 @@
788788
</reading-questions>
789789
</section>
790790

791-
</chapter>
791+
</chapter>

0 commit comments

Comments
 (0)