Add all dirs under folder to sys.path if any .py files are found.
Use an abspath if you'd rather do it that way.
Uses the current working directory as the location of using.py.
Keep in mind that os.walk goes all the way down the directory tree.
This script takes advantage of PEP 370, "Per user site-packages directory". It manages .pth files, which are are non-volatile (unlike manually adding to sys.path). See http://docs.python.org/library/site.html.
For something I am working on, I needed the ability to scan a supplied directory, adding the directory to the sys.path within Python, and then blanket import the modules within that directory. Following that, I had to filter any builtin or special...
This code eliminates the need to convert line endings when moving .py modules between OSes. Put in your sitecustomize.py, anywhere on sys.path, and you'll be able to import Python modules with any of Unix, Mac, or Windows line endings, on any OS.
After wondering what the easiest what to access one object from another was, the following functions were written to automatically discover the shortest path possible. The find function takes the item to find and the object to find it from and...
Provides a _paths_from_path_patterns that will generate a list of paths from a list of path patterns. A "path pattern" can include glob chars. By default it generates a recursive listing of file paths, but: recursion can be turned off,...
Simple program to print the full name of all occurrences of the given filename in your PATH. Kind of like the Unix "which" utility, but works for DLLs and other files as well.
Usage: findinpath.py filename
This function is based on Yen's k-Shortest Path algorithm (1971)
1) [shortestPaths]: the list of K shortest paths (in cell array 1xK)
2) [totalCosts] : costs of the K shortest paths (in array 1xK)
find the shortest Euclidean path that is bounded
by the functions low(t) and high(t).
the algorithm is based on Dijkstra shortest path search algorithm
[ty y] = shortest_path_mfile(t,low,high)
Shortlinks By Path hooks into the WordPress filter get_shortlink to only return the path for a shortlink. This makes it easier to retrieve the shortlink url with an absolute path minus the domain name.
By default WordPress returns the...
Legacy Path is intended to support websites that are moving to Drupal but have content that either won't be managed by Drupal immediately or at all, but must remain reachable through it's original URL. The assumption is made that the legacy system...
Feed Path Publisher allows site admins to publish multiple RSS feeds in the document's <head> tag. Modern browsers use this information to populate the (usually orange) RSS icon in their URL or location bar.
Feeds can be published...
Fixes the problem of bad email 'Return-Path' header settings which prevent email bounce backs going to the sender
of the email.
Most mail servers appear to over-write any 'Return-path' headers sent by the PHP...
Finding Your Path is an article which gives some code snippets to explain how to determine the location of your application. In this article author has provided methods to determine the Relative Path as well as Absolute Path for the program. Users...
Path.cgi a simple path directory structure at the top of your web pages to allow easier navigation. Requires SSI.
Path Protect is the Ultimate Search Path Manager. Backup and Restore your Search Path with ease. Add Delete or Edit items in your search path using easy to use Front End. Also able to view s.p. directories using mini-explorer. Can also find PAS...
A-star (A*) Shortest Path Algorithm
Dijkstra shortest path algorithm.
If you install python under windows and then open a command shell (DOS-prompt, you normally get an error message
if you type "python" at the prompt. This is because the directory of the python executable is not in the PATH...
This recipe is a kind of extension to os.path
It offers an entire split function and a true commonprefix for paths.