Module Contents




srss.getClipboardText()

Get clipboard text.




srss.setClipboardText(s)

Set clipboard text.




srss.DBG(obj=None)

Print values of local variables.




srss.registerDebughook(b=True)

Register callback for printing values of local variables.




srss.getRandomString(maxVal=1000 * 1000, asHex=False, rng=_random)

Generate a random string of digits.




srss.genUuid(asBase64=False)

Generate a UUID.




class srss.IndependentRNG(seed=None)

Keep a separate random stream that won’t get affected by someone else. Sometimes you want to set rng state to get a repeatable sequence of numbers back, which would get thrown off by other parts of the program also getting rng values.




srss.downloadUrl(url, toFile=None, timeout=30, asText=False)

Download a URL, if toFile is not specified returns the results as a string.




srss.startThread(fn, args=None)

Start a thread.

>>> import time
>>> def fn(name):
>>>     print('my name is ' + name)
>>>     time.sleep(1)
>>>
>>> t = startThread(fn, ['Bob'])
>>> t.join()



srss.softDeleteFile(path, allowDirs=False, doTrace=False)

Delete a file in a recoverable way, either OS Trash or a designated folder.

Defaults to ~/trash.

Configure behavior by editing shinerainsevenlib.cfg,

You can set trashDir to be 'recycleBin' or 'currentDriveDataLocalTrash' or a path




srss.getSoftTempDir(path='', preferEphemeral=False)

Get a temporary directory.

Defaults to default OS temp directory, can be configured in shinerainsevenlib.cfg.

tempDir = (path to dir)

tempEphemeralDir = (path to dir)

An ephemeral dir is one where data isn’t kept long term. I often configure this to be a RAM drive, which are useful for heavy read/write scenarios.