I am supposed to access a .dat file to perform some code. The directions that I am following are telling me to make a subdirectory for the main code then make another subdirectory for the .dat file. However, I am not entirely sure how to do that. Any help would be greatly appreciated!
So far, everything I have tried has given me the following error message:
FileNotFoundError: [Errno 2] No such file or directory
Related
I've been having an issue with Jupyter Notebook where I keep getting error
File Load Error for FILENAME.ipynb
Unhandled error
I've looked through many posts including this one that says you can remove the checkpoint folder. I've done that but for some reason it feels like it's ignoring my command
c.FileCheckpoints.checkpoint_dir = ''
The issue seems to be happening with notebooks I've cloned from our Git repo.
When I look at the Jupyter Server output I can see that it's trying to locate the checkpoint file for the file I'm trying to open and it can't find it.
FileNotFoundError: [Errno 2] No such file or directory: '\\\\\\some_folder\\some_folder\\some_folder\\some_folder\\some_folder\\some_folder\\some_folder\\test checkpoints\\some_folder\\.ipynb_checkpoints\\0.Clf_Variable_sig_categorical-checkpoint.ipynb'
I don't understand why it's looking for a checkpoint file? How can I get it to not look for this file and just open the file that I'm trying to open?
This error does not happen to all files that I cloned. Some open others don't, and I can't figure out why it would do that?
Also, if I open the same folder with VS Code, then it opens all the files without any issues.
Any help would be greatly appreciated, I've been going at this for days now and can't figure it out.
I am running Spyder in Linux Ubuntu and am trying to use data saved in a .txt file that is saved in the same directory as the python script I am trying to load it to using numpy's loadtxt function, however every time i try to, an error comes up stating that the file is not found which doesn't make sense as they are both in the same directory.
I am just wondering if anyone knows what this issue could be, other than the file not being in the same directory or the file name being spelt wrong in my code as neither is the case.
Any help would be very much appreciated!
I am trying to open an existing file in a subfolder of the current working directory. This is my command:
fyle = open('/SPAdes/default/{}'.format(file), 'r')
The filevariable contains the correct filename, the folder structure is correct (working on macOS), and the file exists.
This command, however, results if this error message:
FileNotFoundError: [Errno 2] No such file or directory: [filename]
Does it have anything to do with the way JupyterLab works? How am I supposed to specify the folder srtucture on Jupyter? I am able to create a new file in the current folder, but I am not able to create one in a subfolder of the current one (results in the same error message).
The folder structure is recognized on the same Jupyter notebook by bash commands, but I am somehow not able to access subfolders using python code.
Any idea as to what is wrong with the way I specified the folder structure?
Thanks a lot in advance.
There shouldn’t be a forward slash in front of SPAdes.
Paths starting with a slash exist high up in file hierarchy. You said this is a sub-directory of your current working directory.
I've been using VSCodium lately and writing Python code with it. However, I can't seem to find a way to open an existing file when running the script with VSCodium.
This is the code I have, it's working perfectly fine when ran from a terminal, it works. But not with VSCodium.
def remove_e_words(path,path_copy):
newfile = open(path_copy,"w")
orig = open(path,"r")
lines = orig.readlines()
for line in lines:
newfile.write(sans_e_spec(line)+"\n")
newfile.close()
orig.close()
Here's the error I have :
FileNotFoundError: [Errno 2] No such file or directory: 'vers-queneau.txt'
I've searched for similar issues on stackoverflow, I've tried this:
Can't run python code through VS Code. Can't open file ptvsd_launcher.py [Errno 22] Invalid Argument
I have the downgraded version, it still doesn't work.
I also tried to use the file directory instead, changing a parameter in the Settings, it also didn't fix the issue.
What could I do to be able to solve this problem please?
Thanks.
You probably don't have the current working directory set to what you expect. If you run your code with print(os.getcwd()) you will very likely find that is not the directory you expect it to be. Either adjust your relative file path to take that cwd into account or specify the path in an absolute fashion (if the file is next to the file you're running you can calculate its location based on __file__).
I've tried reading through the other answered similar questions, yet still can't find what I'm doing wrong.
file=open("Crawl","r")
cont=file.read()
file.close
print(cont)
It's as simple as that. Both the folder and python are on the desktop which explains why there isn't a directory to it. I did try opening .txt and .png files and that did work, but it seems I can't open folders?
PermissionError: [Errno 13] Permission denied: 'Crawl'
You are getting this error because you are trying to open "Crawl" as a file. It's a folder, and you can't treat a Windows folder as if it were a file.