I want to have a program which will form a list of all *.py scripts in a sub-directory, and then call some standard messages on them. So I can add a new data source modularly by just dropping a new file into the sources directory with the appropriate methods in it.
For example: path = sys.path[0] print "Starting Directory:: " + path getDir=path + "\Sources" # point to directory of data sources for name in os.listdir(getDir): # run collection from each source src = imp.load_source("data",getDir,open(getDir+"\\"+name, 'rb')) src.getData() src.doGraph() This works fine, but in the sub-modules the sys.path appropriately returns the same as from the parent, I want them to know their own file names. How?? I can pass it to them, but wondered if there is a more self-sufficient way for a module to know from where it was invoked. -- http://mail.python.org/mailman/listinfo/python-list