Getting PermissionError when trying to create a file in a directory

Advertisements I know this is probably a very common question, and I’ve already seen posts, here, here and here asking similar questions. But these posts relate to writing to a file. I want to create a file in a specific directory. Specifically, I am trying to populate a folder with many .mp3 files. Here’s what… Read More Getting PermissionError when trying to create a file in a directory

How do you get another project directory in the same solution?

Advertisements So I have a solution witch has two different projects(for example one of them is admin and one of them is presentation). it means I have two .exe files. My current project is for example presentation but I want the directory of the other one(admin) AppDomain.CurrentDomain.BaseDirectory this code gives me the current project directory.… Read More How do you get another project directory in the same solution?

Updating the names of elements of a fs path character vector in R

Advertisements I have a fs path character vector with a list of file names like these: path/to/folder/output_1_CR.csv path/to/folder/output_2_CR.csv … path/to/folder/output_22_CR.csv … path/to/folder/output_67_CR.csv Here’s the code I used to read in these output files into a fs path character vector: CR_A_paths <- fs::dir_ls(path = "/path/to/folder", regexp = "[CR].csv$") I want to update the names of the… Read More Updating the names of elements of a fs path character vector in R

Python cannot find a directory

Advertisements I wrote a code like this with jupyter notebook in a project; import os image_path = r’C:\Users\ays\Desktop\IR\01.jpg’ image_files = os.listdir(image_path) img = cv2.imread(os.path.join(image_path,image_files)) cv2.imshow(‘image’,img) it gives an error like; [WinError 3] The system cannot find the path specified: ‘C:\Users\ays\Desktop\IR\01.jpg’ i was trying to print an image and i had a directory problem >Solution :… Read More Python cannot find a directory

How to iterate over all files in multiple folders with python

Advertisements I’m trying to iterate over all directories in directory and find all .html files there. So far I’ve this code: def find_path(): """ :return: List """ paths = [] for filename in os.listdir(DIRECTORY): if filename.endswith(‘.html’): fname = os.path.join(DIRECTORY, filename) with open(fname, ‘r’) as f: soup = BeautifulSoup(f.read(), ‘html.parser’) path = soup.select_one(‘#tree > li >… Read More How to iterate over all files in multiple folders with python