No files gathered with certain extension every time while using glob.glob()?

51
June 06, 2021, at 10:10 PM

I am trying to search through a list of repositories and extract the C++ files. I am searching through all the subdirectories located in the downloaded repository as well. The specific part I am having the most trouble with is searching the subdirectories.

def download_cpp_files(csv_file):
    df = pd.read_csv(csv_file)
    df_url = df['URL'].tolist()
    os.chdir('../repos/') # Change into data directory
    for url in df_url:
        try:
            subprocess.call('git clone "{}"'.format(url), shell = True) # Clone the contents of the Github repository
            repo_name = get_repo_name_from_url(url)
            print(repo_name + " downloaded.")
        except:
            print("No such URL " + url + " found.")
        
        target_files = glob.glob(r"~/Documents/open-vocabulary-ros/repos/**/*.cpp", recursive = True)
        print(target_files)

Even though there are C++ files located in the Git repositories I've gathered, I still always get [] (an empty list) whenever I run print(target_files). I suspect there might be something wrong with the regex I am passing into glob.glob(), although I am not sure what other regex to use. I am using a version of Python that is beyond 3.5. I've tried using pathlib, specifically the .rglob() function, and kept receiving [] whenever I run print(target_files). If it matters, I am using macOS Big Sur. How can I fix this issue, and what is the correct regex I need to pass in?

READ ALSO
SearchView with Recycler View not working in Fragment

SearchView with Recycler View not working in Fragment

I am trying to make the connection between adapter and fragment, but I get the following error when I try to filter the data for SearchView: Function invocation 'filter(

62
ObjectMapper with nested object

ObjectMapper with nested object

I have JSON response with an array but is not mapping and throwing error, how I can handle JSON like this

75
this.app.service(…).create(…) is not a function

this.app.service(…).create(…) is not a function

I tried to make api request twice and the first one work, but the second fails with below error

58