Skip to main content

debug

Project description

This file is from: https://github.com/wayne931121/python_find_file_name

python_find_file_name

find file or dir location.

Usage

python -m find "base_path" "file_or_directory_name"

python -m find "C:\" "*.jpg" 

Code

import os, fnmatch

def find(pattern, path, prt=1):
    result = []
    for root, dirs, files in os.walk(path):
        for name in files:
            if fnmatch.fnmatch(name, pattern):
                result.append(os.path.join(root, name))
                if prt: print(result[-1])
        for name in dirs:
            if fnmatch.fnmatch(name, pattern):
                result.append(os.path.join(root, name))
                if prt: print(result[-1])
    return result

find('*yourfilenameordictname*', 'base_path')
find('*.jpg', r'C:\Users\原神\Downloads') #test on windows11, my computer.
find('*.txt', '/') #test on colab linux
find('*.jpg', '/content') #test on colab linux
find('*sample*', '/') #test on colab linux

print()

source and reference

https://stackoverflow.com/a/1724723/19470749
https://www.runoob.com/python/os-walk.html

Why I need this script?

I don't know where the huggingface download the model, and after search I know it download to cache folder, but I don't know where it is, so I directly use this script to search D drive and C drive, and then success find.

find("*text_encoder*", "D://")
find("*text_encoder*", "C://")

Notice, you can also set huggingface cache dir

pipe = CogVideoXImageToVideoPipeline.from_pretrained(model_id,text_encoder=text_encoder,transformer=transformer,vae=vae,torch_dtype=torch.float16,cache_dir="D://3")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wfind-0.0.1.tar.gz (2.2 kB view details)

Uploaded Source

File details

Details for the file wfind-0.0.1.tar.gz.

File metadata

  • Download URL: wfind-0.0.1.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for wfind-0.0.1.tar.gz
Algorithm Hash digest
SHA256 09d82d31bcf14ac74ece54c8139681fb2edc2d337d76286d2b01106786048f1e
MD5 245826e34a024af85cf0df1a79a86430
BLAKE2b-256 1134c832c6c5c8d8bdc8dee2d89aa0aa78c4f65bb568ca1f4947a4efda710ba0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page