Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
chkFile with absolute paths
#1
Hey everyone,

Here is a function I made to check if files exist.
def chkFile(filesPath):
	if hasattr(filesPath, "__len__"):
		for i in filesPath:
			if not path.exists(i):
				return False
		return True
	else:
		return path.exists(filesPath)
it works great for files in the main directories, and subdirectories. However I am trying to get it to recognize a file located in /sys/bus/w1/devices/, which is nowhere near my working dir. anyone know how I can change this to accept absolute dir's?

Thanks
Reply


Messages In This Thread
chkFile with absolute paths - by JarredAwesome - Sep-20-2020, 01:18 AM
RE: chkFile with absolute paths - by bowlofred - Sep-20-2020, 01:31 AM
RE: chkFile with absolute paths - by JarredAwesome - Sep-20-2020, 02:24 AM
RE: chkFile with absolute paths - by bowlofred - Sep-20-2020, 02:52 AM
RE: chkFile with absolute paths - by JarredAwesome - Sep-20-2020, 12:55 PM
RE: chkFile with absolute paths - by bowlofred - Sep-20-2020, 04:33 PM
RE: chkFile with absolute paths - by JarredAwesome - Sep-21-2020, 02:22 AM
RE: chkFile with absolute paths - by bowlofred - Sep-21-2020, 03:51 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Absolute paths in subprocess - file not found kittyticker 4 478 Jan-28-2024, 10:37 PM
Last Post: kittyticker
  pdf2image, poppler and paths jehoshua 18 14,515 Jun-14-2022, 06:38 AM
Last Post: jehoshua
  Windows paths issue otalado 3 1,454 May-29-2022, 09:11 AM
Last Post: snippsat
  automatically get absolute paths oclmedyb 1 2,107 Mar-11-2021, 04:31 PM
Last Post: deanhystad
  Absolute beginner am I missing something? kamren 7 3,150 Sep-25-2020, 05:32 AM
Last Post: buran
  absolute imports between folders mikisDW 0 1,528 Aug-05-2020, 12:26 PM
Last Post: mikisDW
  Paths millpond 12 5,177 Jul-30-2020, 01:16 PM
Last Post: snippsat
  Problems with windows paths delphinis 6 5,153 Jul-21-2020, 06:11 PM
Last Post: Gribouillis
  I am an absolute newbie.Help me! feynarun 4 2,476 Apr-11-2020, 09:25 PM
Last Post: feynarun
  Shortest paths to win snake and ladder sandaab 5 4,217 Jun-30-2019, 03:20 PM
Last Post: sandaab

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020