You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've encountered an issue with the save() method in the DataDict class, where it fails to properly handle saving data to a directory outside the current working directory. The result is FileExistsError because the folder data already exists one level above the program file location. Here is the code that caused the error:
Looking into the .save() method, I believe the problematic code snippet is as follows:
# Create output directory if it doesn't existifpathnotinos.listdir():
os.makedirs(path)
This logic checks if the path is in the current directory's listing (os.listdir()), leading to a FileExistsError when attempting to save data to an existing directory located outside the current directory, e.g., path='../'. A potential solution would be to directly check for the existence of the specified path and create it if it does not exist, avoiding the assumption that path should be within the current directory's listing:
ifnotos.path.exists(path):
os.makedirs(path)
The text was updated successfully, but these errors were encountered:
I've encountered an issue with the save() method in the DataDict class, where it fails to properly handle saving data to a directory outside the current working directory. The result is FileExistsError because the folder
data
already exists one level above the program file location. Here is the code that caused the error:Looking into the .save() method, I believe the problematic code snippet is as follows:
This logic checks if the path is in the current directory's listing (os.listdir()), leading to a FileExistsError when attempting to save data to an existing directory located outside the current directory, e.g., path='../'. A potential solution would be to directly check for the existence of the specified path and create it if it does not exist, avoiding the assumption that path should be within the current directory's listing:
The text was updated successfully, but these errors were encountered: