Create a new folder in the Tasks subfolder of your DropPy workspace (default:
The Tasks that come with DropPy adhere to a naming scheme of Category.Name - but you can name your Task as you wish.
DropPy will search for a file named
task.py in this folder and try to instantiate the class Task.
*.py files can be present and can be imported in your Task. DropPy will ignore these.
Make sure to adhere to the following signature:
class Task(object): def __init__(self, input_dir, output_dir, **kwargs): # ...
Other than that you’re free to do anything in your Task. Just write Python as you’re used to!
If you want to add text to the log file just use
print('Writing results to "%s"' % directory)
If you want to abort and throw an error you can do it like this:
sys.exit('Error message for log file here')
Some common helper functions can be found in
/Users/YourUserName/DropPy/Tasks/DropPy.Common/task.py. Import them like this:
sys.path.append(os.path.abspath(os.path.join(__file__, os.pardir, os.pardir, 'DropPy.Common'))) from file_tools import copy_file, copy_tree from task_tools import pass_input_to_output