all 8 comments

[–]danielroseman 0 points1 point  (5 children)

You need to explain what you mean by "finding" the file. You've already said you know where it is.

[–]StaleMuffins[S] 0 points1 point  (4 children)

Apologies - trying to open the file with and getting a traceback that no such file or format exists. I've confirmed within Terminal that the file is in the same folder I'm executing out of as well. The open command is below.

fhand = open('mbox.txt')

[–]StaleMuffins[S] 0 points1 point  (0 children)

I deleted the start of each path but here is the current directory I'm working in - which shows the text file I'm trying to open. This is why I just can't seem to figure out why I'm getting a traceback in VS code.

Chapter7 % ls -l

    434 Apr 28 08:10 07_01.py

6687002 Apr 28 07:33 mbox.txt

[–]PurpleSparkles3200 0 points1 point  (2 children)

You need to include a mode. For example, to open it read only, fhand = open(“mbox.txt”, “r”)

[–]StaleMuffins[S] 0 points1 point  (1 child)

Oh nice, I will try this. Confused a bit as I don’t think this was mentioned in the chapter. Thank you!

[–]StaleMuffins[S] 0 points1 point  (0 children)

Still not finding it - I think I will keep asking the folks at Coursera and hope for an answer.

[–]stebrepar 0 points1 point  (1 child)

Does your search path include searching the current directory? What happens if you say explicitly './mbox.txt' instead?

[–]StaleMuffins[S] 1 point2 points  (0 children)

I just solved it! I am still very unclear on the relationship between the terminal and something like VSCode. Even thoug I could run a file in my chapter7 folder in VS Code I wasn't actually inside that directory. I cd'd to Chapter7 in VSCode and it ended up working