I'm trying to instaniate (not sure if thats correct spelling lol) one of my classes but even though i've spelt the name correctly i keep getting a NameError:
main:
import os
import os.path
import shutil
print "#######################################################################"
print "# FOLDER SORTER - VERSION 0.1 Beta #"
print "# This is a small utility which should sort all your rag-tag #"
print "# files into folders of the same name. #"
print "#######################################################################"
print "# For a Full List of Commands type help at the prompt #"
print "#######################################################################"
pf = PathFinder.init()
pathfinder:
class PathFinder:
u_dir = ""
def init(self):
self.get_dir()
def get_dir(self):
self.u_dir = raw_input("Please Enter A Default Path: ")
self.check_dir(u_dir)
def check_dir(self,u_dir):
if os.path.exists(u_dir):
self.list_dir(u_dir)
else:
print "Sorry, The Path You Entered Could Not Be Found."
def list_dir(self,u_dir):
print "The following files and folders where found at the"
print "location you specified\n"
for names in sorted(os.listdir(u_dir)):
if os.path.splitext(names) [1] == '':
print "Folder: ", names
else:
print "File: ", names
and i get this error:
Traceback (most recent call last):
File "E:\python\folder_sorter_version_02\Main.py", line 15, in <module>
pf = PathFinder.init()
NameError: name 'PathFinder' is not defined
I'm pretty sure i'm missing something simple but i just cant see it, so i would greatly appreciate any help anyone has to offer.