Skip to content
Advertisement

Errno2 file not found after working with said path and/or possible bugs i’m overlooking

I have to create an app that gets a path from the user and renames, after the content of a cell, the entire document (excel documents in this case). For example, if in a specified cells, there is “2”, the document will be names 2.xlsx and so on, until al the files are renamed properly.

The problem is that, after verifying that, in the specified path, there are files, python exits with [Errno2] no such file or directory. I’ve modified the code to add for files in os.listdir(pathlib.Path(SPEC_PATH).resolve()):, that apparently solves the issue with the error, but doesn’t recognize some components (traceback below).

I tried debugging it, but, to me it seems fine. What might be the problem? Are there some bugs that i need to take care of first?

The code:

JavaScript

Also, i have this error now:

JavaScript

Advertisement

Answer

This fixed all the problems and finished the renaming sequence.

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement