directory

Create folder and subfolder based on filename that contain the date

Create folder and subfolder based on filename that contain the date Question: I have multiple files that contain the date. for example the file names are : one08172021patient.txt two09182021patient.txt three09182021patient.txt I would to write a script in Python to create folder for year ,month,day and move the file based on the date that’s already in …

Total answers: 2

how can I make directory?

how can I make directory? Question: The given code is showing me the error; I am making the folder under folder under folder according to different classes and its videos. train is folder contains different class folder, every class folder have certain videos. directory of train is something like this; —train —-class1 —-video11.mp4 —-video12.mp4 … …

Total answers: 3

OSError: [WinError 123], it adds simbols to file path and raise this error

OSError: [WinError 123], it adds simbols to file path and raise this error Question: I am trying to open a directory: os.chdir(‘D:moviesClassicMusicGRANDES COMPOSITORES DA MUSICA CLASSICA17 – Verdi (Grandes Compositores da Música Clássica – Abril Coleções)’) but I get this error: OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: ‘D:\movies\ClassicMusic\GRANDES …

Total answers: 1

ImportError: attempted relative import with no known parent package :(

ImportError: attempted relative import with no known parent package 🙁 Question: I’m attempting to import a script from my Items file but I keeps on getting an error from .Items.Quest1_items import * gives from .Items.Quest1_items import * # ImportError: attempted relative import with no known parent package # Process finished with exit code 1 Here …

Total answers: 3

Symlink (auto-generated) directories via Snakemake

Symlink (auto-generated) directories via Snakemake Question: I am trying to create a symlink-directory structure for aliasing output directories in a Snakemake workflow. Let’s consider the following example: A long time ago in a galaxy far, far away, somebody wanted to find the best ice cream flavour in the universe and conducted a survey. Our example …

Total answers: 2

How do I delete a directory tree with pathlib?

How do I delete a directory tree with pathlib? Question: I have a project using pathlib and I want to do the equivalent of shutil.rmtree. I thought of doing it with something like: def pathlib_rmtree(folder): if folder.exists(): for file in folder.glob(‘**/*’): if file.is_dir(): file.rmdir() else: file.unlink() folder.rmdir() but I am not sure whether the folder.glob(‘**/*’) …

Total answers: 1

How to save png copies of ppm images in Python

How to save png copies of ppm images in Python Question: I have a folder full of ppm images and I want to save png copies of them. How do I do that? I’ve tried executing the following code but nothing happens. import cv2 import numpy as np import glob import sys import os.path from …

Total answers: 3