On 4/14/21, Quentin Bock wrote:
>
> this is the only part of the code that causes the error
>
> file = open('Egils Saga 1-15.txt', "r")
Here's an app_abspath() function to resolve a filename against the
directory of the main script:
import os
import sys
def get_main_file():
On 14/04/2021 12.55, Dan Stromberg wrote:
Open a cmd.exe, command.exe or powershell, and:
cd c:\my\dir\ect\ory
Then run your script.
Or put an os.chdir(r'c:\my\dir\ect\ory') at the top of your script.
Or use file = open(r'c:\my\dir\ect\ory\Egils Saga 1-15.txt', 'r')
BTW, "file" means somethin
Open a cmd.exe, command.exe or powershell, and:
cd c:\my\dir\ect\ory
Then run your script.
Or put an os.chdir(r'c:\my\dir\ect\ory') at the top of your script.
Or use file = open(r'c:\my\dir\ect\ory\Egils Saga 1-15.txt', 'r')
BTW, "file" means something to python other than just a variable name.
Il 14/04/2021 18:13, Quentin Bock ha scritto:
I receive this error when I try to open a file
The file (what I'm trying to open) is in the same folder as the program I'm
trying to open it from; why is it saying no such file or directory?
this is the only part of the code that causes the error
fi
On Wed, Apr 14, 2021 at 9:14 AM Quentin Bock wrote:
> I receive this error when I try to open a file
> The file (what I'm trying to open) is in the same folder as the program I'm
> trying to open it from; why is it saying no such file or directory?
>
> this is the only part of the code that cause
I receive this error when I try to open a file
The file (what I'm trying to open) is in the same folder as the program I'm
trying to open it from; why is it saying no such file or directory?
this is the only part of the code that causes the error
file = open('Egils Saga 1-15.txt', "r")
file.clos