A collection of python scripts to simplify work with databases, logging, configuration file parsing. It even features simple webserver.

Its primary use is in Datatechlabs products, but it can be used in any python project.


For production, please only use most recent tag

tar -xvzf wobble.X.Y.Z.tgz
cd wobble_X_Y_Z
python install

Example usage

Here is small example which demonstrates usage of wobble's slog, conf and db modules. Create 2 files: - the test script

#!/usr/bin/env python

from wobble import slog, conf, db

# read config file

config_file = "test.conf"

# print all configuration on screen"dumping configuration:", conf.get_all())

# connect to database (this will fail if you haven't set the database yet
# but shows the concept of getting config attributes

db_enable = conf.get_bool('DATABASE', 'enable')
db_name = conf.get_str('DATABASE', 'name')
db_host = conf.get_str('DATABASE', 'host')
db_user = conf.get_str('DATABASE', 'user')
db_pass = conf.get_str('DATABASE', 'pass')

# connect to database. You can have as many handles as you like
db_handle = "connection1"

    db.connect("mysql", db_handle, db_host, db_user, db_name, db_pass)
    # print an error using slog module
    slog.err("Database connection failed")

# you can change the configuration on the fly:"Database enable is ", conf.get_bool('DATABASE', 'enable'))

conf.set_value('DATABASE', 'enable', 'false')

# print again"Database enable now is ", conf.get_bool('DATABASE', 'enable'))

test.conf - the test config file


enable = True
name = "test_db"
host = "localhost"
user = "someuser"
pass = "somepass"


log_levels = "error,warning,info,verbose,db"
log_file = "/path/to/log/file.log"

And now run the script: python

To see more, please consult example_usage directory for web server example with template parser.