Re: FileNotFoundError: [Errno 2] No such file or directory: ''

2021-04-14 Thread Eryk Sun
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():

Re: FileNotFoundError: [Errno 2] No such file or directory: ''

2021-04-14 Thread Michael F. Stemper
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

Re: FileNotFoundError: [Errno 2] No such file or directory: ''

2021-04-14 Thread Dan Stromberg
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.

Re: FileNotFoundError: [Errno 2] No such file or directory: ''

2021-04-14 Thread jak
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

Re: FileNotFoundError: [Errno 2] No such file or directory: ''

2021-04-14 Thread Dan Stromberg
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

FileNotFoundError: [Errno 2] No such file or directory: ''

2021-04-14 Thread Quentin Bock
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