Reputation: 81
This reddit thread will explain the project a little and give context into what I'm trying to accomplish. Essentially, I'm comparing pdf's to see if there are duplicates by using something other than their name. This is because all of the pdf's in my dataset have unique names, but could still be the same thing, content wise. Seek and destroy the duplicates. I'm still in the seek part of this project.
https://www.reddit.com/r/Python/comments/a337qv/finding_unique_pdfs_in_a_folder_need_info_on_how/
I decided to try to compare file sizes first to see what I would find before I tried anything else. I figured that would be a simple first approach, but for some reason the os library doesn't like the way that I'm feeding it the string of the file path. I've tried manipulating it any way I can to get it to work, but no dice.
I went Through and confirmed that the file exists within the folder I'm trying to get into.
So here is kind of the workflow for how I am imagining this to work. I pulled a query of the possible drawings that could contain duplicates and saved it as an excel file. I saved that file as a csv file so if I fuck up the sheet I don't fuck up my data. Plus I new a quick way to turn csv file columns into lists using pandas.
Here is a screen shot of the csv file
In the code below you can see that I made a list that has each of those columns. all of the data within the lists are strings. The description isn't very critical, but the "found in" and "name" columns (When concatenated) make up the file path and file name. I made a new list of the combined string that is the file path + the file so that I could get its size to compare.
I'm really hoping there is a way I can manipulate that path in either the csv file or in python with the lists.
Here is the error that comes up when I run the code.
https://i.sstatic.net/ZwPEl.jpg
C:\Users\27659\Desktop\PycharmProjects\sort_unique_profiles\venv\Scripts\python.exe "C:/Users/27659/Desktop/PycharmProjects/sort_unique_profiles/Compare and mark files.py"
same item in list
Traceback (most recent call last):
File "C:/Users/27659/Desktop/PycharmProjects/sort_unique_profiles/Compare and mark files.py", line 19, in <module>
if os.path.getsize(full_file_list[i]) == os.path.getsize(full_file_list[k]) and i == k:
File "C:\Users\27659\AppData\Local\Programs\Python\Python37-32\lib\genericpath.py", line 50, in getsize
return os.stat(filename).st_size
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\WS\\WS\\Aspire\\CA & AW\\7205\\AW\\85-7535-01.pdf'
Process finished with exit code 1
'
Here is the code
import pandas as pd
import os
main_df = pd.read_csv("C://Users//27659//Desktop//Unique Wood Profiles.csv")
drawing_number_list = main_df['Name'].tolist()
description_list = main_df['Description'].tolist()
found_in_list = main_df['Found In'].tolist()
full_file_list = ['placeholder']
for i in range(0, len(drawing_number_list)):
full_file_list.append(found_in_list[i] + drawing_number_list[i] + '.pdf')
del full_file_list[0]
for i in range(0, len(full_file_list)):
for k in range(0, len(full_file_list)):
if os.path.getsize(full_file_list[i]) == os.path.getsize(full_file_list[k]) and i == k:
print('same item in list')
elif os.path.getsize(full_file_list[i]) == os.path.getsize(full_file_list[i]):
print('oh bugger')
else:
print('thumbs up')
'
EDIT:
All files: ['C:\\WS\\WS\\Aspire\\CA & AW\\7205\\AW\\85-7534-01.pdf', 'C:\\WS\\WS\\Aspire\\CA & AW\\7205\\AW\\85-7535-01.pdf', 'C:\\WS\\WS\\Aspire\\CA & AW\\7205\\AW\\85-7394-01.pdf', 'C:\\WS\\WS\\Aspire\\CA & AW\\7205\\AW\\85-7740-01.pdf', 'C:\\WS\\WS\\Aspire\\CA & AW\\7205\\AW\\85-7886-01.pdf', 'C:\\WS\\WS\\Aspire\\CA & AW\\7205\\AW\\85-7821-01.pdf', 'C:\\WS\\WS\\Aspire\\CA & AW\\7205\\AW\\85-7392-01.pdf', 'C:\\WS\\WS\\Aspire\\CA & AW\\7205\\Bow, Bay & Garden\\P0035400.pdf', 'C:\\WS\\WS\\Aspire\\CA & AW\\7205\\CA\\45-05151.pdf', 'C:\\WS\\WS\\Aspire\\CA & AW\\7205\\CA\\45-05154.pdf', 'C:\\WS\\WS\\Aspire\\CA & AW\\7205\\CA\\45-05149.pdf', 'C:\\WS\\WS\\Aspire\\CA & AW\\7205\\Grilles\\60-4623-02.pdf', 'C:\\WS\\WS\\Aspire\\CA & AW\\7205\\Grilles\\85-7723-01.pdf', 'C:\\WS\\WS\\Aspire\\CA & AW\\7205\\Mull, Stack & Trim\\08-W8092.pdf', 'C:\\WS\\WS\\Aspire\\CA & AW\\7205\\Mull, Stack & Trim\\85-7611-01.pdf', 'C:\\WS\\WS\\Aspire\\CA & AW\\POCKET 7206\\CA\\85-8287-01.pdf', 'C:\\WS\\WS\\Aspire\\DH\\7105\\DH\\60-12966-01.pdf', 'C:\\WS\\WS\\Aspire\\DH\\7105\\DH\\85-8444-01.pdf', 'C:\\WS\\WS\\Aspire\\DH\\7105\\DH\\60-12931-01.pdf', 'C:\\WS\\WS\\Aspire\\DH\\7105\\DH\\60-12986-01.pdf', 'C:\\WS\\WS\\Aspire\\DH\\7105\\DH\\60-12967-01.pdf', 'C:\\WS\\WS\\Aspire\\DH\\7105\\DH\\60-12675-01.pdf', 'C:\\WS\\WS\\Aspire\\DS\\7305\\Window Std Unit\\85-8047-01.pdf', 'C:\\WS\\WS\\Aspire\\DS\\7305\\Window Std Unit\\85-7604-01.pdf', 'C:\\WS\\WS\\Aspire\\HGD\\1.75 In HGD IS_7502\\1W\\08-0003-W2403.pdf', 'C:\\WS\\WS\\Aspire\\HGD\\1.75 In HGD IS_7502\\1W\\08-1504-02.pdf', 'C:\\WS\\WS\\Aspire\\HGD\\1.75 In HGD IS_7502\\DS Tran Insert\\60-0239-01.pdf', 'C:\\WS\\WS\\Aspire\\HGD\\1.75 In HGD IS_7502\\Grilles\\60-0057-01.pdf', 'C:\\WS\\WS\\Aspire\\HGD\\1.75 In HGD IS_7502\\Grilles\\60-0036-01.pdf', 'C:\\WS\\WS\\Aspire\\HGD\\1.75 In HGD IS_7502\\Mull, Stack, & Trim\\45-03943.pdf', 'C:\\WS\\WS\\Aspire\\HGD\\1.75 In HGD IS_7502\\Tech Data & Mull C:\\60-2922-01.pdf', 'C:\\WS\\WS\\Aspire\\HGD\\1.75 In HGD IS_7502\\Tech Data & Mull C:\\60-3346-01.pdf', 'C:\\WS\\WS\\Aspire\\SGD\\1W\\70-6439-01.pdf', 'C:\\WS\\WS\\Aspire\\SGD\\1W\\85-7624-01.pdf', 'C:\\WS\\WS\\Aspire\\SGD\\1W\\70-6656-01.pdf', 'C:\\WS\\WS\\Aspire\\SGD\\1W\\70-6374-01.pdf', 'C:\\WS\\WS\\Aspire\\SGD\\1W\\60-10478-01.pdf', 'C:\\WS\\WS\\Aspire\\SGD\\1W\\70-6604-01.pdf', 'C:\\WS\\WS\\Aspire\\SGD\\2W\\70-6655-01.pdf', 'C:\\WS\\WS\\Collections\\CA & AW\\CA_6206\\CA - French_6206\\60-6264-01.pdf', 'C:\\WS\\WS\\Collections\\CA & AW\\CA_6206\\CA - Mull, Stack & Trim_6206\\60-7136-01.pdf', 'C:\\WS\\WS\\Collections\\CA & AW\\CA_6206\\CA - Mull, Stack & Trim_6206\\60-5946-01.pdf', 'C:\\WS\\WS\\Collections\\CA & AW\\CA_6206\\CA - Sash Set Pict, Tran, Fixed_6206\\60-5473-01.pdf', 'C:\\WS\\WS\\Collections\\CA & AW\\CA_6206\\CA - Sash Set Pict, Tran, Fixed_6206\\60-5504-01.pdf', 'C:\\WS\\WS\\Collections\\CA & AW\\CA_6206\\CA - Sash Set Pict, Tran, Fixed_6206\\60-6290-01.pdf', 'C:\\WS\\WS\\Collections\\CA & AW\\CA_6206\\CA - Sash Set Pict, Tran, Fixed_6206\\60-5503-01.pdf', 'C:\\WS\\WS\\Collections\\CA & AW\\CA_6206\\CA - Sash Set Pict, Tran, Fixed_6206\\60-5474-01.pdf', 'C:\\WS\\WS\\Collections\\CA & AW\\CA_6206\\CA - Screens & Storms_6206\\60-6031-01.pdf', 'C:\\WS\\WS\\Collections\\CA & AW\\CA_6206\\CA - Screens & Storms_6206\\60-6033-01.pdf', 'C:\\WS\\WS\\Collections\\CA & AW\\CA_6206\\CA_6206-files\\60-5491-01.pdf', 'C:\\WS\\WS\\Collections\\CA & AW\\CA_6206\\CA_6206-files\\60-5588-01.pdf', 'C:\\WS\\WS\\Collections\\HGD\\6502\\Mull, Stack & Trim\\08-W5035X.pdf', 'C:\\WS\\WS\\Collections\\HGD\\6503\\1Wide\\70-1889-01.pdf', 'C:\\WS\\WS\\Collections\\HGD\\6503\\1Wide\\70-1737-01.pdf', 'C:\\WS\\WS\\Collections\\HGD\\6503\\1Wide\\70-2159-01.pdf', 'C:\\WS\\WS\\Collections\\HGD\\6504\\IS - 1Wide\\70-3317-01.pdf', 'C:\\WS\\WS\\Collections\\HGD\\6504\\IS-Sidelite\\70-4158-01.pdf', 'C:\\WS\\WS\\Collections\\HGD\\6505\\IS - 1Wide\\85-1802-01.pdf', 'C:\\WS\\WS\\Collections\\HGD\\6505\\IS - 1Wide\\85-1803-01.pdf', 'C:\\WS\\WS\\Collections\\HGD\\6505\\IS - 1Wide\\85-1800-01.pdf', 'C:\\WS\\WS\\Collections\\HGD\\6505\\IS - 1Wide\\85-1805-01.pdf', 'C:\\WS\\WS\\Collections\\HGD\\6505\\IS - 1Wide\\85-1804-01.pdf', 'C:\\WS\\WS\\Collections\\HGD\\6505\\IS - 1Wide\\85-1810-01.pdf', 'C:\\WS\\WS\\Collections\\HGD\\6505\\IS - 1Wide\\85-1811-01.pdf', 'C:\\WS\\WS\\Collections\\HGD\\6505\\IS - 3Wide Triple\\85-1812-01.pdf', 'C:\\WS\\WS\\Collections\\HGD\\6505\\IS - DS Sidelite Boxed\\85-1813-01.pdf', 'C:\\WS\\WS\\Collections\\HGD\\6605\\OS - 1Wide\\85-1806-01.pdf', 'C:\\WS\\WS\\Collections\\HGD\\6605\\OS - 1Wide\\85-1808-01.pdf', 'C:\\WS\\WS\\Collections\\HGD\\6605\\OS - 2Wide\\85-1809-01.pdf', 'C:\\WS\\WS\\Collections\\HGD\\6605\\OS - DS Sidelite Boxed\\85-1814-01.pdf', 'C:\\WS\\WS\\Collections\\Hung Window\\Collections - DH_6107\\Dbl-Hung\\60-5654-01.pdf', 'C:\\WS\\WS\\Collections\\Hung Window\\Collections - DH_6107\\Dbl-Hung\\60-6547-01.pdf', 'C:\\WS\\WS\\Collections\\Hung Window\\Collections - DH_6107\\Dbl-Hung\\60-6582-01.pdf', 'C:\\WS\\WS\\Collections\\Hung Window\\Collections - DH_6107\\Dbl-Hung\\60-6846-01.pdf', 'C:\\WS\\WS\\Collections\\Hung Window\\Collections - DH_6107\\Dbl-Hung\\60-6543-01.pdf', 'C:\\WS\\WS\\Collections\\Hung Window\\Collections - DH_6107\\Dbl-Hung\\60-6548-01.pdf', 'C:\\WS\\WS\\Collections\\Hung Window\\Collections - DH_6107\\Dbl-Hung\\60-5850-01.pdf', 'C:\\WS\\WS\\Collections\\Hung Window\\Collections - DH_6107\\Dbl-Hung\\60-6542-01.pdf', 'C:\\WS\\WS\\Collections\\Hung Window\\Collections - DH_6107\\Dbl-Hung\\60-1684-01.pdf', 'C:\\WS\\WS\\Collections\\Hung Window\\Collections - DH_6107\\Dbl-Hung\\60-5865-01.pdf', 'C:\\WS\\WS\\Collections\\Hung Window\\Collections - DH_6107\\Dbl-Hung\\60-6605-01.pdf', 'C:\\WS\\WS\\Collections\\Hung Window\\Collections - DH_6107\\Mull, Stack & Trim\\60-5588-02.pdf', 'C:\\WS\\WS\\Collections\\Hung Window\\Collections - DH_6107\\Sash Set Pict, Tran, Fixed\\60-6837-01.pdf', 'C:\\WS\\WS\\Collections\\Hung Window\\Collections - DH_6107\\Sash Set Pict, Tran, Fixed\\60-6839-01.pdf', 'C:\\WS\\WS\\Collections\\Hung Window\\Collections - DH_6107\\Sash Set Pict, Tran, Fixed\\60-6849-01.pdf', 'C:\\WS\\WS\\Collections\\Hung Window\\Collections - DH_6107\\Sash Set Pict, Tran, Fixed\\60-7100-01.pdf', 'C:\\WS\\WS\\Collections\\Hung Window\\Collections - SH_6106\\SH_6106\\60-6557-01.pdf', 'C:\\WS\\WS\\Collections\\Hung Window\\Collections - SH_6106\\SH_6106\\60-6552-01.pdf', 'C:\\WS\\WS\\Collections\\Hung Window\\Collections - SH_6106\\SH_6106\\60-6551-01.pdf', 'C:\\WS\\WS\\Collections\\SGD\\Collections - SGD_6708\\2Wide\\70-0337-01.pdf', 'C:\\WS\\WS\\Collections\\SGD\\Collections - SGD_6708\\2Wide\\60-0851-01.pdf', 'C:\\WS\\WS\\Collections\\SGD\\Collections - SGD_6708\\3Wide\\60-4013-01.pdf', 'C:\\WS\\WS\\Collections\\SGD\\Collections - SGD_6708\\4Wide\\70-0507-01.pdf', 'C:\\WS\\WS\\Contemporary\\FRENCH CA\\8218\\85-7906-01.pdf', 'C:\\WS\\WS\\Contemporary\\FRENCH CA\\8218\\85-10134-01.pdf', 'C:\\WS\\WS\\Contemporary\\FRENCH CA\\8218\\85-10821-02.pdf', 'C:\\WS\\WS\\Contemporary\\FRENCH CA\\8218\\85-8084-01.pdf', 'C:\\WS\\WS\\Contemporary\\HGD\\2.25 IS-CTMP 8517\\1W\\85-10889-01.pdf', 'C:\\WS\\WS\\Contemporary\\HGD\\2.25 IS-CTMP 8517\\1W\\85-2654-01.pdf', 'C:\\WS\\WS\\Contemporary\\HGD\\2.25 IS-CTMP 8517\\1W\\85-10320-01.pdf', 'C:\\WS\\WS\\Contemporary\\HGD\\2.25 IS-CTMP 8517\\2W\\85-11892-02.pdf', 'C:\\WS\\WS\\Contemporary\\HGD\\2.25 IS-CTMP 8517\\Mull, Stack & Trim\\85-12005-01.pdf', 'C:\\WS\\WS\\Contemporary\\HGD\\2.25 IS-CTMP 8517\\Mull, Stack & Trim\\85-12006-01.pdf', 'C:\\WS\\WS\\Contemporary\\HGD\\2.25 IS-CTMP 8517\\Mull, Stack & Trim\\85-12007-01.pdf', 'C:\\WS\\WS\\Contemporary\\HGD\\2.25 IS-CTMP 8517\\Mull, Stack & Trim\\85-12008-01.pdf', 'C:\\WS\\WS\\Contemporary\\HGD\\2.25 OS-CTMP 8617\\1W\\08-0006-C2403.pdf', 'C:\\WS\\WS\\Contemporary\\HGD\\OS Bi-fold 8623\\2W\\45-03268.pdf', 'C:\\WS\\WS\\Contemporary\\HGD\\OS Bi-fold 8623\\2W\\45-04681.pdf', 'C:\\WS\\WS\\Contemporary\\PUSH OUT\\8217\\PUSH OUT FRENCH CA\\85-8182-01.pdf', 'C:\\WS\\WS\\Contemporary\\PUSH OUT\\8217\\PUSH OUT FRENCH CA\\85-8186-01.pdf', 'C:\\WS\\WS\\Contemporary\\PUSH OUT\\8217\\PUSH OUT FRENCH CA\\85-8059-01.pdf', 'C:\\WS\\WS\\Contemporary\\SGD\\1.75 Contemp Multi Slide 8720\\Pocket\\Bipart\\10W\\45-01468.pdf', 'C:\\WS\\WS\\Contemporary\\SGD\\1.75 Contemp Multi Slide 8720\\Pocket\\Bipart\\10W\\85-8748-01.pdf', 'C:\\WS\\WS\\Contemporary\\SGD\\1.75 Contemp Multi Slide 8720\\Pocket\\Bipart\\10W\\85-11969-01.pdf', 'C:\\WS\\WS\\Contemporary\\SGD\\1.75 Contemp Multi Slide 8720\\Pocket\\Bipart\\10W\\85-11138-01.pdf', 'C:\\WS\\WS\\Contemporary\\SGD\\1.75 Contemp Multi Slide 8720\\Pocket\\Bipart\\10W\\85-7951-01.pdf', 'C:\\WS\\WS\\Contemporary\\SGD\\1.75 Contemp Multi Slide 8720\\Pocket\\Bipart\\10W\\85-8941-01.pdf', 'C:\\WS\\WS\\Contemporary\\SGD\\1.75 Contemp Multi Slide 8720\\Pocket\\Bipart\\10W\\85-12079-01.pdf', 'C:\\WS\\WS\\Contemporary\\SGD\\1.75 Contemp Multi Slide 8720\\Pocket\\Single Dir\\3W\\45-01465.pdf', 'C:\\WS\\WS\\Contemporary\\SGD\\1.75 Contemp Multi Slide 8720\\Stacked\\Bipart\\10W\\45-01460.pdf', 'C:\\WS\\WS\\Contemporary\\SGD\\1.75 Contemp Sliding Patio 8717\\1W\\60-10452-01.pdf', 'C:\\WS\\WS\\Contemporary\\SGD\\1.75 Contemp Sliding Patio 8717\\1W\\08-2877-03.pdf', 'C:\\WS\\WS\\Contemporary\\SGD\\1.75 Contemp Sliding Patio 8717\\1W\\70-0360-02.pdf', 'C:\\WS\\WS\\Contemporary\\SGD\\1.75 Contemp Sliding Patio 8717\\1W\\85-11143-01.pdf', 'C:\\WS\\WS\\Contemporary\\SGD\\1.75 Contemp Sliding Patio 8717\\1W\\60-10454-01.pdf', 'C:\\WS\\WS\\Contemporary\\SGD\\1.75 Contemp Sliding Patio 8717\\1W\\60-10450-01.pdf', 'C:\\WS\\WS\\Contemporary\\SGD\\1.75 Contemp Sliding Patio 8717\\1W\\85-5529-01.pdf', 'C:\\WS\\WS\\Contemporary\\SGD\\2.25 Contemp Lift and Slide 8718\\Pocket\\Bipart\\10W\\85-8746-01.pdf', 'C:\\WS\\WS\\Contemporary\\SGD\\2.25 Contemp Lift and Slide 8718\\Pocket\\Bipart\\10W\\85-8394-01.pdf', 'C:\\WS\\WS\\Contemporary\\SGD\\2.25 Contemp Lift and Slide 8718\\Stacked\\Bipart\\10W\\45-01477.pdf', 'C:\\WS\\WS\\Custom Shield\\CA & AW\\8201\\AW\\311419.pdf', 'C:\\WS\\WS\\Custom Shield\\CA & AW\\8201\\AW\\08-W3004.pdf', 'C:\\WS\\WS\\Custom Shield\\CA & AW\\8201\\Bow, Bay & Garden\\09-W8096.pdf', 'C:\\WS\\WS\\Custom Shield\\CA & AW\\8201\\Bow, Bay & Garden\\70-3810-01.pdf', 'C:\\WS\\WS\\Custom Shield\\CA & AW\\8201\\CA\\311421.pdf', 'C:\\WS\\WS\\Custom Shield\\CA & AW\\8201\\CA\\311420.pdf', 'C:\\WS\\WS\\Custom Shield\\CA & AW\\8210\\AW\\60-6005-01.pdf', 'C:\\WS\\WS\\Custom Shield\\CA & AW\\8210\\AW\\60-6004-01.pdf', 'C:\\WS\\WS\\Custom Shield\\CA & AW\\8210\\AW\\60-3267.pdf', 'C:\\WS\\WS\\Custom Shield\\CA & AW\\8210\\AW\\70-0794-01.pdf', 'C:\\WS\\WS\\Custom Shield\\CA & AW\\8210\\AW\\70-0793-01.pdf', 'C:\\WS\\WS\\Custom Shield\\HGD\\851\\DS Tran Insert\\09-W5026-01.pdf', 'C:\\WS\\WS\\Custom Shield\\HGD\\851\\DS Tran Insert\\P0125800.pdf', 'C:\\WS\\WS\\Custom Shield\\HGD\\861\\DS Tran Insert\\60-2009-01.pdf', 'C:\\WS\\WS\\Custom Shield\\HGD\\861\\DS Tran Sim Sash\\60-1698-01.pdf', 'C:\\WS\\WS\\Custom Shield\\HGD\\861\\DS Tran Std Unit\\60-1694-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8103\\Cottage, Oriel, Sim Tran\\60-3483-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8103\\Cottage, Oriel, Sim Tran\\60-3258-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8103\\Cottage, Oriel, Sim Tran\\08-1005-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8103\\Cottage, Oriel, Sim Tran\\60-0638-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8103\\Cottage, Oriel, Sim Tran\\08-2039-02-03.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8103\\Cottage, Oriel, Sim Tran\\08-2041-02.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8103\\Cottage, Oriel, Sim Tran\\08-2038-02.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8103\\Cottage, Oriel, Sim Tran\\08-2049-02.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8103\\Cottage, Oriel, Sim Tran\\60-0642-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8103\\Sash Replacement\\60-2455-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8103\\Sash Replacement\\60-2458-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8103\\Sash Replacement\\08-1906-02.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8103\\Sash Replacement\\60-2453-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8103\\Sash Replacement\\60-2459-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8103\\Sash Replacement\\60-3516-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8103\\Sash Set Pic, Tran, Fixed\\08-2148-02.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8103\\Sash Set Pic, Tran, Fixed\\08-2147-02.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8108\\DH\\60-9949-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8108\\DH\\60-9858-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8108\\DH\\60-9017-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8108\\DH\\80-0581-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8108\\DH\\08-1897-02.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8108\\DH\\08-1025-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8108\\DH\\08-1892-02.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8108\\DH\\60-9021-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8108\\Sash Set Pic, Tran, Fixed\\08-2108-02.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8108\\Sash Set Pic, Tran, Fixed\\08-2106-02.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8112\\DH\\60-2487-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Hung Window\\8112\\DH\\60-2493-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Slide Window\\8403\\Double\\60-9350-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Slide Window\\8403\\Double\\60-9359-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Slide Window\\8403\\Double\\60-9353-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Slide Window\\8403\\Double\\60-8003-01.pdf', 'C:\\WS\\WS\\Custom Shield\\Slide Window\\8403\\Double\\60-4026-01.pdf', 'C:\\WS\\WS\\LifeGuard IG Premium\\CA & AW\\1210\\Grilles\\60-5031-03.pdf', 'C:\\WS\\WS\\LifeGuard IG Premium\\CA & AW\\1210\\Mull, Stack & Trim\\85-8215-01.pdf', 'C:\\WS\\WS\\LifeGuard IG Premium\\CA & AW\\1210\\Mull, Stack & Trim\\85-7445-01.pdf', 'C:\\WS\\WS\\LifeGuard IG Premium\\CA & AW\\1210\\Sash Set Pict, Tran, Fixed\\85-8207-01.pdf', 'C:\\WS\\WS\\LifeGuard IG Premium\\CA & AW\\1210\\Screen-Storms Retractable Standard Interior\\85-9583-01.pdf', 'C:\\WS\\WS\\LifeGuard IG Premium\\DS\\1310\\Window Std Unit\\45-05175.pdf', 'C:\\WS\\WS\\LifeGuard IG Premium\\DS\\1310\\Window Std Unit\\45-05173.pdf', 'C:\\WS\\WS\\LifeGuard IG Premium\\DS\\1310\\Window Std Unit\\45-05171.pdf', 'C:\\WS\\WS\\LifeGuard IG Premium\\DS\\1310\\Window Std Unit\\85-8275-01.pdf', 'C:\\WS\\WS\\LifeGuard IG Premium\\French CA\\1212\\French CA\\45-02011.pdf', 'C:\\WS\\WS\\LifeGuard IG Premium\\French CA\\1212\\French CA\\85-8084-02.pdf', 'C:\\WS\\WS\\LifeGuard IG WS\\CA & AW\\1201\\AW\\09-w3002.pdf', 'C:\\WS\\WS\\LifeGuard IG WS\\CA & AW\\1201\\CA\\08-W2036.pdf', 'C:\\WS\\WS\\LifeGuard IG WS\\CA & AW\\1204\\CA\\60-12350-01.pdf', 'C:\\WS\\WS\\LifeGuard IG WS\\SGD\\SGD French_1702\\2W\\08-2930-03.pdf', 'C:\\WS\\WS\\LifeGuard WS\\CA & AW\\1206\\Sash Set Pic, Tran, Fixed\\60-10771-01.pdf', 'C:\\WS\\WS\\LifeGuard WS\\DS\\1302\\Window Std Unit\\85-5506-01.pdf', 'C:\\WS\\WS\\Mark Haven Alum Clad\\HGD\\8501\\DS Tran Std Unit\\100413.pdf', 'C:\\WS\\WS\\Mark Haven Alum Clad\\HGD\\8501\\DS Tran Std Unit\\100727.pdf', 'C:\\WS\\WS\\Mark Haven Alum Clad\\HGD\\8501\\Install, Replacement Catalog\\102379.pdf', 'C:\\WS\\WS\\Mark Haven Alum Clad\\HGD\\8501\\Mull, Stack & Trim\\80-0716-01.pdf', 'C:\\WS\\WS\\Mark Haven Alum Clad\\HGD\\8501\\Mull, Stack & Trim\\80-0714-01.pdf', 'C:\\WS\\WS\\Mark Haven Alum Clad\\HGD\\8501\\Mull, Stack & Trim\\80-0715-01.pdf', 'C:\\WS\\WS\\Mark Haven Alum Clad\\HGD\\8501\\Mull, Stack & Trim\\80-0718-01.pdf', 'C:\\WS\\WS\\Mark Haven Alum Clad\\HGD\\8509\\1W\\08-w5020.pdf', 'C:\\WS\\WS\\Mark Haven Alum Clad\\HGD\\8601\\DS Tran Std Unit\\100413.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH Pic\\1108 Single Glazed\\85-8398-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH Pic\\1108 Single Glazed\\85-8702-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH Pic\\1108 Single Glazed\\85-8701-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH Pic\\1108 Single Glazed\\85-7154-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH Pic\\1108 Single Glazed\\85-9136-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH Pic\\1108 Single Glazed\\85-7509-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH Pic\\1108 Single Glazed\\85-8428-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH Pic\\1108 Single Glazed\\85-7276-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH Pic\\1108 Single Glazed\\85-7787-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH Pic\\1108 Single Glazed\\85-7523-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH Pic\\1108 Single Glazed\\85-7196-02.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH Pic\\1108 Single Glazed\\85-7329-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH Tran\\1110 Single Glazed\\85-8031-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH Tran\\1110 Single Glazed\\85-8042-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH Tran\\1110 Single Glazed\\85-8384-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH\\1104 IG\\45-04721.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH\\1104 IG\\85-12152-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH\\1104 IG\\85-12154-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH\\1104 IG\\85-12152-02.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH\\1104 IG\\85-12109-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH\\1104 IG\\85-10647-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH\\1104 IG\\85-7318-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH\\1104 IG\\85-7206-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH\\1104 IG\\85-7206-02.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH\\1104 IG\\85-9116-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH\\1104 IG\\85-7441-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH\\1104 IG\\85-10977-01.pdf', 'C:\\WS\\WS\\Premium Coastal\\DH\\1105 Single Glazed\\45-00775.pdf', 'C:\\WS\\WS\\Premium\\CA & AW\\8211\\AW\\85-8437-01.pdf', 'C:\\WS\\WS\\Premium\\CA & AW\\8211\\EB, Segment\\85-8434-01.pdf', 'C:\\WS\\WS\\Premium\\CA & AW\\8211\\EB, Segment\\85-8354-01.pdf', 'C:\\WS\\WS\\Premium\\CA & AW\\8211\\Special Shapes\\85-7622-01.pdf', 'C:\\WS\\WS\\Premium\\DH Pic\\POCKET PIC 8119\\60-12888-01.pdf', 'C:\\WS\\WS\\Premium\\DH\\8109\\DH\\85-7614-01.pdf', 'C:\\WS\\WS\\Premium\\DH\\8109\\DH\\85-7366-01.pdf', 'C:\\WS\\WS\\Premium\\DH\\8109\\DH\\85-9320-01.pdf', 'C:\\WS\\WS\\Premium\\DH\\8109\\DH\\85-7626-01.pdf', 'C:\\WS\\WS\\Premium\\DH\\8109\\DH\\85-7612-01.pdf', 'C:\\WS\\WS\\Premium\\DH\\8109\\DH\\85-7210-01.pdf', 'C:\\WS\\WS\\Premium\\DH\\8109\\Prod-Mod\\85-9010-01.pdf', 'C:\\WS\\WS\\Premium\\DH\\8109\\Prod-Mod\\85-9001-01.pdf', 'C:\\WS\\WS\\Premium\\DH\\8120\\DH\\85-9220-01.pdf', 'C:\\WS\\WS\\Premium\\DS\\8306\\Corner Unit\\85-10624-01.pdf', 'C:\\WS\\WS\\Premium\\DS\\8307\\Premium DS - Window Std Unit_8307\\85-10692-01.pdf', 'C:\\WS\\WS\\Premium\\DS\\8307\\Premium DS - Window Std Unit_8307\\85-8046-01.pdf', 'C:\\WS\\WS\\Premium\\DS\\POCKET 8309\\Premium POCKET DS - Grilles_8309\\85-11915-01.pdf', 'C:\\WS\\WS\\Premium\\DS\\POCKET 8309\\Premium POCKET DS - Grilles_8309\\85-8588-01.pdf', 'C:\\WS\\WS\\Premium\\DS\\POCKET 8309\\Premium POCKET DS - Grilles_8309\\85-8598-01.pdf', 'C:\\WS\\WS\\Premium\\FRENCH CA\\8214\\French Casement\\45-03962.pdf', 'C:\\WS\\WS\\Premium\\FRENCH CA\\8214\\French Casement\\45-03935-01.pdf', 'C:\\WS\\WS\\Premium\\SGD\\Telescoping 8706\\2W\\08-2878-03.pdf', 'C:\\WS\\WS\\Premium\\SGD\\Telescoping 8706\\2W\\08-2876-03.pdf', 'C:\\WS\\WS\\Premium\\SGD\\Telescoping 8706\\2W\\08-2997-03.pdf', 'C:\\WS\\WS\\ProShield\\CA & AW\\7201\\AW\\85-1099-01.pdf', 'C:\\WS\\WS\\ProShield\\CA & AW\\7201\\AW\\85-1097-01.pdf', 'C:\\WS\\WS\\ProShield\\CA & AW\\7201\\CA\\08-3193-05.pdf', 'C:\\WS\\WS\\ProShield\\CA & AW\\7201\\Mull, Stack & Trim\\60-5893-01.pdf', 'C:\\WS\\WS\\ProShield\\DS\\7301\\Std Unit\\85-2118-01.pdf', 'C:\\WS\\WS\\ProShield\\DS\\733\\CA Pict, Tran, Sim Tran Std Unit\\511458A.pdf', 'C:\\WS\\WS\\ProShield\\Hung Window\\DH ProTilt_7101\\Double\\60-12634-01.pdf', 'C:\\WS\\WS\\ProShield\\Hung Window\\DH ProTilt_7101\\Double\\60-10723-01.pdf', 'C:\\WS\\WS\\Sequel\\CA & AW\\8207\\Bow, Bay & Garden\\70-3756-01.pdf', 'C:\\WS\\WS\\Sequel\\CA & AW\\8207\\Bow, Bay & Garden\\70-3757-01.pdf', 'C:\\WS\\WS\\Sequel\\CA & AW\\8207\\Bow, Bay & Garden\\70-3759-01.pdf', 'C:\\WS\\WS\\Sequel\\CA & AW\\8207\\Bow, Bay & Garden\\70-3761-01.pdf', 'C:\\WS\\WS\\Sequel\\CA & AW\\8207\\Bow, Bay & Garden\\70-3762-01.pdf', 'C:\\WS\\WS\\Sequel\\CA & AW\\8207\\Bow, Bay & Garden\\70-3764-01.pdf', 'C:\\WS\\WS\\Sequel\\CA & AW\\8207\\Bow, Bay & Garden\\70-3765-01.pdf', 'C:\\WS\\WS\\Sequel\\CA & AW\\8207\\Bow, Bay & Garden\\70-3766-01.pdf', 'C:\\WS\\WS\\Sequel\\CA & AW\\8207\\Bow, Bay & Garden\\70-3767-01.pdf', 'C:\\WS\\WS\\Sequel\\CA & AW\\8207\\Bow, Bay & Garden\\70-3751-01.pdf', 'C:\\WS\\WS\\Sequel\\CA & AW\\8207\\Bow, Bay & Garden\\70-3752-01.pdf', 'C:\\WS\\WS\\Sequel\\CA & AW\\8207\\Bow, Bay & Garden\\70-3753-01.pdf', 'C:\\WS\\WS\\Sequel\\CA & AW\\8207\\Bow, Bay & Garden\\70-3754-01.pdf', 'C:\\WS\\WS\\Sequel\\CA & AW\\8207\\Bow, Bay & Garden\\70-3755-01.pdf', 'C:\\WS\\WS\\Sequel\\CA & AW\\8207\\Bow, Bay & Garden\\08-1316-02.pdf', 'C:\\WS\\WS\\Signature\\CA & AW\\8205\\AW\\85-7575-01.pdf', 'C:\\WS\\WS\\Signature\\CA & AW\\8205\\AW\\85-7576-01.pdf', 'C:\\WS\\WS\\Signature\\Dbl-Hung\\8109\\DH_8109\\45-05060.pdf', 'C:\\WS\\WS\\Signature\\Dbl-Hung\\8109\\DH_8109\\85-8502-01.pdf', 'C:\\WS\\WS\\Signature\\Dbl-Hung\\8120\\DH\\85-12096-01.pdf', 'C:\\WS\\WS\\Signature\\Dbl-Hung\\8122\\DH\\45-13499.pdf', 'C:\\WS\\WS\\Signature\\Dbl-Hung\\8122\\DH\\45-11955.pdf', 'C:\\WS\\WS\\Signature\\Dbl-Hung\\8122\\DH\\45-11973.pdf', 'C:\\WS\\WS\\Signature\\Dbl-Hung\\8122\\DH\\45-13364.pdf', 'C:\\WS\\WS\\Signature\\DH Pic\\8123\\Pic\\45-13412.pdf', 'C:\\WS\\WS\\Signature\\DH Pic\\8123\\Pic\\45-14407.pdf', 'C:\\WS\\WS\\Signature\\DH Pic\\8123\\Pic\\45-14408.pdf', 'C:\\WS\\WS\\Signature\\DS\\Signature - DS_8306\\Signature DS - Grilles_8306\\85-11041-01.pdf', 'C:\\WS\\WS\\Signature\\DS\\Signature - DS_8306\\Signature DS - Grilles_8306\\85-8594-01.pdf', 'C:\\WS\\WS\\Signature\\DS\\Signature - DS_8306\\Signature DS - Grilles_8306\\85-11044-01.pdf', 'C:\\WS\\WS\\Signature\\DS\\Signature - DS_8306\\Signature DS - Grilles_8306\\85-8596-01.pdf', 'C:\\WS\\WS\\Signature\\DS\\Signature - DS_8306\\Signature DS - Mull, Stack & Trim_8306\\85-9937-01.pdf', 'C:\\WS\\WS\\Signature\\DS\\Signature - DS_8306\\Signature DS - Window Std Unit_8306\\85-9472-01.pdf', 'C:\\WS\\WS\\Visions 1000\\DS\\936\\Mull, Stack & Trim\\70-1575-01.pdf', 'C:\\WS\\WS\\Wood\\CA & AW\\6200\\Bow, Bay & Garden\\310243.pdf', 'C:\\WS\\WS\\Wood\\CA & AW\\6200\\French CA\\08-W2045.pdf', 'C:\\WS\\WS\\Wood\\CA & AW\\6200\\French CA\\08-W2044X.pdf', 'C:\\WS\\WS\\Wood\\CA & AW\\6200\\Mull, Stack & Trim\\09-0024B-W0186.pdf', 'C:\\WS\\WS\\Wood\\CA & AW\\6204\\AW\\70-1068-01.pdf', 'C:\\WS\\WS\\Wood\\CA & AW\\6204\\AW\\60-3075-01.pdf', 'C:\\WS\\WS\\Wood\\DS\\630\\Window Std Unit\\60-11335-01.pdf', 'C:\\WS\\WS\\Wood\\DS\\6301\\Mull, Stack & Trim\\09-0125-W0896.pdf', 'C:\\WS\\WS\\Wood\\DS\\6301\\Mull, Stack & Trim\\502728.pdf', 'C:\\WS\\WS\\Wood\\HGD\\1.75 In HGD IS_651\\EB, Segment\\08-1788-02.pdf', 'C:\\WS\\WS\\Wood\\HGD\\1.75 In HGD IS_6510\\1Wide\\45-09154.pdf', 'C:\\WS\\WS\\Wood\\Hung Window\\DH_610\\DH\\60-0757-01.pdf', 'C:\\WS\\WS\\Wood\\Hung Window\\DH_610\\DH\\60-12630-01.pdf', 'C:\\WS\\WS\\Wood\\Hung Window\\DH_610\\DH\\60-11717-01.pdf', 'C:\\WS\\WS\\Wood\\Hung Window\\DH_610\\Sash Set Pict, Tran, Fixed\\08-2185-02.pdf', 'C:\\WS\\WS\\Wood\\Hung Window\\DH_610\\Sash Set Pict, Tran, Fixed\\08-2478-02.pdf', 'C:\\WS\\WS\\Wood\\Hung Window\\DH_611\\Sash Replacement\\60-2456-01.pdf', 'C:\\WS\\WS\\Wood\\Hung Window\\DH_611\\Sash Replacement\\60-2457-01.pdf', 'C:\\WS\\WS\\Wood\\Hung Window\\DH_611\\Sash Replacement\\60-2454-01.pdf', 'C:\\WS\\WS\\Wood\\Hung Window\\DH_611\\Sash Replacement\\60-2460-01.pdf', 'C:\\WS\\WS\\Wood\\SGD\\Narrow Stile - 2009 - Omni Sill_6714\\Mull, Stack & Trim\\85-4951-01.pdf', 'C:\\WS\\WS\\Wood\\SGD\\Wide Stile - 2009 - Omni Sill_6715\\1Wide\\60-1096-02.pdf', 'C:\\WS\\WS\\Wood\\SGD\\Wide Stile - 2009 - Omni Sill_6715\\1Wide\\60-1094-01.pdf', 'C:\\WS\\WS\\Wood\\SGD\\Wide Stile - 2009 - Omni Sill_6715\\1Wide\\60-1092-01.pdf', 'C:\\WS\\WS\\Wood\\Slide Window\\Dbl-Triple Slide Window_6401\\Double\\60-8006-01.pdf', 'C:\\WS\\WS\\WS - EDS - IS\\6801\\Mull, Stack & Trim\\102773.pdf', 'C:\\WS\\WS\\WS - EDS - IS\\6801\\Mull, Stack & Trim\\103350.pdf', 'C:\\WS\\WS\\WS - EDS - IS\\6801\\Mull, Stack & Trim\\80-4123-01.pdf', 'C:\\WS\\WS\\WS - EDS - IS\\6801\\Mull, Stack & Trim\\80-4123-02.pdf', 'C:\\WS\\WS\\WS - EDS - IS\\6801\\Panel, Smooth FG\\80-2122-01.pdf', 'C:\\WS\\WS\\WS - EDS - IS\\6801\\Panel, Smooth FG\\80-1981-01.pdf', 'C:\\WS\\WS\\WS - EDS - IS\\6801\\Panel, Smooth FG\\80-1839-01.pdf', 'C:\\WS\\WS\\WS - EDS - IS\\6801\\Panel, Smooth Steel\\80-2762-01.pdf', 'C:\\WS\\WS\\WS - EDS - OS\\6901\\1W\\102829.pdf', 'C:\\WS\\WS\\WS - EDS - OS\\6901\\1W\\80-2087-01.pdf', 'C:\\WS\\WS\\WS - EDS - OS\\7901\\PNL\\80-1336-01.pdf', 'C:\\WS\\WS\\WS Alum Clad\\CA & AW\\8200\\EB, Segment\\08-2053-02.pdf', 'C:\\WS\\WS\\WS Alum Clad\\CA & AW\\8204\\Grilles\\70-1947-01.pdf', 'C:\\WS\\WS\\WS Alum Clad\\DH Window\\810\\DH\\85-4965-01.pdf', 'C:\\WS\\WS\\WS Alum Clad\\SGD\\Pocket Door 1.75 Panel 8712\\2L or 2R Single Direction\\85-3313-01.pdf', 'C:\\WS\\WS\\WS Alum Clad\\SGD\\Pocket Door 1.75 Panel 8712\\2L or 2R Single Direction\\85-2440-01.pdf', 'C:\\WS\\WS\\WS Alum Clad\\SGD\\Pocket Door 1.75 Panel 8712\\2L2R 4W Biparting\\85-3331-04.pdf', 'C:\\WS\\WS\\WS Alum Clad\\SGD\\Pocket Door 2.25 Panel 8713\\2L or 2R Single Direction\\85-3779-03.pdf', 'C:\\WS\\WS\\WS HR175\\SH_6101\\Single\\60-12643-01.pdf', 'C:\\WS\\WS\\WS HR175\\SH_6101\\Single\\60-12638-01.pdf', 'C:\\WS\\WS\\WS HR175\\SH_6101\\Single\\60-12602-01.pdf', 'C:\\WS\\WS\\WS HR175\\SH_6101\\Single\\60-12601-01.pdf', 'C:\\WS\\WS\\WS HR175\\SH_6101\\Single\\60-12644-01.pdf', 'C:\\WS\\WS\\WS HR175\\SH_6101\\Single\\60-12636-01.pdf']
Existent files: ['C:\\WS\\WS\\Aspire\\CA & AW\\7205\\AW\\85-7534-01.pdf']
Grouped files: [['C:\\WS\\WS\\Aspire\\CA & AW\\7205\\AW\\85-7534-01.pdf']]
Upvotes: 1
Views: 123
Reputation: 81
I broke this down into the simplest version to get to the fundamental problem. which is why does one path work from my list of paths and all the others don't? What I discovered through pure luck is that when I went to the path location and opened the file from inside my pdm vault, python's os module will then recognize it as a path. Really strange to me. If anyone has an explanation as to why that would be, I would appreciate it.
I talked to our IT department, and they said it might have something to do with me using a C: path instead of the server path. They weren't sure though. They don't know very much about how pdm is structured.
'
Here is the code I wrote to create a simple go no-go list.
'
import pandas as pd
import os
#creates a dataframe in python of the information in my csv file
main_df = pd.read_csv("C://Users//27659//Desktop//Unique Wood Profiles.csv")
# Turns the columns of the dataframe into lists
drawing_number_list = main_df['Name'].tolist()
description_list = main_df['Description'].tolist()
found_in_list = main_df['Found In'].tolist()
# I've always done my empty lists this way. i never took the time to learn about empty lists and this only adds one more line of code.
full_file_list = ['placeholder']
# fill the list with the concatenated strings from the other list. puts together the full path to the file.
for i in range(0, len(drawing_number_list)):
full_file_list.append(found_in_list[i] + drawing_number_list[i] + '.pdf')
# index 0 of the list is still the string 'placeholder' this deletes it.
del full_file_list[0]
# some boolean logic that will tell me if the path is something the computer can use. this also puts the print out in a nice format that can be copy and pasted from the print window.
for i in range(0, len(full_file_list)):
if os.path.exists(full_file_list[i]):
print('1\t' + full_file_list[i])
else:
print('0\t' + full_file_list[i])
'
It's very similar to Jayjayyy's code. With the print out this way I can copy and paste the print out into a txt file and go through each one and open and close the file that the path goes to. since I don't have that many files in my list, I'm going to do it manually. if I had more you would have to get the path from the actual server. This project is a one off check for me, so it's not that important to have the server path. I would recommend that if someone has the same problem in the future, take the time and get the correct path straight from the server, and the permissions that go with it. it will save you a lot of headache.
Upvotes: 0
Reputation: 11282
You really should be able to make that question shorter. Why not write some functions? Then you could identify a certain function as the problem and your question would be about that function only.
Maybe this helps?
def get_filenames_list(csv_filename):
import os
import pandas
# Read table from CSV file
table = pandas.read_csv(csv_filename)
# Create list of all files from table
filenames = []
for name, path in zip(table["Name"], table["Found In"]):
filename = "{}.pdf".format(os.path.join(path, name))
filenames.append(filename)
return filenames
def remove_nonexistent_files(filenames):
import os
# Remove nonexistent files from list of filenames
filenames = list(filter(os.path.isfile, filenames))
return filenames
def group_identical_files(filenames, buffer_size=1024):
# Remove duplicates from list of filenames
filenames = list(set(filenames))
groups = []
while len(filenames) > 0:
a_filename = filenames.pop()
group = [a_filename]
for b_filename in filenames:
with open(a_filename, "rb") as a_handle:
with open(b_filename, "rb") as b_handle:
identical = False
while True:
a_buffer = a_handle.read(buffer_size)
b_buffer = b_handle.read(buffer_size)
if a_buffer != b_buffer:
break
if len(a_buffer) == 0 and len(b_buffer) == 0:
# EOF is reached for both files
identical = True
break
if identical:
group.append(b_filename)
filenames.remove(b_filename)
groups.append(group)
return groups
if __name__ == "__main__":
files = get_filenames_list("C://Users//27659//Desktop//Unique Wood Profiles.csv")
print("All files:", files)
existent_files = remove_nonexistent_files(files)
print("Existent files:", existent_files)
grouped_files = group_identical_files(existent_files)
print("Grouped files:", grouped_files)
You might have to adjust the path to you CSV file (which I've taken from you code above) but otherwise, you can just run that script and it will show you
All files
: Contains all filenames taken from the CSV file.Existent files
: So you can check if the script succeeded in putting the filenames together. (If this list is empty, you'll know that either these files don't exist, or the prior step did not work.)Grouped files
: The result where each list contains the filenames of identical files. If a list only has one element, then no other file is identical to that one.Upvotes: 1