bw2data.filesystem
#
Module Contents#
Functions#
|
Returns |
|
Create directory tree to dirpath; ignore if already exists |
|
Generate MD5 hash for file at filepath |
|
Convert arbitrary strings to make them safe for filenames. Substitutes strange characters, and uses unicode normalization. |
Attributes#
- bw2data.filesystem.check_dir(directory)[source]#
Returns
True
if given path is a directory and writeable,False
otherwise.
- bw2data.filesystem.create_dir(dirpath)[source]#
Create directory tree to dirpath; ignore if already exists
- bw2data.filesystem.safe_filename(string, add_hash=True)[source]#
Convert arbitrary strings to make them safe for filenames. Substitutes strange characters, and uses unicode normalization.
if add_hash, appends hash of string to avoid name collisions.
From http://stackoverflow.com/questions/295135/turn-a-string-into-a-valid-filename-in-python