Skip to content

Instantly share code, notes, and snippets.

@maltzsama
Last active December 16, 2015 07:08
Show Gist options
  • Select an option

  • Save maltzsama/5396320 to your computer and use it in GitHub Desktop.

Select an option

Save maltzsama/5396320 to your computer and use it in GitHub Desktop.
md5sum example python with dialog
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import dialog
import os
from hashlib import md5
dial=dialog.Dialog()
curr=os.path.abspath('')
print curr
code, value =dial.fselect(os.path.abspath(''), width=50, height=12)
if code:
dial.msgbox("Vc sai com ESC", height=10, width=45)
else:
md5a=md5()
fileread=open(value,'rb').read()
md5a.update(fileread)
dial.msgbox("Arquivo ou diretório escolhido: %s\nmd5sum:%s"%(value,str(md5a.hexdigest())), height=10, width=55)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment